From 70dc3a61f04e83f69493d2e9c008612851863b4e Mon Sep 17 00:00:00 2001 From: Peng Jiahui <46921893+Alancere@users.noreply.github.com> Date: Mon, 3 Apr 2023 17:41:14 +0800 Subject: [PATCH] Release refresh all package 1680510130 (#20536) * [Release] sdk/resourcemanager/blueprint/armblueprint/0.6.0 generation from spec commit: f790e624d0d080b89d962a3bd19c65bc6a6b2f5e * [Release] sdk/resourcemanager/search/armsearch/2.0.0 generation from spec commit: f790e624d0d080b89d962a3bd19c65bc6a6b2f5e * [Release] sdk/resourcemanager/billingbenefits/armbillingbenefits/2.0.0 generation from spec commit: f790e624d0d080b89d962a3bd19c65bc6a6b2f5e * [Release] sdk/resourcemanager/iotsecurity/armiotsecurity/0.6.0 generation from spec commit: f790e624d0d080b89d962a3bd19c65bc6a6b2f5e * [Release] sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/2.0.0 generation from spec commit: f790e624d0d080b89d962a3bd19c65bc6a6b2f5e * update changelog and readme * sdk/resourcemanager/storageimportexport/armstorageimportexport/0.6.0 * sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/2.0.0 * fix blurprint changelog * fix * fix --- .../armbillingbenefits/CHANGELOG.md | 13 + .../armbillingbenefits/README.md | 18 +- .../armbillingbenefits/autorest.md | 6 +- .../armbillingbenefits/client_factory.go | 67 + .../armbillingbenefits/constants.go | 2 +- .../armbillingbenefits/date_type.go | 2 +- .../billingbenefits/armbillingbenefits/go.mod | 24 +- .../billingbenefits/armbillingbenefits/go.sum | 45 +- .../armbillingbenefits/models.go | 12 +- .../armbillingbenefits/models_serde.go | 86 +- .../armbillingbenefits/operations_client.go | 28 +- .../operations_client_example_test.go | 91 +- .../reservationorderalias_client.go | 50 +- ...servationorderalias_client_example_test.go | 74 +- .../armbillingbenefits/response_types.go | 12 +- .../armbillingbenefits/rp_client.go | 30 +- .../rp_client_example_test.go | 23 +- .../armbillingbenefits/savingsplan_client.go | 85 +- .../savingsplan_client_example_test.go | 379 ++- .../savingsplanorder_client.go | 58 +- .../savingsplanorder_client_example_test.go | 417 +++- .../savingsplanorderalias_client.go | 50 +- ...vingsplanorderalias_client_example_test.go | 102 +- .../armbillingbenefits/time_rfc3339.go | 2 +- .../blueprint/armblueprint/CHANGELOG.md | 6 + .../blueprint/armblueprint/README.md | 16 +- ...rtifacts_client.go => artifacts_client.go} | 85 +- .../artifacts_client_example_test.go | 1087 ++++++++ ...ient.go => assignmentoperations_client.go} | 55 +- ...ssignmentoperations_client_example_test.go | 250 ++ ...nments_client.go => assignments_client.go} | 92 +- .../assignments_client_example_test.go | 567 +++++ .../blueprint/armblueprint/autorest.md | 6 +- ...eprints_client.go => blueprints_client.go} | 77 +- .../blueprints_client_example_test.go | 512 ++++ .../blueprint/armblueprint/client_factory.go | 67 + ...zz_generated_constants.go => constants.go} | 3 +- .../blueprint/armblueprint/go.mod | 22 +- .../blueprint/armblueprint/go.sum | 48 +- .../{zz_generated_models.go => models.go} | 72 +- .../blueprint/armblueprint/models_serde.go | 1748 +++++++++++++ ...phic_helpers.go => polymorphic_helpers.go} | 3 +- ...client.go => publishedartifacts_client.go} | 56 +- .../publishedartifacts_client_example_test.go | 542 ++++ ...lient.go => publishedblueprints_client.go} | 87 +- ...publishedblueprints_client_example_test.go | 416 ++++ ...ed_response_types.go => response_types.go} | 13 +- ...erated_time_rfc3339.go => time_rfc3339.go} | 3 +- ...generated_example_artifacts_client_test.go | 162 -- ...xample_assignmentoperations_client_test.go | 66 - ...nerated_example_assignments_client_test.go | 158 -- ...enerated_example_blueprints_client_test.go | 141 -- ..._example_publishedartifacts_client_test.go | 68 - ...example_publishedblueprints_client_test.go | 110 - .../armblueprint/zz_generated_models_serde.go | 466 ---- .../iotsecurity/armiotsecurity/CHANGELOG.md | 19 + .../iotsecurity/armiotsecurity/README.md | 16 +- .../iotsecurity/armiotsecurity/autorest.md | 6 +- .../armiotsecurity/client_factory.go | 79 + ...zz_generated_constants.go => constants.go} | 3 +- ...s_client.go => defendersettings_client.go} | 74 +- .../defendersettings_client_example_test.go | 333 +++ ...roups_client.go => devicegroups_client.go} | 124 +- .../devicegroups_client_example_test.go | 150 ++ ...ed_devices_client.go => devices_client.go} | 80 +- .../devices_client_example_test.go | 174 ++ .../iotsecurity/armiotsecurity/go.mod | 22 +- .../iotsecurity/armiotsecurity/go.sum | 48 +- ...ocations_client.go => locations_client.go} | 61 +- .../locations_client_example_test.go | 96 + .../{zz_generated_models.go => models.go} | 23 +- .../armiotsecurity/models_serde.go | 2211 +++++++++++++++++ ...s_client.go => onpremisesensors_client.go} | 84 +- .../onpremisesensors_client_example_test.go | 195 ++ ...rations_client.go => operations_client.go} | 30 +- .../operations_client_example_test.go | 116 + ...ed_response_types.go => response_types.go} | 9 +- ...ed_sensors_client.go => sensors_client.go} | 107 +- .../sensors_client_example_test.go | 250 ++ ...erated_sites_client.go => sites_client.go} | 60 +- .../sites_client_example_test.go | 167 ++ ...erated_time_rfc3339.go => time_rfc3339.go} | 3 +- ...ed_example_defendersettings_client_test.go | 145 -- ...erated_example_devicegroups_client_test.go | 109 - ...e_generated_example_devices_client_test.go | 66 - ...generated_example_locations_client_test.go | 63 - ...ed_example_onpremisesensors_client_test.go | 140 -- ...enerated_example_operations_client_test.go | 41 - ...e_generated_example_sensors_client_test.go | 173 -- .../ze_generated_example_sites_client_test.go | 109 - .../zz_generated_models_serde.go | 374 --- .../armpowerbiprivatelinks/CHANGELOG.md | 25 + .../armpowerbiprivatelinks/README.md | 16 +- .../armpowerbiprivatelinks/autorest.md | 6 +- .../armpowerbiprivatelinks/client_factory.go | 74 + ...zz_generated_constants.go => constants.go} | 3 +- .../armpowerbiprivatelinks/go.mod | 24 +- .../armpowerbiprivatelinks/go.sum | 48 +- .../{zz_generated_models.go => models.go} | 9 +- .../armpowerbiprivatelinks/models_serde.go | 890 +++++++ ...rations_client.go => operations_client.go} | 30 +- .../operations_client_example_test.go | 163 ++ ...s_client.go => powerbiresources_client.go} | 150 +- .../powerbiresources_client_example_test.go | 164 ++ ...o => privateendpointconnections_client.go} | 172 +- ...endpointconnections_client_example_test.go | 164 ++ ...ient.go => privatelinkresources_client.go} | 97 +- ...rivatelinkresources_client_example_test.go | 92 + ...serviceresourceoperationresults_client.go} | 60 +- ...ceoperationresults_client_example_test.go} | 19 +- ...lient.go => privatelinkservices_client.go} | 55 +- ...privatelinkservices_client_example_test.go | 66 + ...> privatelinkservicesforpowerbi_client.go} | 33 +- ...kservicesforpowerbi_client_example_test.go | 66 + ...ed_response_types.go => response_types.go} | 11 +- ...erated_time_rfc3339.go => time_rfc3339.go} | 3 +- ...enerated_example_operations_client_test.go | 41 - ...ed_example_powerbiresources_client_test.go | 124 - ..._privateendpointconnections_client_test.go | 130 - ...xample_privatelinkresources_client_test.go | 66 - ...example_privatelinkservices_client_test.go | 38 - ...ivatelinkservicesforpowerbi_client_test.go | 9 - .../zz_generated_models_serde.go | 104 - .../CHANGELOG.md | 174 ++ .../armrecoveryservicessiterecovery/README.md | 16 +- .../autorest.md | 7 +- .../client_factory.go | 179 ++ .../constants.go | 2 +- .../armrecoveryservicessiterecovery/go.mod | 24 +- .../armrecoveryservicessiterecovery/go.sum | 45 +- .../migrationrecoverypoints_client.go | 107 +- ...ationrecoverypoints_client_example_test.go | 55 +- .../armrecoveryservicessiterecovery/models.go | 74 +- .../models_serde.go | 1032 ++++---- .../operations_client.go | 52 +- .../operations_client_example_test.go | 1229 ++++++++- .../polymorphic_helpers.go | 104 +- .../recoverypoints_client.go | 105 +- .../recoverypoints_client_example_test.go | 55 +- .../replicationalertsettings_client.go | 128 +- ...cationalertsettings_client_example_test.go | 70 +- .../replicationappliances_client.go | 64 +- ...plicationappliances_client_example_test.go | 28 +- .../replicationeligibilityresults_client.go | 80 +- ...neligibilityresults_client_example_test.go | 63 +- .../replicationevents_client.go | 92 +- .../replicationevents_client_example_test.go | 99 +- .../replicationfabrics_client.go | 378 +-- .../replicationfabrics_client_example_test.go | 214 +- .../replicationjobs_client.go | 254 +- .../replicationjobs_client_example_test.go | 344 ++- .../replicationlogicalnetworks_client.go | 99 +- ...tionlogicalnetworks_client_example_test.go | 61 +- .../replicationmigrationitems_client.go | 544 ++-- ...ationmigrationitems_client_example_test.go | 413 ++- .../replicationnetworkmappings_client.go | 268 +- ...tionnetworkmappings_client_example_test.go | 158 +- .../replicationnetworks_client.go | 126 +- ...replicationnetworks_client_example_test.go | 128 +- .../replicationpolicies_client.go | 217 +- ...replicationpolicies_client_example_test.go | 96 +- .../replicationprotectableitems_client.go | 103 +- ...ionprotectableitems_client_example_test.go | 79 +- .../replicationprotecteditems_client.go | 998 ++++---- ...ationprotecteditems_client_example_test.go | 999 +++++++- ...ationprotectioncontainermappings_client.go | 314 +-- ...oncontainermappings_client_example_test.go | 171 +- .../replicationprotectioncontainers_client.go | 302 +-- ...rotectioncontainers_client_example_test.go | 155 +- .../replicationprotectionintents_client.go | 128 +- ...onprotectionintents_client_example_test.go | 87 +- .../replicationrecoveryplans_client.go | 507 ++-- ...cationrecoveryplans_client_example_test.go | 762 +++++- ...icationrecoveryservicesproviders_client.go | 298 +-- ...ryservicesproviders_client_example_test.go | 164 +- ...ionstorageclassificationmappings_client.go | 222 +- ...ssificationmappings_client_example_test.go | 91 +- ...eplicationstorageclassifications_client.go | 128 +- ...rageclassifications_client_example_test.go | 68 +- .../replicationvaulthealth_client.go | 102 +- ...licationvaulthealth_client_example_test.go | 69 +- .../replicationvaultsetting_client.go | 137 +- ...icationvaultsetting_client_example_test.go | 61 +- .../replicationvcenters_client.go | 256 +- ...replicationvcenters_client_example_test.go | 143 +- .../response_types.go | 218 +- .../supportedoperatingsystems_client.go | 64 +- ...tedoperatingsystems_client_example_test.go | 41 +- .../targetcomputesizes_client.go | 70 +- .../targetcomputesizes_client_example_test.go | 50 +- .../time_rfc3339.go | 2 +- .../search/armsearch/CHANGELOG.md | 6 + .../search/armsearch/README.md | 16 +- ...dminkeys_client.go => adminkeys_client.go} | 62 +- .../adminkeys_client_example_test.go | 66 + .../search/armsearch/autorest.md | 7 +- .../search/armsearch/client_factory.go | 75 + ...zz_generated_constants.go => constants.go} | 3 +- sdk/resourcemanager/search/armsearch/go.mod | 22 +- sdk/resourcemanager/search/armsearch/go.sum | 48 +- .../{zz_generated_models.go => models.go} | 42 +- .../search/armsearch/models_serde.go | 1173 +++++++++ ...rations_client.go => operations_client.go} | 30 +- .../operations_client_example_test.go | 298 +++ ...o => privateendpointconnections_client.go} | 117 +- ...endpointconnections_client_example_test.go | 174 ++ ...ient.go => privatelinkresources_client.go} | 46 +- ...rivatelinkresources_client_example_test.go | 115 + ...uerykeys_client.go => querykeys_client.go} | 84 +- .../querykeys_client_example_test.go | 95 + ...ed_response_types.go => response_types.go} | 21 +- ..._services_client.go => services_client.go} | 160 +- .../armsearch/services_client_example_test.go | 785 ++++++ ...o => sharedprivatelinkresources_client.go} | 127 +- ...rivatelinkresources_client_example_test.go | 151 ++ ...generated_example_adminkeys_client_test.go | 64 - ..._privateendpointconnections_client_test.go | 125 - ...xample_privatelinkresources_client_test.go | 44 - ...generated_example_querykeys_client_test.go | 90 - ..._generated_example_services_client_test.go | 211 -- ..._sharedprivatelinkresources_client_test.go | 130 - .../armsearch/zz_generated_models_serde.go | 97 - .../armstorageimportexport/CHANGELOG.md | 6 + .../armstorageimportexport/README.md | 16 +- .../armstorageimportexport/autorest.md | 2 +- ...keys_client.go => bitlockerkeys_client.go} | 38 +- .../bitlockerkeys_client_example_test.go | 50 + .../armstorageimportexport/client_factory.go | 61 + ...zz_generated_constants.go => constants.go} | 3 +- .../armstorageimportexport/go.mod | 22 +- .../armstorageimportexport/go.sum | 48 +- ...enerated_jobs_client.go => jobs_client.go} | 95 +- .../jobs_client_example_test.go | 871 +++++++ ...ocations_client.go => locations_client.go} | 41 +- .../locations_client_example_test.go | 126 + .../{zz_generated_models.go => models.go} | 19 +- .../armstorageimportexport/models_serde.go | 1209 +++++++++ ...rations_client.go => operations_client.go} | 32 +- .../operations_client_example_test.go | 100 + ...ed_response_types.go => response_types.go} | 11 +- ...erated_time_rfc3339.go => time_rfc3339.go} | 3 +- ...rated_example_bitlockerkeys_client_test.go | 44 - .../ze_generated_example_jobs_client_test.go | 201 -- ...generated_example_locations_client_test.go | 62 - ...enerated_example_operations_client_test.go | 41 - .../zz_generated_models_serde.go | 125 - 246 files changed, 28386 insertions(+), 10689 deletions(-) create mode 100644 sdk/resourcemanager/billingbenefits/armbillingbenefits/client_factory.go rename sdk/resourcemanager/blueprint/armblueprint/{zz_generated_artifacts_client.go => artifacts_client.go} (79%) create mode 100644 sdk/resourcemanager/blueprint/armblueprint/artifacts_client_example_test.go rename sdk/resourcemanager/blueprint/armblueprint/{zz_generated_assignmentoperations_client.go => assignmentoperations_client.go} (78%) create mode 100644 sdk/resourcemanager/blueprint/armblueprint/assignmentoperations_client_example_test.go rename sdk/resourcemanager/blueprint/armblueprint/{zz_generated_assignments_client.go => assignments_client.go} (79%) create mode 100644 sdk/resourcemanager/blueprint/armblueprint/assignments_client_example_test.go rename sdk/resourcemanager/blueprint/armblueprint/{zz_generated_blueprints_client.go => blueprints_client.go} (78%) create mode 100644 sdk/resourcemanager/blueprint/armblueprint/blueprints_client_example_test.go create mode 100644 sdk/resourcemanager/blueprint/armblueprint/client_factory.go rename sdk/resourcemanager/blueprint/armblueprint/{zz_generated_constants.go => constants.go} (99%) rename sdk/resourcemanager/blueprint/armblueprint/{zz_generated_models.go => models.go} (92%) create mode 100644 sdk/resourcemanager/blueprint/armblueprint/models_serde.go rename sdk/resourcemanager/blueprint/armblueprint/{zz_generated_polymorphic_helpers.go => polymorphic_helpers.go} (97%) rename sdk/resourcemanager/blueprint/armblueprint/{zz_generated_publishedartifacts_client.go => publishedartifacts_client.go} (78%) create mode 100644 sdk/resourcemanager/blueprint/armblueprint/publishedartifacts_client_example_test.go rename sdk/resourcemanager/blueprint/armblueprint/{zz_generated_publishedblueprints_client.go => publishedblueprints_client.go} (79%) create mode 100644 sdk/resourcemanager/blueprint/armblueprint/publishedblueprints_client_example_test.go rename sdk/resourcemanager/blueprint/armblueprint/{zz_generated_response_types.go => response_types.go} (94%) rename sdk/resourcemanager/blueprint/armblueprint/{zz_generated_time_rfc3339.go => time_rfc3339.go} (96%) delete mode 100644 sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_artifacts_client_test.go delete mode 100644 sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_assignmentoperations_client_test.go delete mode 100644 sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_assignments_client_test.go delete mode 100644 sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_blueprints_client_test.go delete mode 100644 sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_publishedartifacts_client_test.go delete mode 100644 sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_publishedblueprints_client_test.go delete mode 100644 sdk/resourcemanager/blueprint/armblueprint/zz_generated_models_serde.go create mode 100644 sdk/resourcemanager/iotsecurity/armiotsecurity/client_factory.go rename sdk/resourcemanager/iotsecurity/armiotsecurity/{zz_generated_constants.go => constants.go} (99%) rename sdk/resourcemanager/iotsecurity/armiotsecurity/{zz_generated_defendersettings_client.go => defendersettings_client.go} (86%) create mode 100644 sdk/resourcemanager/iotsecurity/armiotsecurity/defendersettings_client_example_test.go rename sdk/resourcemanager/iotsecurity/armiotsecurity/{zz_generated_devicegroups_client.go => devicegroups_client.go} (67%) create mode 100644 sdk/resourcemanager/iotsecurity/armiotsecurity/devicegroups_client_example_test.go rename sdk/resourcemanager/iotsecurity/armiotsecurity/{zz_generated_devices_client.go => devices_client.go} (66%) create mode 100644 sdk/resourcemanager/iotsecurity/armiotsecurity/devices_client_example_test.go rename sdk/resourcemanager/iotsecurity/armiotsecurity/{zz_generated_locations_client.go => locations_client.go} (71%) create mode 100644 sdk/resourcemanager/iotsecurity/armiotsecurity/locations_client_example_test.go rename sdk/resourcemanager/iotsecurity/armiotsecurity/{zz_generated_models.go => models.go} (98%) create mode 100644 sdk/resourcemanager/iotsecurity/armiotsecurity/models_serde.go rename sdk/resourcemanager/iotsecurity/armiotsecurity/{zz_generated_onpremisesensors_client.go => onpremisesensors_client.go} (85%) create mode 100644 sdk/resourcemanager/iotsecurity/armiotsecurity/onpremisesensors_client_example_test.go rename sdk/resourcemanager/iotsecurity/armiotsecurity/{zz_generated_operations_client.go => operations_client.go} (77%) create mode 100644 sdk/resourcemanager/iotsecurity/armiotsecurity/operations_client_example_test.go rename sdk/resourcemanager/iotsecurity/armiotsecurity/{zz_generated_response_types.go => response_types.go} (97%) rename sdk/resourcemanager/iotsecurity/armiotsecurity/{zz_generated_sensors_client.go => sensors_client.go} (82%) create mode 100644 sdk/resourcemanager/iotsecurity/armiotsecurity/sensors_client_example_test.go rename sdk/resourcemanager/iotsecurity/armiotsecurity/{zz_generated_sites_client.go => sites_client.go} (81%) create mode 100644 sdk/resourcemanager/iotsecurity/armiotsecurity/sites_client_example_test.go rename sdk/resourcemanager/iotsecurity/armiotsecurity/{zz_generated_time_rfc3339.go => time_rfc3339.go} (96%) delete mode 100644 sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_defendersettings_client_test.go delete mode 100644 sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_devicegroups_client_test.go delete mode 100644 sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_devices_client_test.go delete mode 100644 sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_locations_client_test.go delete mode 100644 sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_onpremisesensors_client_test.go delete mode 100644 sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_operations_client_test.go delete mode 100644 sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_sensors_client_test.go delete mode 100644 sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_sites_client_test.go delete mode 100644 sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_models_serde.go create mode 100644 sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/client_factory.go rename sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/{zz_generated_constants.go => constants.go} (99%) rename sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/{zz_generated_models.go => models.go} (98%) create mode 100644 sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/models_serde.go rename sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/{zz_generated_operations_client.go => operations_client.go} (77%) create mode 100644 sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/operations_client_example_test.go rename sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/{zz_generated_powerbiresources_client.go => powerbiresources_client.go} (63%) create mode 100644 sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/powerbiresources_client_example_test.go rename sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/{zz_generated_privateendpointconnections_client.go => privateendpointconnections_client.go} (64%) create mode 100644 sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privateendpointconnections_client_example_test.go rename sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/{zz_generated_privatelinkresources_client.go => privatelinkresources_client.go} (64%) create mode 100644 sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkresources_client_example_test.go rename sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/{zz_generated_privatelinkserviceresourceoperationresults_client.go => privatelinkserviceresourceoperationresults_client.go} (59%) rename sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/{ze_generated_example_privatelinkserviceresourceoperationresults_client_test.go => privatelinkserviceresourceoperationresults_client_example_test.go} (51%) rename sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/{zz_generated_privatelinkservices_client.go => privatelinkservices_client.go} (61%) create mode 100644 sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkservices_client_example_test.go rename sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/{zz_generated_privatelinkservicesforpowerbi_client.go => privatelinkservicesforpowerbi_client.go} (78%) create mode 100644 sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkservicesforpowerbi_client_example_test.go rename sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/{zz_generated_response_types.go => response_types.go} (91%) rename sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/{zz_generated_time_rfc3339.go => time_rfc3339.go} (96%) delete mode 100644 sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_operations_client_test.go delete mode 100644 sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_powerbiresources_client_test.go delete mode 100644 sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_privateendpointconnections_client_test.go delete mode 100644 sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_privatelinkresources_client_test.go delete mode 100644 sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_privatelinkservices_client_test.go delete mode 100644 sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_privatelinkservicesforpowerbi_client_test.go delete mode 100644 sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_models_serde.go create mode 100644 sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/client_factory.go rename sdk/resourcemanager/search/armsearch/{zz_generated_adminkeys_client.go => adminkeys_client.go} (77%) create mode 100644 sdk/resourcemanager/search/armsearch/adminkeys_client_example_test.go create mode 100644 sdk/resourcemanager/search/armsearch/client_factory.go rename sdk/resourcemanager/search/armsearch/{zz_generated_constants.go => constants.go} (99%) rename sdk/resourcemanager/search/armsearch/{zz_generated_models.go => models.go} (95%) create mode 100644 sdk/resourcemanager/search/armsearch/models_serde.go rename sdk/resourcemanager/search/armsearch/{zz_generated_operations_client.go => operations_client.go} (76%) create mode 100644 sdk/resourcemanager/search/armsearch/operations_client_example_test.go rename sdk/resourcemanager/search/armsearch/{zz_generated_privateendpointconnections_client.go => privateendpointconnections_client.go} (79%) create mode 100644 sdk/resourcemanager/search/armsearch/privateendpointconnections_client_example_test.go rename sdk/resourcemanager/search/armsearch/{zz_generated_privatelinkresources_client.go => privatelinkresources_client.go} (75%) create mode 100644 sdk/resourcemanager/search/armsearch/privatelinkresources_client_example_test.go rename sdk/resourcemanager/search/armsearch/{zz_generated_querykeys_client.go => querykeys_client.go} (78%) create mode 100644 sdk/resourcemanager/search/armsearch/querykeys_client_example_test.go rename sdk/resourcemanager/search/armsearch/{zz_generated_response_types.go => response_types.go} (85%) rename sdk/resourcemanager/search/armsearch/{zz_generated_services_client.go => services_client.go} (80%) create mode 100644 sdk/resourcemanager/search/armsearch/services_client_example_test.go rename sdk/resourcemanager/search/armsearch/{zz_generated_sharedprivatelinkresources_client.go => sharedprivatelinkresources_client.go} (78%) create mode 100644 sdk/resourcemanager/search/armsearch/sharedprivatelinkresources_client_example_test.go delete mode 100644 sdk/resourcemanager/search/armsearch/ze_generated_example_adminkeys_client_test.go delete mode 100644 sdk/resourcemanager/search/armsearch/ze_generated_example_privateendpointconnections_client_test.go delete mode 100644 sdk/resourcemanager/search/armsearch/ze_generated_example_privatelinkresources_client_test.go delete mode 100644 sdk/resourcemanager/search/armsearch/ze_generated_example_querykeys_client_test.go delete mode 100644 sdk/resourcemanager/search/armsearch/ze_generated_example_services_client_test.go delete mode 100644 sdk/resourcemanager/search/armsearch/ze_generated_example_sharedprivatelinkresources_client_test.go delete mode 100644 sdk/resourcemanager/search/armsearch/zz_generated_models_serde.go rename sdk/resourcemanager/storageimportexport/armstorageimportexport/{zz_generated_bitlockerkeys_client.go => bitlockerkeys_client.go} (76%) create mode 100644 sdk/resourcemanager/storageimportexport/armstorageimportexport/bitlockerkeys_client_example_test.go create mode 100644 sdk/resourcemanager/storageimportexport/armstorageimportexport/client_factory.go rename sdk/resourcemanager/storageimportexport/armstorageimportexport/{zz_generated_constants.go => constants.go} (98%) rename sdk/resourcemanager/storageimportexport/armstorageimportexport/{zz_generated_jobs_client.go => jobs_client.go} (85%) create mode 100644 sdk/resourcemanager/storageimportexport/armstorageimportexport/jobs_client_example_test.go rename sdk/resourcemanager/storageimportexport/armstorageimportexport/{zz_generated_locations_client.go => locations_client.go} (80%) create mode 100644 sdk/resourcemanager/storageimportexport/armstorageimportexport/locations_client_example_test.go rename sdk/resourcemanager/storageimportexport/armstorageimportexport/{zz_generated_models.go => models.go} (98%) create mode 100644 sdk/resourcemanager/storageimportexport/armstorageimportexport/models_serde.go rename sdk/resourcemanager/storageimportexport/armstorageimportexport/{zz_generated_operations_client.go => operations_client.go} (75%) create mode 100644 sdk/resourcemanager/storageimportexport/armstorageimportexport/operations_client_example_test.go rename sdk/resourcemanager/storageimportexport/armstorageimportexport/{zz_generated_response_types.go => response_types.go} (88%) rename sdk/resourcemanager/storageimportexport/armstorageimportexport/{zz_generated_time_rfc3339.go => time_rfc3339.go} (96%) delete mode 100644 sdk/resourcemanager/storageimportexport/armstorageimportexport/ze_generated_example_bitlockerkeys_client_test.go delete mode 100644 sdk/resourcemanager/storageimportexport/armstorageimportexport/ze_generated_example_jobs_client_test.go delete mode 100644 sdk/resourcemanager/storageimportexport/armstorageimportexport/ze_generated_example_locations_client_test.go delete mode 100644 sdk/resourcemanager/storageimportexport/armstorageimportexport/ze_generated_example_operations_client_test.go delete mode 100644 sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_models_serde.go diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/CHANGELOG.md b/sdk/resourcemanager/billingbenefits/armbillingbenefits/CHANGELOG.md index 34d068a68a5d..189ef2c8a71e 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/CHANGELOG.md +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/CHANGELOG.md @@ -1,5 +1,18 @@ # Release History +## 2.0.0 (2023-04-03) +### Breaking Changes + +- Function `NewSavingsPlanClient` parameter(s) have been changed from `(*string, azcore.TokenCredential, *arm.ClientOptions)` to `(azcore.TokenCredential, *arm.ClientOptions)` +- Function `NewSavingsPlanOrderClient` parameter(s) have been changed from `(*string, azcore.TokenCredential, *arm.ClientOptions)` to `(azcore.TokenCredential, *arm.ClientOptions)` + +### Features Added + +- New struct `ClientFactory` which is a client factory used to create any client in this module +- New field `Expand` in struct `SavingsPlanClientGetOptions` +- New field `Expand` in struct `SavingsPlanOrderClientGetOptions` + + ## 1.0.0 (2022-12-23) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billingbenefits/armbillingbenefits` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/README.md b/sdk/resourcemanager/billingbenefits/armbillingbenefits/README.md index c73a18270b0a..07a0d32e2e4a 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/README.md +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/README.md @@ -33,23 +33,31 @@ 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). -## Clients +## Client Factory -Azure Billingbenefits modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. +Azure Billingbenefits module consists of one or more clients. We provide a client factory which could be used to create any client in this module. ```go -client, err := armbillingbenefits.(, cred, nil) +clientFactory, err := armbillingbenefits.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{ +options := arm.ClientOptions { ClientOptions: azcore.ClientOptions { Cloud: cloud.AzureChina, }, } -client, err := armbillingbenefits.(, cred, &options) +clientFactory, err := armbillingbenefits.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.NewRPClient() ``` ## Provide Feedback diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/autorest.md b/sdk/resourcemanager/billingbenefits/armbillingbenefits/autorest.md index d75603e0ea27..d3902fa966aa 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/autorest.md +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/bab95d5636c7d47cc5584ea8dadb21199d229ca7/specification/billingbenefits/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/bab95d5636c7d47cc5584ea8dadb21199d229ca7/specification/billingbenefits/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/billingbenefits/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/billingbenefits/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/client_factory.go b/sdk/resourcemanager/billingbenefits/armbillingbenefits/client_factory.go new file mode 100644 index 000000000000..074fc6fe7838 --- /dev/null +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/client_factory.go @@ -0,0 +1,67 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armbillingbenefits + +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 { + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + credential: credential, + options: options.Clone(), + }, nil +} + +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSavingsPlanOrderAliasClient() *SavingsPlanOrderAliasClient { + subClient, _ := NewSavingsPlanOrderAliasClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSavingsPlanOrderClient() *SavingsPlanOrderClient { + subClient, _ := NewSavingsPlanOrderClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSavingsPlanClient() *SavingsPlanClient { + subClient, _ := NewSavingsPlanClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewRPClient() *RPClient { + subClient, _ := NewRPClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReservationOrderAliasClient() *ReservationOrderAliasClient { + subClient, _ := NewReservationOrderAliasClient(c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/constants.go b/sdk/resourcemanager/billingbenefits/armbillingbenefits/constants.go index 9fd6a8add0ce..e7d23ba6ad87 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/constants.go +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/constants.go @@ -11,7 +11,7 @@ package armbillingbenefits const ( moduleName = "armbillingbenefits" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/date_type.go b/sdk/resourcemanager/billingbenefits/armbillingbenefits/date_type.go index 6900858f0fbf..d64d5c418f6d 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/date_type.go +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/date_type.go @@ -35,7 +35,7 @@ func (d *dateType) UnmarshalJSON(data []byte) (err error) { return err } -func populateDateType(m map[string]interface{}, k string, t *time.Time) { +func populateDateType(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/go.mod b/sdk/resourcemanager/billingbenefits/armbillingbenefits/go.mod index 643e1c53b191..0695e7657921 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/go.mod +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/go.mod @@ -1,21 +1,21 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billingbenefits/armbillingbenefits +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billingbenefits/armbillingbenefits/v2 go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 // indirect - github.com/golang-jwt/jwt/v4 v4.4.2 // indirect - github.com/google/uuid v1.1.1 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect + github.com/golang-jwt/jwt/v4 v4.5.0 // indirect + github.com/google/uuid v1.3.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect - golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect - golang.org/x/text v0.3.7 // indirect + github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect + golang.org/x/crypto v0.6.0 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect ) diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/go.sum b/sdk/resourcemanager/billingbenefits/armbillingbenefits/go.sum index 8c0539b73123..8ba445a8c4da 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/go.sum +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/go.sum @@ -1,30 +1,31 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 h1:t/W5MYAuQy81cvM8VUNfRLzhtKpXhVUAN7Cd7KVbTyc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0/go.mod h1:NBanQUfSWiWn3QEpWDTCU0IjBECKOYvl2R8xdRtMtiM= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 h1:VgSJlZH5u0k2qxSpqyghcFQKmvYckj46uymKK5XzkBM= -github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0/go.mod h1:BDJ5qMFKx9DugEg3+uQSDCdbYPr5s9vBTrL9P8TpqOU= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= +github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs= -github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.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-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= +golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/models.go b/sdk/resourcemanager/billingbenefits/armbillingbenefits/models.go index 1ffe9a3b9ff2..bd3ed351204b 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/models.go +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/models.go @@ -110,7 +110,7 @@ type OperationListResult struct { Value []*Operation `json:"value,omitempty" azure:"ro"` } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters } @@ -375,9 +375,11 @@ type SKU struct { // SavingsPlanClientGetOptions contains the optional parameters for the SavingsPlanClient.Get method. type SavingsPlanClientGetOptions struct { + // May be used to expand the detail information of some properties. + Expand *string } -// SavingsPlanClientListAllOptions contains the optional parameters for the SavingsPlanClient.ListAll method. +// SavingsPlanClientListAllOptions contains the optional parameters for the SavingsPlanClient.NewListAllPager method. type SavingsPlanClientListAllOptions struct { // May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does not currently support // 'ne', 'gt', 'le', 'ge', or 'not'. Reservation properties include sku/name, @@ -397,7 +399,7 @@ type SavingsPlanClientListAllOptions struct { Take *float32 } -// SavingsPlanClientListOptions contains the optional parameters for the SavingsPlanClient.List method. +// SavingsPlanClientListOptions contains the optional parameters for the SavingsPlanClient.NewListPager method. type SavingsPlanClientListOptions struct { // placeholder for future optional parameters } @@ -595,9 +597,11 @@ type SavingsPlanOrderClientElevateOptions struct { // SavingsPlanOrderClientGetOptions contains the optional parameters for the SavingsPlanOrderClient.Get method. type SavingsPlanOrderClientGetOptions struct { + // May be used to expand the detail information of some properties. + Expand *string } -// SavingsPlanOrderClientListOptions contains the optional parameters for the SavingsPlanOrderClient.List method. +// SavingsPlanOrderClientListOptions contains the optional parameters for the SavingsPlanOrderClient.NewListPager method. type SavingsPlanOrderClientListOptions struct { // placeholder for future optional parameters } diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/models_serde.go b/sdk/resourcemanager/billingbenefits/armbillingbenefits/models_serde.go index b1850856e3a5..a95e4d2ad427 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/models_serde.go +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/models_serde.go @@ -18,7 +18,7 @@ import ( // MarshalJSON implements the json.Marshaller interface for type AppliedScopeProperties. func (a AppliedScopeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "displayName", a.DisplayName) populate(objectMap, "managementGroupId", a.ManagementGroupID) populate(objectMap, "resourceGroupId", a.ResourceGroupID) @@ -61,7 +61,7 @@ func (a *AppliedScopeProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type BillingPlanInformation. func (b BillingPlanInformation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateDateType(objectMap, "nextPaymentDueDate", b.NextPaymentDueDate) populate(objectMap, "pricingCurrencyTotal", b.PricingCurrencyTotal) populateDateType(objectMap, "startDate", b.StartDate) @@ -100,7 +100,7 @@ func (b *BillingPlanInformation) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Commitment. func (c Commitment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "amount", c.Amount) populate(objectMap, "currencyCode", c.CurrencyCode) populate(objectMap, "grain", c.Grain) @@ -135,7 +135,7 @@ func (c *Commitment) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ExtendedStatusInfo. func (e ExtendedStatusInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "message", e.Message) populate(objectMap, "statusCode", e.StatusCode) return json.Marshal(objectMap) @@ -166,7 +166,7 @@ func (e *ExtendedStatusInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Operation. func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "actionType", o.ActionType) populate(objectMap, "display", o.Display) populate(objectMap, "isDataAction", o.IsDataAction) @@ -209,7 +209,7 @@ func (o *Operation) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OperationDisplay. func (o OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "description", o.Description) populate(objectMap, "operation", o.Operation) populate(objectMap, "provider", o.Provider) @@ -248,7 +248,7 @@ func (o *OperationDisplay) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OperationListResult. func (o OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", o.NextLink) populate(objectMap, "value", o.Value) return json.Marshal(objectMap) @@ -279,7 +279,7 @@ func (o *OperationListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PaymentDetail. func (p PaymentDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "billingAccount", p.BillingAccount) populate(objectMap, "billingCurrencyTotal", p.BillingCurrencyTotal) populateDateType(objectMap, "dueDate", p.DueDate) @@ -330,7 +330,7 @@ func (p *PaymentDetail) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Price. func (p Price) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "amount", p.Amount) populate(objectMap, "currencyCode", p.CurrencyCode) return json.Marshal(objectMap) @@ -361,7 +361,7 @@ func (p *Price) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PurchaseRequest. func (p PurchaseRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", p.Properties) populate(objectMap, "sku", p.SKU) return json.Marshal(objectMap) @@ -392,7 +392,7 @@ func (p *PurchaseRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PurchaseRequestProperties. func (p PurchaseRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "appliedScopeProperties", p.AppliedScopeProperties) populate(objectMap, "appliedScopeType", p.AppliedScopeType) populate(objectMap, "billingPlan", p.BillingPlan) @@ -451,7 +451,7 @@ func (p *PurchaseRequestProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RenewProperties. func (r RenewProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "purchaseProperties", r.PurchaseProperties) return json.Marshal(objectMap) } @@ -478,7 +478,7 @@ func (r *RenewProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ReservationOrderAliasRequest. func (r ReservationOrderAliasRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) @@ -529,7 +529,7 @@ func (r *ReservationOrderAliasRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ReservationOrderAliasRequestProperties. func (r ReservationOrderAliasRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "appliedScopeProperties", r.AppliedScopeProperties) populate(objectMap, "appliedScopeType", r.AppliedScopeType) populate(objectMap, "billingPlan", r.BillingPlan) @@ -596,7 +596,7 @@ func (r *ReservationOrderAliasRequestProperties) UnmarshalJSON(data []byte) erro // MarshalJSON implements the json.Marshaller interface for type ReservationOrderAliasRequestPropertiesReservedResourceProperties. func (r ReservationOrderAliasRequestPropertiesReservedResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "instanceFlexibility", r.InstanceFlexibility) return json.Marshal(objectMap) } @@ -623,7 +623,7 @@ func (r *ReservationOrderAliasRequestPropertiesReservedResourceProperties) Unmar // MarshalJSON implements the json.Marshaller interface for type ReservationOrderAliasResponse. func (r ReservationOrderAliasResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) @@ -674,7 +674,7 @@ func (r *ReservationOrderAliasResponse) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ReservationOrderAliasResponseProperties. func (r ReservationOrderAliasResponseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "appliedScopeProperties", r.AppliedScopeProperties) populate(objectMap, "appliedScopeType", r.AppliedScopeType) populate(objectMap, "billingPlan", r.BillingPlan) @@ -749,7 +749,7 @@ func (r *ReservationOrderAliasResponseProperties) UnmarshalJSON(data []byte) err // MarshalJSON implements the json.Marshaller interface for type ReservationOrderAliasResponsePropertiesReservedResourceProperties. func (r ReservationOrderAliasResponsePropertiesReservedResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "instanceFlexibility", r.InstanceFlexibility) return json.Marshal(objectMap) } @@ -776,7 +776,7 @@ func (r *ReservationOrderAliasResponsePropertiesReservedResourceProperties) Unma // MarshalJSON implements the json.Marshaller interface for type RoleAssignmentEntity. func (r RoleAssignmentEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) populate(objectMap, "properties", r.Properties) @@ -811,7 +811,7 @@ func (r *RoleAssignmentEntity) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RoleAssignmentEntityProperties. func (r RoleAssignmentEntityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "principalId", r.PrincipalID) populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) populate(objectMap, "scope", r.Scope) @@ -846,7 +846,7 @@ func (r *RoleAssignmentEntityProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SKU. func (s SKU) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", s.Name) return json.Marshal(objectMap) } @@ -873,7 +873,7 @@ func (s *SKU) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SavingsPlanModel. func (s SavingsPlanModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) @@ -920,7 +920,7 @@ func (s *SavingsPlanModel) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SavingsPlanModelList. func (s SavingsPlanModelList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) @@ -951,7 +951,7 @@ func (s *SavingsPlanModelList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SavingsPlanModelListResult. func (s SavingsPlanModelListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "additionalProperties", s.AdditionalProperties) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) @@ -986,7 +986,7 @@ func (s *SavingsPlanModelListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SavingsPlanModelProperties. func (s SavingsPlanModelProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "appliedScopeProperties", s.AppliedScopeProperties) populate(objectMap, "appliedScopeType", s.AppliedScopeType) populateTimeRFC3339(objectMap, "benefitStartTime", s.BenefitStartTime) @@ -1101,7 +1101,7 @@ func (s *SavingsPlanModelProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SavingsPlanOrderAliasModel. func (s SavingsPlanOrderAliasModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "kind", s.Kind) populate(objectMap, "name", s.Name) @@ -1152,7 +1152,7 @@ func (s *SavingsPlanOrderAliasModel) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SavingsPlanOrderAliasProperties. func (s SavingsPlanOrderAliasProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "appliedScopeProperties", s.AppliedScopeProperties) populate(objectMap, "appliedScopeType", s.AppliedScopeType) populate(objectMap, "billingPlan", s.BillingPlan) @@ -1211,7 +1211,7 @@ func (s *SavingsPlanOrderAliasProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SavingsPlanOrderModel. func (s SavingsPlanOrderModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) @@ -1258,7 +1258,7 @@ func (s *SavingsPlanOrderModel) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SavingsPlanOrderModelList. func (s SavingsPlanOrderModelList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) @@ -1289,7 +1289,7 @@ func (s *SavingsPlanOrderModelList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SavingsPlanOrderModelProperties. func (s SavingsPlanOrderModelProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "benefitStartTime", s.BenefitStartTime) populate(objectMap, "billingAccountId", s.BillingAccountID) populate(objectMap, "billingPlan", s.BillingPlan) @@ -1364,7 +1364,7 @@ func (s *SavingsPlanOrderModelProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SavingsPlanPurchaseValidateRequest. func (s SavingsPlanPurchaseValidateRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "benefits", s.Benefits) return json.Marshal(objectMap) } @@ -1391,7 +1391,7 @@ func (s *SavingsPlanPurchaseValidateRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SavingsPlanSummary. func (s SavingsPlanSummary) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", s.Name) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) @@ -1422,7 +1422,7 @@ func (s *SavingsPlanSummary) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SavingsPlanSummaryCount. func (s SavingsPlanSummaryCount) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "cancelledCount", s.CancelledCount) populate(objectMap, "expiredCount", s.ExpiredCount) populate(objectMap, "expiringCount", s.ExpiringCount) @@ -1481,7 +1481,7 @@ func (s *SavingsPlanSummaryCount) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SavingsPlanUpdateRequest. func (s SavingsPlanUpdateRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", s.Properties) return json.Marshal(objectMap) } @@ -1508,7 +1508,7 @@ func (s *SavingsPlanUpdateRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SavingsPlanUpdateRequestProperties. func (s SavingsPlanUpdateRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "appliedScopeProperties", s.AppliedScopeProperties) populate(objectMap, "appliedScopeType", s.AppliedScopeType) populate(objectMap, "displayName", s.DisplayName) @@ -1551,7 +1551,7 @@ func (s *SavingsPlanUpdateRequestProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SavingsPlanUpdateValidateRequest. func (s SavingsPlanUpdateValidateRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "benefits", s.Benefits) return json.Marshal(objectMap) } @@ -1578,7 +1578,7 @@ func (s *SavingsPlanUpdateValidateRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SavingsPlanValidResponseProperty. func (s SavingsPlanValidResponseProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "reason", s.Reason) populate(objectMap, "reasonCode", s.ReasonCode) populate(objectMap, "valid", s.Valid) @@ -1613,7 +1613,7 @@ func (s *SavingsPlanValidResponseProperty) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SavingsPlanValidateResponse. func (s SavingsPlanValidateResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "benefits", s.Benefits) populate(objectMap, "nextLink", s.NextLink) return json.Marshal(objectMap) @@ -1644,7 +1644,7 @@ func (s *SavingsPlanValidateResponse) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) @@ -1691,7 +1691,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Utilization. func (u Utilization) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "aggregates", u.Aggregates) populate(objectMap, "trend", u.Trend) return json.Marshal(objectMap) @@ -1722,7 +1722,7 @@ func (u *Utilization) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UtilizationAggregates. func (u UtilizationAggregates) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "grain", u.Grain) populate(objectMap, "grainUnit", u.GrainUnit) populate(objectMap, "value", u.Value) @@ -1759,7 +1759,7 @@ func (u *UtilizationAggregates) UnmarshalJSON(data []byte) error { return nil } -func populate(m map[string]interface{}, k string, v interface{}) { +func populate(m map[string]any, k string, v any) { if v == nil { return } else if azcore.IsNullValue(v) { @@ -1769,7 +1769,7 @@ func populate(m map[string]interface{}, k string, v interface{}) { } } -func unpopulate(data json.RawMessage, fn string, v interface{}) error { +func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil { return nil } diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/operations_client.go b/sdk/resourcemanager/billingbenefits/armbillingbenefits/operations_client.go index fafa9faa8bb1..5044696d078c 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/operations_client.go +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/operations_client.go @@ -13,8 +13,6 @@ import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -23,35 +21,27 @@ import ( // OperationsClient contains the methods for the Operations group. // Don't use this type directly, use NewOperationsClient() instead. type OperationsClient struct { - host string - pl runtime.Pipeline + 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. +// - 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) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &OperationsClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // NewListPager - List all the operations. +// // Generated from API version 2022-11-01 -// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// - 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 { @@ -68,7 +58,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption if err != nil { return OperationsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return OperationsClientListResponse{}, err } @@ -83,7 +73,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption // listCreateRequest creates the List request. func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.BillingBenefits/operations" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/operations_client_example_test.go b/sdk/resourcemanager/billingbenefits/armbillingbenefits/operations_client_example_test.go index 0d9c9ba03387..6b6bf3d6b2b4 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/operations_client_example_test.go +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/operations_client_example_test.go @@ -5,6 +5,7 @@ // 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 armbillingbenefits_test @@ -13,29 +14,105 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billingbenefits/armbillingbenefits" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billingbenefits/armbillingbenefits/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/OperationsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/OperationsGet.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armbillingbenefits.NewOperationsClient(cred, nil) + clientFactory, err := armbillingbenefits.NewClientFactory(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(nil) + pager := clientFactory.NewOperationsClient().NewListPager(nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. _ = v } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.OperationListResult = armbillingbenefits.OperationListResult{ + // Value: []*armbillingbenefits.Operation{ + // { + // Name: to.Ptr("Microsoft.BillingBenefits/savingsPlanOrderAliases/read"), + // Display: &armbillingbenefits.OperationDisplay{ + // Description: to.Ptr("Read all savings plan order aliases"), + // Operation: to.Ptr("Get Savings plan order alias"), + // Provider: to.Ptr("Microsoft Benefits"), + // Resource: to.Ptr("SavingsPlanOrderAliases"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.BillingBenefits/savingsPlanOrderAliases/write"), + // Display: &armbillingbenefits.OperationDisplay{ + // Description: to.Ptr("Create a Savings plan order alias"), + // Operation: to.Ptr("Create SavingsPlanOrderAliases"), + // Provider: to.Ptr("Microsoft Benefits"), + // Resource: to.Ptr("SavingsPlanOrderAliases"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.BillingBenefits/savingsPlanOrders/read"), + // Display: &armbillingbenefits.OperationDisplay{ + // Description: to.Ptr("Read all savings plan orders"), + // Operation: to.Ptr("Get Savings plan orders"), + // Provider: to.Ptr("Microsoft Benefits"), + // Resource: to.Ptr("SavingsPlanOrders"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.BillingBenefits/savingsPlanOrders/write"), + // Display: &armbillingbenefits.OperationDisplay{ + // Description: to.Ptr("Patch a Savings plan order"), + // Operation: to.Ptr("Patch SavingsPlanOrders"), + // Provider: to.Ptr("Microsoft Benefits"), + // Resource: to.Ptr("SavingsPlanOrders"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.BillingBenefits/savingsPlanOrders/action"), + // Display: &armbillingbenefits.OperationDisplay{ + // Description: to.Ptr("Update a Savings plan order"), + // Operation: to.Ptr("Update SavingsPlanOrders"), + // Provider: to.Ptr("Microsoft Benefits"), + // Resource: to.Ptr("SavingsPlanOrders"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.BillingBenefits/savingsPlanOrders/savingsPlans/read"), + // Display: &armbillingbenefits.OperationDisplay{ + // Description: to.Ptr("Read All SavingsPlans"), + // Operation: to.Ptr("Get SavingsPlans"), + // Provider: to.Ptr("Microsoft Benefits"), + // Resource: to.Ptr("SavingsPlans"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.BillingBenefits/savingsPlanOrders/savingsPlans/write"), + // Display: &armbillingbenefits.OperationDisplay{ + // Description: to.Ptr("Patch an existing Savings plan"), + // Operation: to.Ptr("Patch SavingsPlans"), + // Provider: to.Ptr("Microsoft Benefits"), + // Resource: to.Ptr("SavingsPlans"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.BillingBenefits/register/action"), + // Display: &armbillingbenefits.OperationDisplay{ + // Description: to.Ptr("Registers the Benefits resource provider and enables the creation of Benefits resources."), + // Operation: to.Ptr("Registers the Benefits Resource Provider."), + // Provider: to.Ptr("Microsoft Benefits"), + // Resource: to.Ptr("SavingsPlans"), + // }, + // }}, + // } } } diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/reservationorderalias_client.go b/sdk/resourcemanager/billingbenefits/armbillingbenefits/reservationorderalias_client.go index 176a96ef8f09..434f9a6ee8ad 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/reservationorderalias_client.go +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/reservationorderalias_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,62 +24,55 @@ import ( // ReservationOrderAliasClient contains the methods for the ReservationOrderAlias group. // Don't use this type directly, use NewReservationOrderAliasClient() instead. type ReservationOrderAliasClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewReservationOrderAliasClient creates a new instance of ReservationOrderAliasClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewReservationOrderAliasClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ReservationOrderAliasClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".ReservationOrderAliasClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReservationOrderAliasClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // BeginCreate - Create a reservation order alias. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-11-01 -// reservationOrderAliasName - Name of the reservation order alias -// body - Request body for creating a reservation order alias -// options - ReservationOrderAliasClientBeginCreateOptions contains the optional parameters for the ReservationOrderAliasClient.BeginCreate -// method. +// - reservationOrderAliasName - Name of the reservation order alias +// - body - Request body for creating a reservation order alias +// - options - ReservationOrderAliasClientBeginCreateOptions contains the optional parameters for the ReservationOrderAliasClient.BeginCreate +// method. func (client *ReservationOrderAliasClient) BeginCreate(ctx context.Context, reservationOrderAliasName string, body ReservationOrderAliasRequest, options *ReservationOrderAliasClientBeginCreateOptions) (*runtime.Poller[ReservationOrderAliasClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.create(ctx, reservationOrderAliasName, body, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ReservationOrderAliasClientCreateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReservationOrderAliasClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[ReservationOrderAliasClientCreateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReservationOrderAliasClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Create - Create a reservation order alias. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-11-01 func (client *ReservationOrderAliasClient) create(ctx context.Context, reservationOrderAliasName string, body ReservationOrderAliasRequest, options *ReservationOrderAliasClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, reservationOrderAliasName, body, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -98,7 +89,7 @@ func (client *ReservationOrderAliasClient) createCreateRequest(ctx context.Conte return nil, errors.New("parameter reservationOrderAliasName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{reservationOrderAliasName}", url.PathEscape(reservationOrderAliasName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -111,16 +102,17 @@ func (client *ReservationOrderAliasClient) createCreateRequest(ctx context.Conte // Get - Get a reservation order alias. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-11-01 -// reservationOrderAliasName - Name of the reservation order alias -// options - ReservationOrderAliasClientGetOptions contains the optional parameters for the ReservationOrderAliasClient.Get -// method. +// - reservationOrderAliasName - Name of the reservation order alias +// - options - ReservationOrderAliasClientGetOptions contains the optional parameters for the ReservationOrderAliasClient.Get +// method. func (client *ReservationOrderAliasClient) Get(ctx context.Context, reservationOrderAliasName string, options *ReservationOrderAliasClientGetOptions) (ReservationOrderAliasClientGetResponse, error) { req, err := client.getCreateRequest(ctx, reservationOrderAliasName, options) if err != nil { return ReservationOrderAliasClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReservationOrderAliasClientGetResponse{}, err } @@ -137,7 +129,7 @@ func (client *ReservationOrderAliasClient) getCreateRequest(ctx context.Context, return nil, errors.New("parameter reservationOrderAliasName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{reservationOrderAliasName}", url.PathEscape(reservationOrderAliasName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/reservationorderalias_client_example_test.go b/sdk/resourcemanager/billingbenefits/armbillingbenefits/reservationorderalias_client_example_test.go index 70ce2d8af2a9..405f798c6840 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/reservationorderalias_client_example_test.go +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/reservationorderalias_client_example_test.go @@ -5,6 +5,7 @@ // 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 armbillingbenefits_test @@ -14,21 +15,21 @@ import ( "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/billingbenefits/armbillingbenefits" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billingbenefits/armbillingbenefits/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/ReservationOrderAliasCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/ReservationOrderAliasCreate.json func ExampleReservationOrderAliasClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armbillingbenefits.NewReservationOrderAliasClient(cred, nil) + clientFactory, err := armbillingbenefits.NewClientFactory(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreate(ctx, "reservationOrderAlias123", armbillingbenefits.ReservationOrderAliasRequest{ + poller, err := clientFactory.NewReservationOrderAliasClient().BeginCreate(ctx, "reservationOrderAlias123", armbillingbenefits.ReservationOrderAliasRequest{ Location: to.Ptr("eastus"), Properties: &armbillingbenefits.ReservationOrderAliasRequestProperties{ AppliedScopeProperties: &armbillingbenefits.AppliedScopeProperties{ @@ -57,25 +58,80 @@ func ExampleReservationOrderAliasClient_BeginCreate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReservationOrderAliasResponse = armbillingbenefits.ReservationOrderAliasResponse{ + // Name: to.Ptr("reservationOrderAlias123"), + // Type: to.Ptr("Microsoft.BillingBenefits/reservationOrderAliases"), + // ID: to.Ptr("/providers/microsoft.billingbenefits/reservationOrderAliases/reservationOrderAlias123"), + // Properties: &armbillingbenefits.ReservationOrderAliasResponseProperties{ + // AppliedScopeProperties: &armbillingbenefits.AppliedScopeProperties{ + // ResourceGroupID: to.Ptr("/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/testrg"), + // }, + // AppliedScopeType: to.Ptr(armbillingbenefits.AppliedScopeTypeSingle), + // BillingPlan: to.Ptr(armbillingbenefits.BillingPlanP1M), + // BillingScopeID: to.Ptr("/subscriptions/10000000-0000-0000-0000-000000000000"), + // DisplayName: to.Ptr("ReservationOrder_2022-06-02"), + // ProvisioningState: to.Ptr(armbillingbenefits.ProvisioningStateSucceeded), + // Quantity: to.Ptr[int32](5), + // Renew: to.Ptr(true), + // ReservationOrderID: to.Ptr("/providers/Microsoft.Capacity/reservationOrders/30000000-0000-0000-0000-000000000000"), + // ReservedResourceProperties: &armbillingbenefits.ReservationOrderAliasResponsePropertiesReservedResourceProperties{ + // InstanceFlexibility: to.Ptr(armbillingbenefits.InstanceFlexibilityOn), + // }, + // ReservedResourceType: to.Ptr(armbillingbenefits.ReservedResourceTypeVirtualMachines), + // Term: to.Ptr(armbillingbenefits.TermP1Y), + // }, + // SKU: &armbillingbenefits.SKU{ + // Name: to.Ptr("Standard_M64s_v2"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/ReservationOrderAliasGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/ReservationOrderAliasGet.json func ExampleReservationOrderAliasClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armbillingbenefits.NewReservationOrderAliasClient(cred, nil) + clientFactory, err := armbillingbenefits.NewClientFactory(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "reservationOrderAlias123", nil) + res, err := clientFactory.NewReservationOrderAliasClient().Get(ctx, "reservationOrderAlias123", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReservationOrderAliasResponse = armbillingbenefits.ReservationOrderAliasResponse{ + // Name: to.Ptr("reservationOrderAlias123"), + // Type: to.Ptr("Microsoft.BillingBenefits/reservationOrderAliases"), + // ID: to.Ptr("/providers/microsoft.billingbenefits/reservationOrderAliases/reservationOrderAlias123"), + // Location: to.Ptr("eastus"), + // Properties: &armbillingbenefits.ReservationOrderAliasResponseProperties{ + // AppliedScopeProperties: &armbillingbenefits.AppliedScopeProperties{ + // ResourceGroupID: to.Ptr("/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/testrg"), + // }, + // AppliedScopeType: to.Ptr(armbillingbenefits.AppliedScopeTypeSingle), + // BillingPlan: to.Ptr(armbillingbenefits.BillingPlanP1M), + // BillingScopeID: to.Ptr("/subscriptions/10000000-0000-0000-0000-000000000000"), + // DisplayName: to.Ptr("ReservationOrder_2022-06-02"), + // ProvisioningState: to.Ptr(armbillingbenefits.ProvisioningStateSucceeded), + // Quantity: to.Ptr[int32](5), + // Renew: to.Ptr(true), + // ReservationOrderID: to.Ptr("/providers/Microsoft.Capacity/reservationOrders/30000000-0000-0000-0000-000000000000"), + // ReservedResourceProperties: &armbillingbenefits.ReservationOrderAliasResponsePropertiesReservedResourceProperties{ + // InstanceFlexibility: to.Ptr(armbillingbenefits.InstanceFlexibilityOn), + // }, + // ReservedResourceType: to.Ptr(armbillingbenefits.ReservedResourceTypeVirtualMachines), + // Term: to.Ptr(armbillingbenefits.TermP1Y), + // }, + // SKU: &armbillingbenefits.SKU{ + // Name: to.Ptr("Standard_M64s_v2"), + // }, + // } } diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/response_types.go b/sdk/resourcemanager/billingbenefits/armbillingbenefits/response_types.go index e31c453557d1..c2e4444e4267 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/response_types.go +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/response_types.go @@ -9,7 +9,7 @@ package armbillingbenefits -// OperationsClientListResponse contains the response from method OperationsClient.List. +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { OperationListResult } @@ -19,7 +19,7 @@ type RPClientValidatePurchaseResponse struct { SavingsPlanValidateResponse } -// ReservationOrderAliasClientCreateResponse contains the response from method ReservationOrderAliasClient.Create. +// ReservationOrderAliasClientCreateResponse contains the response from method ReservationOrderAliasClient.BeginCreate. type ReservationOrderAliasClientCreateResponse struct { ReservationOrderAliasResponse } @@ -34,12 +34,12 @@ type SavingsPlanClientGetResponse struct { SavingsPlanModel } -// SavingsPlanClientListAllResponse contains the response from method SavingsPlanClient.ListAll. +// SavingsPlanClientListAllResponse contains the response from method SavingsPlanClient.NewListAllPager. type SavingsPlanClientListAllResponse struct { SavingsPlanModelListResult } -// SavingsPlanClientListResponse contains the response from method SavingsPlanClient.List. +// SavingsPlanClientListResponse contains the response from method SavingsPlanClient.NewListPager. type SavingsPlanClientListResponse struct { SavingsPlanModelList } @@ -56,7 +56,7 @@ type SavingsPlanClientValidateUpdateResponse struct { SavingsPlanValidateResponse } -// SavingsPlanOrderAliasClientCreateResponse contains the response from method SavingsPlanOrderAliasClient.Create. +// SavingsPlanOrderAliasClientCreateResponse contains the response from method SavingsPlanOrderAliasClient.BeginCreate. type SavingsPlanOrderAliasClientCreateResponse struct { SavingsPlanOrderAliasModel } @@ -76,7 +76,7 @@ type SavingsPlanOrderClientGetResponse struct { SavingsPlanOrderModel } -// SavingsPlanOrderClientListResponse contains the response from method SavingsPlanOrderClient.List. +// SavingsPlanOrderClientListResponse contains the response from method SavingsPlanOrderClient.NewListPager. type SavingsPlanOrderClientListResponse struct { SavingsPlanOrderModelList } diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/rp_client.go b/sdk/resourcemanager/billingbenefits/armbillingbenefits/rp_client.go index 5eb6fa368b8a..a3c74fd2d141 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/rp_client.go +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/rp_client.go @@ -13,8 +13,6 @@ import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -23,43 +21,35 @@ import ( // RPClient contains the methods for the BillingBenefitsRP group. // Don't use this type directly, use NewRPClient() instead. type RPClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewRPClient creates a new instance of RPClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewRPClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RPClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".RPClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &RPClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // ValidatePurchase - Validate savings plan purchase. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-11-01 -// body - Request body for validating the purchase of a savings plan -// options - RPClientValidatePurchaseOptions contains the optional parameters for the RPClient.ValidatePurchase method. +// - body - Request body for validating the purchase of a savings plan +// - options - RPClientValidatePurchaseOptions contains the optional parameters for the RPClient.ValidatePurchase method. func (client *RPClient) ValidatePurchase(ctx context.Context, body SavingsPlanPurchaseValidateRequest, options *RPClientValidatePurchaseOptions) (RPClientValidatePurchaseResponse, error) { req, err := client.validatePurchaseCreateRequest(ctx, body, options) if err != nil { return RPClientValidatePurchaseResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return RPClientValidatePurchaseResponse{}, err } @@ -72,7 +62,7 @@ func (client *RPClient) ValidatePurchase(ctx context.Context, body SavingsPlanPu // validatePurchaseCreateRequest creates the ValidatePurchase request. func (client *RPClient) validatePurchaseCreateRequest(ctx context.Context, body SavingsPlanPurchaseValidateRequest, options *RPClientValidatePurchaseOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.BillingBenefits/validate" - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/rp_client_example_test.go b/sdk/resourcemanager/billingbenefits/armbillingbenefits/rp_client_example_test.go index 3211d6b386f5..07d095d08117 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/rp_client_example_test.go +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/rp_client_example_test.go @@ -5,6 +5,7 @@ // 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 armbillingbenefits_test @@ -14,21 +15,21 @@ import ( "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/billingbenefits/armbillingbenefits" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billingbenefits/armbillingbenefits/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanValidatePurchase.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanValidatePurchase.json func ExampleRPClient_ValidatePurchase() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armbillingbenefits.NewRPClient(cred, nil) + clientFactory, err := armbillingbenefits.NewClientFactory(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.ValidatePurchase(ctx, armbillingbenefits.SavingsPlanPurchaseValidateRequest{ + res, err := clientFactory.NewRPClient().ValidatePurchase(ctx, armbillingbenefits.SavingsPlanPurchaseValidateRequest{ Benefits: []*armbillingbenefits.SavingsPlanOrderAliasModel{ { Properties: &armbillingbenefits.SavingsPlanOrderAliasProperties{ @@ -72,6 +73,18 @@ func ExampleRPClient_ValidatePurchase() { if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SavingsPlanValidateResponse = armbillingbenefits.SavingsPlanValidateResponse{ + // Benefits: []*armbillingbenefits.SavingsPlanValidResponseProperty{ + // { + // Reason: to.Ptr("Your provider has not enabled Savings Plan purchase on this subscription."), + // ReasonCode: to.Ptr("CustomerCannotPurchaseSavingsPlan"), + // Valid: to.Ptr(false), + // }, + // { + // Valid: to.Ptr(true), + // }}, + // } } diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplan_client.go b/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplan_client.go index e405b4827a4a..f81520a2efba 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplan_client.go +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplan_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -27,47 +25,36 @@ import ( // SavingsPlanClient contains the methods for the SavingsPlan group. // Don't use this type directly, use NewSavingsPlanClient() instead. type SavingsPlanClient struct { - host string - expand *string - pl runtime.Pipeline + internal *arm.Client } // NewSavingsPlanClient creates a new instance of SavingsPlanClient with the specified values. -// expand - May be used to expand the detail information of some properties. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewSavingsPlanClient(expand *string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SavingsPlanClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSavingsPlanClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SavingsPlanClient, error) { + cl, err := arm.NewClient(moduleName+".SavingsPlanClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &SavingsPlanClient{ - expand: expand, - host: ep, - pl: pl, + internal: cl, } return client, nil } // Get - Get savings plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-11-01 -// savingsPlanOrderID - Order ID of the savings plan -// savingsPlanID - ID of the savings plan -// options - SavingsPlanClientGetOptions contains the optional parameters for the SavingsPlanClient.Get method. +// - savingsPlanOrderID - Order ID of the savings plan +// - savingsPlanID - ID of the savings plan +// - options - SavingsPlanClientGetOptions contains the optional parameters for the SavingsPlanClient.Get method. func (client *SavingsPlanClient) Get(ctx context.Context, savingsPlanOrderID string, savingsPlanID string, options *SavingsPlanClientGetOptions) (SavingsPlanClientGetResponse, error) { req, err := client.getCreateRequest(ctx, savingsPlanOrderID, savingsPlanID, options) if err != nil { return SavingsPlanClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SavingsPlanClientGetResponse{}, err } @@ -88,14 +75,14 @@ func (client *SavingsPlanClient) getCreateRequest(ctx context.Context, savingsPl return nil, errors.New("parameter savingsPlanID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{savingsPlanId}", url.PathEscape(savingsPlanID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2022-11-01") - if client.expand != nil { - reqQP.Set("$expand", *client.expand) + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} @@ -112,9 +99,10 @@ func (client *SavingsPlanClient) getHandleResponse(resp *http.Response) (Savings } // NewListPager - List savings plans in an order. +// // Generated from API version 2022-11-01 -// savingsPlanOrderID - Order ID of the savings plan -// options - SavingsPlanClientListOptions contains the optional parameters for the SavingsPlanClient.List method. +// - savingsPlanOrderID - Order ID of the savings plan +// - options - SavingsPlanClientListOptions contains the optional parameters for the SavingsPlanClient.NewListPager method. func (client *SavingsPlanClient) NewListPager(savingsPlanOrderID string, options *SavingsPlanClientListOptions) *runtime.Pager[SavingsPlanClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SavingsPlanClientListResponse]{ More: func(page SavingsPlanClientListResponse) bool { @@ -131,7 +119,7 @@ func (client *SavingsPlanClient) NewListPager(savingsPlanOrderID string, options if err != nil { return SavingsPlanClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SavingsPlanClientListResponse{}, err } @@ -150,7 +138,7 @@ func (client *SavingsPlanClient) listCreateRequest(ctx context.Context, savingsP return nil, errors.New("parameter savingsPlanOrderID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{savingsPlanOrderId}", url.PathEscape(savingsPlanOrderID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -171,8 +159,9 @@ func (client *SavingsPlanClient) listHandleResponse(resp *http.Response) (Saving } // NewListAllPager - List savings plans. +// // Generated from API version 2022-11-01 -// options - SavingsPlanClientListAllOptions contains the optional parameters for the SavingsPlanClient.ListAll method. +// - options - SavingsPlanClientListAllOptions contains the optional parameters for the SavingsPlanClient.NewListAllPager method. func (client *SavingsPlanClient) NewListAllPager(options *SavingsPlanClientListAllOptions) *runtime.Pager[SavingsPlanClientListAllResponse] { return runtime.NewPager(runtime.PagingHandler[SavingsPlanClientListAllResponse]{ More: func(page SavingsPlanClientListAllResponse) bool { @@ -189,7 +178,7 @@ func (client *SavingsPlanClient) NewListAllPager(options *SavingsPlanClientListA if err != nil { return SavingsPlanClientListAllResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SavingsPlanClientListAllResponse{}, err } @@ -204,7 +193,7 @@ func (client *SavingsPlanClient) NewListAllPager(options *SavingsPlanClientListA // listAllCreateRequest creates the ListAll request. func (client *SavingsPlanClient) listAllCreateRequest(ctx context.Context, options *SavingsPlanClientListAllOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.BillingBenefits/savingsPlans" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -244,17 +233,18 @@ func (client *SavingsPlanClient) listAllHandleResponse(resp *http.Response) (Sav // Update - Update savings plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-11-01 -// savingsPlanOrderID - Order ID of the savings plan -// savingsPlanID - ID of the savings plan -// body - Request body for patching a savings plan order alias -// options - SavingsPlanClientUpdateOptions contains the optional parameters for the SavingsPlanClient.Update method. +// - savingsPlanOrderID - Order ID of the savings plan +// - savingsPlanID - ID of the savings plan +// - body - Request body for patching a savings plan order alias +// - options - SavingsPlanClientUpdateOptions contains the optional parameters for the SavingsPlanClient.Update method. func (client *SavingsPlanClient) Update(ctx context.Context, savingsPlanOrderID string, savingsPlanID string, body SavingsPlanUpdateRequest, options *SavingsPlanClientUpdateOptions) (SavingsPlanClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, savingsPlanOrderID, savingsPlanID, body, options) if err != nil { return SavingsPlanClientUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SavingsPlanClientUpdateResponse{}, err } @@ -275,7 +265,7 @@ func (client *SavingsPlanClient) updateCreateRequest(ctx context.Context, saving return nil, errors.New("parameter savingsPlanID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{savingsPlanId}", url.PathEscape(savingsPlanID)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -300,18 +290,19 @@ func (client *SavingsPlanClient) updateHandleResponse(resp *http.Response) (Savi // ValidateUpdate - Validate savings plan patch. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-11-01 -// savingsPlanOrderID - Order ID of the savings plan -// savingsPlanID - ID of the savings plan -// body - Request body for validating a savings plan patch request -// options - SavingsPlanClientValidateUpdateOptions contains the optional parameters for the SavingsPlanClient.ValidateUpdate -// method. +// - savingsPlanOrderID - Order ID of the savings plan +// - savingsPlanID - ID of the savings plan +// - body - Request body for validating a savings plan patch request +// - options - SavingsPlanClientValidateUpdateOptions contains the optional parameters for the SavingsPlanClient.ValidateUpdate +// method. func (client *SavingsPlanClient) ValidateUpdate(ctx context.Context, savingsPlanOrderID string, savingsPlanID string, body SavingsPlanUpdateValidateRequest, options *SavingsPlanClientValidateUpdateOptions) (SavingsPlanClientValidateUpdateResponse, error) { req, err := client.validateUpdateCreateRequest(ctx, savingsPlanOrderID, savingsPlanID, body, options) if err != nil { return SavingsPlanClientValidateUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SavingsPlanClientValidateUpdateResponse{}, err } @@ -332,7 +323,7 @@ func (client *SavingsPlanClient) validateUpdateCreateRequest(ctx context.Context return nil, errors.New("parameter savingsPlanID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{savingsPlanId}", url.PathEscape(savingsPlanID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplan_client_example_test.go b/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplan_client_example_test.go index f3d28ef81af3..b263cc85bf82 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplan_client_example_test.go +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplan_client_example_test.go @@ -5,6 +5,7 @@ // 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 armbillingbenefits_test @@ -14,45 +15,102 @@ import ( "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/billingbenefits/armbillingbenefits" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billingbenefits/armbillingbenefits/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlansInOrderList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlansInOrderList.json func ExampleSavingsPlanClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armbillingbenefits.NewSavingsPlanClient(nil, cred, nil) + clientFactory, err := armbillingbenefits.NewClientFactory(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("20000000-0000-0000-0000-000000000000", nil) + pager := clientFactory.NewSavingsPlanClient().NewListPager("20000000-0000-0000-0000-000000000000", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.SavingsPlanModelList = armbillingbenefits.SavingsPlanModelList{ + // Value: []*armbillingbenefits.SavingsPlanModel{ + // { + // Name: to.Ptr("20000000-0000-0000-0000-000000000000/30000000-0000-0000-0000-000000000000"), + // Type: to.Ptr("Microsoft.BillingBenefits/savingsPlanOrders/savingsPlans"), + // ID: to.Ptr("/providers/microsoft.billingbenefits/savingsPlanOrders/20000000-0000-0000-0000-000000000000/savingsPlans/30000000-0000-0000-0000-000000000000"), + // Properties: &armbillingbenefits.SavingsPlanModelProperties{ + // AppliedScopeProperties: &armbillingbenefits.AppliedScopeProperties{ + // ResourceGroupID: to.Ptr("/subscriptions/eef82110-c91b-4395-9420-fcfcbefc5a47/resourcegroups/3ppRG"), + // }, + // AppliedScopeType: to.Ptr(armbillingbenefits.AppliedScopeTypeSingle), + // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/20000000-1000-0000-0000-000000000000:20000000-0000-3000-0000-000000000000_2019-05-31"), + // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/20000000-1000-0000-0000-000000000000:20000000-0000-3000-0000-000000000000_2019-05-31/billingProfiles/KPSV-DWNE-BG7-TGB"), + // BillingScopeID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/20000000-1000-0000-0000-000000000009"), + // Commitment: &armbillingbenefits.Commitment{ + // Amount: to.Ptr[float64](0.002), + // CurrencyCode: to.Ptr("USD"), + // Grain: to.Ptr(armbillingbenefits.CommitmentGrainHourly), + // }, + // DisplayName: to.Ptr("Compute_SavingsPlan_10-24-2022_15-44"), + // DisplayProvisioningState: to.Ptr("Succeeded"), + // EffectiveDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-24T22:47:04.8539493Z"); return t}()), + // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-24T22:47:04.6196635Z"); return t}()), + // ProvisioningState: to.Ptr(armbillingbenefits.ProvisioningStateSucceeded), + // PurchaseDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-24T22:45:13.6202486Z"); return t}()), + // Renew: to.Ptr(false), + // Term: to.Ptr(armbillingbenefits.TermP1Y), + // UserFriendlyAppliedScopeType: to.Ptr("ResourceGroup"), + // Utilization: &armbillingbenefits.Utilization{ + // Aggregates: []*armbillingbenefits.UtilizationAggregates{ + // { + // Grain: to.Ptr[float32](1), + // GrainUnit: to.Ptr("days"), + // Value: to.Ptr[float32](0), + // ValueUnit: to.Ptr("percentage"), + // }, + // { + // Grain: to.Ptr[float32](7), + // GrainUnit: to.Ptr("days"), + // Value: to.Ptr[float32](0), + // ValueUnit: to.Ptr("percentage"), + // }, + // { + // Grain: to.Ptr[float32](30), + // GrainUnit: to.Ptr("days"), + // Value: to.Ptr[float32](0), + // ValueUnit: to.Ptr("percentage"), + // }}, + // Trend: to.Ptr(""), + // }, + // }, + // SKU: &armbillingbenefits.SKU{ + // Name: to.Ptr("Compute_Savings_Plan"), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlansList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlansList.json func ExampleSavingsPlanClient_NewListAllPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armbillingbenefits.NewSavingsPlanClient(nil, cred, nil) + clientFactory, err := armbillingbenefits.NewClientFactory(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListAllPager(&armbillingbenefits.SavingsPlanClientListAllOptions{Filter: to.Ptr("(properties%2farchived+eq+false)"), + pager := clientFactory.NewSavingsPlanClient().NewListAllPager(&armbillingbenefits.SavingsPlanClientListAllOptions{Filter: to.Ptr("(properties%2farchived+eq+false)"), Orderby: to.Ptr("properties/displayName asc"), RefreshSummary: nil, Skiptoken: to.Ptr[float32](50), @@ -60,67 +118,263 @@ func ExampleSavingsPlanClient_NewListAllPager() { Take: to.Ptr[float32](1), }) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.SavingsPlanModelListResult = armbillingbenefits.SavingsPlanModelListResult{ + // AdditionalProperties: []*armbillingbenefits.SavingsPlanSummary{ + // { + // Name: to.Ptr("summary"), + // Value: &armbillingbenefits.SavingsPlanSummaryCount{ + // CancelledCount: to.Ptr[float32](0), + // ExpiredCount: to.Ptr[float32](0), + // ExpiringCount: to.Ptr[float32](0), + // FailedCount: to.Ptr[float32](0), + // NoBenefitCount: to.Ptr[float32](0), + // PendingCount: to.Ptr[float32](0), + // ProcessingCount: to.Ptr[float32](0), + // SucceededCount: to.Ptr[float32](1), + // WarningCount: to.Ptr[float32](0), + // }, + // }}, + // Value: []*armbillingbenefits.SavingsPlanModel{ + // { + // Name: to.Ptr("20000000-0000-0000-0000-000000000000/30000000-0000-0000-0000-000000000000"), + // Type: to.Ptr("Microsoft.BillingBenefits/savingsPlanOrders/savingsPlans"), + // ID: to.Ptr("/providers/microsoft.billingbenefits/savingsPlanOrders/20000000-0000-0000-0000-000000000000/savingsPlans/30000000-0000-0000-0000-000000000000"), + // Properties: &armbillingbenefits.SavingsPlanModelProperties{ + // AppliedScopeProperties: &armbillingbenefits.AppliedScopeProperties{ + // DisplayName: to.Ptr("Azure subscription 1"), + // SubscriptionID: to.Ptr("/subscriptions/20000000-0000-0000-0000-000000000005"), + // }, + // AppliedScopeType: to.Ptr(armbillingbenefits.AppliedScopeTypeSingle), + // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/20000000-1000-0000-0000-000000000000:20000000-0000-3000-0000-000000000000_2019-05-31"), + // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/20000000-1000-0000-0000-000000000000:20000000-0000-3000-0000-000000000000_2019-05-31/billingProfiles/KPSV-DWNE-BG7-TGB"), + // BillingScopeID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/20000000-1000-0000-0000-000000000009"), + // Commitment: &armbillingbenefits.Commitment{ + // Amount: to.Ptr[float64](0.001), + // CurrencyCode: to.Ptr("USD"), + // Grain: to.Ptr(armbillingbenefits.CommitmentGrainHourly), + // }, + // DisplayName: to.Ptr("Compute_SavingsPlan_10-19-2022_11-03"), + // DisplayProvisioningState: to.Ptr("Succeeded"), + // EffectiveDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-19T18:05:37.1034288Z"); return t}()), + // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T18:05:36.5252231Z"); return t}()), + // ProvisioningState: to.Ptr(armbillingbenefits.ProvisioningStateSucceeded), + // PurchaseDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-19T18:03:56.4032132Z"); return t}()), + // Renew: to.Ptr(false), + // Term: to.Ptr(armbillingbenefits.TermP1Y), + // UserFriendlyAppliedScopeType: to.Ptr("Single"), + // Utilization: &armbillingbenefits.Utilization{ + // Aggregates: []*armbillingbenefits.UtilizationAggregates{ + // { + // Grain: to.Ptr[float32](1), + // GrainUnit: to.Ptr("days"), + // Value: to.Ptr[float32](100), + // ValueUnit: to.Ptr("percentage"), + // }, + // { + // Grain: to.Ptr[float32](7), + // GrainUnit: to.Ptr("days"), + // Value: to.Ptr[float32](78), + // ValueUnit: to.Ptr("percentage"), + // }, + // { + // Grain: to.Ptr[float32](30), + // GrainUnit: to.Ptr("days"), + // Value: to.Ptr[float32](78.12), + // ValueUnit: to.Ptr("percentage"), + // }}, + // Trend: to.Ptr(""), + // }, + // }, + // SKU: &armbillingbenefits.SKU{ + // Name: to.Ptr("Compute_Savings_Plan"), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanItemGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanItemGet.json func ExampleSavingsPlanClient_Get_savingsPlanItemGet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armbillingbenefits.NewSavingsPlanClient(nil, cred, nil) + clientFactory, err := armbillingbenefits.NewClientFactory(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", nil) + res, err := clientFactory.NewSavingsPlanClient().Get(ctx, "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", &armbillingbenefits.SavingsPlanClientGetOptions{Expand: nil}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SavingsPlanModel = armbillingbenefits.SavingsPlanModel{ + // Name: to.Ptr("20000000-0000-0000-0000-000000000000/30000000-0000-0000-0000-000000000000"), + // Type: to.Ptr("Microsoft.BillingBenefits/savingsPlanOrders/savingsPlans"), + // ID: to.Ptr("/providers/microsoft.billingbenefits/savingsPlanOrders/20000000-0000-0000-0000-000000000000/savingsPlans/30000000-0000-0000-0000-000000000000"), + // Properties: &armbillingbenefits.SavingsPlanModelProperties{ + // AppliedScopeType: to.Ptr(armbillingbenefits.AppliedScopeTypeShared), + // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/20000000-1000-0000-0000-000000000000:20000000-0000-3000-0000-000000000000_2019-05-31"), + // BillingPlan: to.Ptr(armbillingbenefits.BillingPlanP1M), + // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/20000000-1000-0000-0000-000000000000:20000000-0000-3000-0000-000000000000_2019-05-31/billingProfiles/KPSV-DWNE-BG7-TGB"), + // BillingScopeID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/20000000-1000-0000-0000-000000000009"), + // Commitment: &armbillingbenefits.Commitment{ + // Amount: to.Ptr[float64](0.001), + // CurrencyCode: to.Ptr("USD"), + // Grain: to.Ptr(armbillingbenefits.CommitmentGrainHourly), + // }, + // DisplayName: to.Ptr("Compute_SavingsPlan_patch_rename2"), + // DisplayProvisioningState: to.Ptr("Succeeded"), + // EffectiveDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-21T18:15:42.4098626Z"); return t}()), + // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-10-18T21:16:13.1854959Z"); return t}()), + // ProvisioningState: to.Ptr(armbillingbenefits.ProvisioningStateSucceeded), + // PurchaseDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-18T21:14:26.8279361Z"); return t}()), + // Renew: to.Ptr(true), + // Term: to.Ptr(armbillingbenefits.TermP3Y), + // UserFriendlyAppliedScopeType: to.Ptr("Shared"), + // Utilization: &armbillingbenefits.Utilization{ + // Aggregates: []*armbillingbenefits.UtilizationAggregates{ + // { + // Grain: to.Ptr[float32](1), + // GrainUnit: to.Ptr("days"), + // Value: to.Ptr[float32](100), + // ValueUnit: to.Ptr("percentage"), + // }, + // { + // Grain: to.Ptr[float32](7), + // GrainUnit: to.Ptr("days"), + // Value: to.Ptr[float32](84), + // ValueUnit: to.Ptr("percentage"), + // }, + // { + // Grain: to.Ptr[float32](30), + // GrainUnit: to.Ptr("days"), + // Value: to.Ptr[float32](83.87), + // ValueUnit: to.Ptr("percentage"), + // }}, + // Trend: to.Ptr(""), + // }, + // }, + // SKU: &armbillingbenefits.SKU{ + // Name: to.Ptr("Compute_Savings_Plan"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanItemExpandedGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanItemExpandedGet.json func ExampleSavingsPlanClient_Get_savingsPlanItemWithExpandedRenewPropertiesGet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armbillingbenefits.NewSavingsPlanClient(to.Ptr("renewProperties"), cred, nil) + clientFactory, err := armbillingbenefits.NewClientFactory(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", nil) + res, err := clientFactory.NewSavingsPlanClient().Get(ctx, "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", &armbillingbenefits.SavingsPlanClientGetOptions{Expand: to.Ptr("renewProperties")}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SavingsPlanModel = armbillingbenefits.SavingsPlanModel{ + // Name: to.Ptr("20000000-0000-0000-0000-000000000000/30000000-0000-0000-0000-000000000000"), + // Type: to.Ptr("Microsoft.BillingBenefits/savingsPlanOrders/savingsPlans"), + // ID: to.Ptr("/providers/microsoft.billingbenefits/savingsPlanOrders/20000000-0000-0000-0000-000000000000/savingsPlans/30000000-0000-0000-0000-000000000000"), + // Properties: &armbillingbenefits.SavingsPlanModelProperties{ + // AppliedScopeType: to.Ptr(armbillingbenefits.AppliedScopeTypeShared), + // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/20000000-1000-0000-0000-000000000000:20000000-0000-3000-0000-000000000000_2019-05-31"), + // BillingPlan: to.Ptr(armbillingbenefits.BillingPlanP1M), + // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/20000000-1000-0000-0000-000000000000:20000000-0000-3000-0000-000000000000_2019-05-31/billingProfiles/KPSV-DWNE-BG7-TGB"), + // BillingScopeID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/20000000-1000-0000-0000-000000000009"), + // Commitment: &armbillingbenefits.Commitment{ + // Amount: to.Ptr[float64](0.001), + // CurrencyCode: to.Ptr("USD"), + // Grain: to.Ptr(armbillingbenefits.CommitmentGrainHourly), + // }, + // DisplayName: to.Ptr("Compute_SavingsPlan_patch_rename2"), + // DisplayProvisioningState: to.Ptr("Succeeded"), + // EffectiveDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-21T18:15:42.4098626Z"); return t}()), + // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-10-18T21:16:13.1854959Z"); return t}()), + // ProvisioningState: to.Ptr(armbillingbenefits.ProvisioningStateSucceeded), + // PurchaseDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-18T21:14:26.8279361Z"); return t}()), + // Renew: to.Ptr(true), + // RenewProperties: &armbillingbenefits.RenewProperties{ + // PurchaseProperties: &armbillingbenefits.PurchaseRequest{ + // Properties: &armbillingbenefits.PurchaseRequestProperties{ + // AppliedScopeType: to.Ptr(armbillingbenefits.AppliedScopeTypeShared), + // BillingPlan: to.Ptr(armbillingbenefits.BillingPlan("Upfront")), + // BillingScopeID: to.Ptr("/subscriptions/eef82110-c91b-4395-9420-fcfcbefc5a47"), + // Commitment: &armbillingbenefits.Commitment{ + // Amount: to.Ptr[float64](0.001), + // CurrencyCode: to.Ptr("USD"), + // Grain: to.Ptr(armbillingbenefits.CommitmentGrainHourly), + // }, + // DisplayName: to.Ptr("Compute_SavingsPlan_patch_rename2_renewed"), + // Term: to.Ptr(armbillingbenefits.TermP1Y), + // }, + // SKU: &armbillingbenefits.SKU{ + // Name: to.Ptr("Compute_Savings_Plan"), + // }, + // }, + // }, + // Term: to.Ptr(armbillingbenefits.TermP3Y), + // UserFriendlyAppliedScopeType: to.Ptr("Shared"), + // Utilization: &armbillingbenefits.Utilization{ + // Aggregates: []*armbillingbenefits.UtilizationAggregates{ + // { + // Grain: to.Ptr[float32](1), + // GrainUnit: to.Ptr("days"), + // Value: to.Ptr[float32](100), + // ValueUnit: to.Ptr("percentage"), + // }, + // { + // Grain: to.Ptr[float32](7), + // GrainUnit: to.Ptr("days"), + // Value: to.Ptr[float32](84), + // ValueUnit: to.Ptr("percentage"), + // }, + // { + // Grain: to.Ptr[float32](30), + // GrainUnit: to.Ptr("days"), + // Value: to.Ptr[float32](83.87), + // ValueUnit: to.Ptr("percentage"), + // }}, + // Trend: to.Ptr(""), + // }, + // }, + // SKU: &armbillingbenefits.SKU{ + // Name: to.Ptr("Compute_Savings_Plan"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanUpdate.json func ExampleSavingsPlanClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armbillingbenefits.NewSavingsPlanClient(nil, cred, nil) + clientFactory, err := armbillingbenefits.NewClientFactory(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Update(ctx, "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", armbillingbenefits.SavingsPlanUpdateRequest{ + res, err := clientFactory.NewSavingsPlanClient().Update(ctx, "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", armbillingbenefits.SavingsPlanUpdateRequest{ Properties: &armbillingbenefits.SavingsPlanUpdateRequestProperties{ AppliedScopeProperties: &armbillingbenefits.AppliedScopeProperties{ ResourceGroupID: to.Ptr("/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/testrg"), @@ -156,22 +410,79 @@ func ExampleSavingsPlanClient_Update() { if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SavingsPlanModel = armbillingbenefits.SavingsPlanModel{ + // Name: to.Ptr("30000000-0000-0000-0000-000000000000"), + // Type: to.Ptr("microsoft.billingbenefits/savingsPlanOrders/savingsPlans"), + // ID: to.Ptr("/providers/microsoft.billingbenefits/savingsPlanOrders/20000000-0000-0000-0000-000000000000/savingsPlans/30000000-0000-0000-0000-000000000000"), + // Properties: &armbillingbenefits.SavingsPlanModelProperties{ + // AppliedScopeProperties: &armbillingbenefits.AppliedScopeProperties{ + // DisplayName: to.Ptr("Azure subscription 1"), + // SubscriptionID: to.Ptr("/subscriptions/10000000-0000-0000-0000-000000000000"), + // }, + // AppliedScopeType: to.Ptr(armbillingbenefits.AppliedScopeTypeSingle), + // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-27T00:34:33.6697600Z"); return t}()), + // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/20000000-1000-0000-0000-000000000000:20000000-0000-3000-0000-000000000000_2019-05-31"), + // BillingPlan: to.Ptr(armbillingbenefits.BillingPlanP1M), + // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/20000000-1000-0000-0000-000000000000:20000000-0000-3000-0000-000000000000_2019-05-31/billingProfiles/KPSV-DWNE-BG7-TGB"), + // BillingScopeID: to.Ptr("/subscriptions/10000000-0000-0000-0000-000000000000"), + // Commitment: &armbillingbenefits.Commitment{ + // Amount: to.Ptr[float64](0.001), + // CurrencyCode: to.Ptr("USD"), + // Grain: to.Ptr(armbillingbenefits.CommitmentGrainHourly), + // }, + // DisplayName: to.Ptr("riName"), + // DisplayProvisioningState: to.Ptr("Succeeded"), + // EffectiveDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-10T00:12:54.549373Z"); return t}()), + // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-10-27T00:34:33.6697600Z"); return t}()), + // ProvisioningState: to.Ptr(armbillingbenefits.ProvisioningStateSucceeded), + // PurchaseDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-27T00:32:45.5823486Z"); return t}()), + // Renew: to.Ptr(true), + // Term: to.Ptr(armbillingbenefits.TermP3Y), + // UserFriendlyAppliedScopeType: to.Ptr("Single"), + // Utilization: &armbillingbenefits.Utilization{ + // Aggregates: []*armbillingbenefits.UtilizationAggregates{ + // { + // Grain: to.Ptr[float32](1), + // GrainUnit: to.Ptr("days"), + // Value: to.Ptr[float32](100), + // ValueUnit: to.Ptr("percentage"), + // }, + // { + // Grain: to.Ptr[float32](7), + // GrainUnit: to.Ptr("days"), + // Value: to.Ptr[float32](37), + // ValueUnit: to.Ptr("percentage"), + // }, + // { + // Grain: to.Ptr[float32](30), + // GrainUnit: to.Ptr("days"), + // Value: to.Ptr[float32](53.85), + // ValueUnit: to.Ptr("percentage"), + // }}, + // Trend: to.Ptr("DOWN"), + // }, + // }, + // SKU: &armbillingbenefits.SKU{ + // Name: to.Ptr("Compute_Savings_Plan"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanValidateUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanValidateUpdate.json func ExampleSavingsPlanClient_ValidateUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armbillingbenefits.NewSavingsPlanClient(nil, cred, nil) + clientFactory, err := armbillingbenefits.NewClientFactory(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.ValidateUpdate(ctx, "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", armbillingbenefits.SavingsPlanUpdateValidateRequest{ + res, err := clientFactory.NewSavingsPlanClient().ValidateUpdate(ctx, "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", armbillingbenefits.SavingsPlanUpdateValidateRequest{ Benefits: []*armbillingbenefits.SavingsPlanUpdateRequestProperties{ { AppliedScopeProperties: &armbillingbenefits.AppliedScopeProperties{ @@ -191,6 +502,16 @@ func ExampleSavingsPlanClient_ValidateUpdate() { if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SavingsPlanValidateResponse = armbillingbenefits.SavingsPlanValidateResponse{ + // Benefits: []*armbillingbenefits.SavingsPlanValidResponseProperty{ + // { + // Valid: to.Ptr(true), + // }, + // { + // Valid: to.Ptr(true), + // }}, + // } } diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplanorder_client.go b/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplanorder_client.go index 63e8d20e036c..674f3bd24d6c 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplanorder_client.go +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplanorder_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,47 +24,36 @@ import ( // SavingsPlanOrderClient contains the methods for the SavingsPlanOrder group. // Don't use this type directly, use NewSavingsPlanOrderClient() instead. type SavingsPlanOrderClient struct { - host string - expand *string - pl runtime.Pipeline + internal *arm.Client } // NewSavingsPlanOrderClient creates a new instance of SavingsPlanOrderClient with the specified values. -// expand - May be used to expand the detail information of some properties. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewSavingsPlanOrderClient(expand *string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SavingsPlanOrderClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSavingsPlanOrderClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SavingsPlanOrderClient, error) { + cl, err := arm.NewClient(moduleName+".SavingsPlanOrderClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &SavingsPlanOrderClient{ - expand: expand, - host: ep, - pl: pl, + internal: cl, } return client, nil } // Elevate - Elevate as owner on savings plan order based on billing permissions. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-11-01 -// savingsPlanOrderID - Order ID of the savings plan -// options - SavingsPlanOrderClientElevateOptions contains the optional parameters for the SavingsPlanOrderClient.Elevate -// method. +// - savingsPlanOrderID - Order ID of the savings plan +// - options - SavingsPlanOrderClientElevateOptions contains the optional parameters for the SavingsPlanOrderClient.Elevate +// method. func (client *SavingsPlanOrderClient) Elevate(ctx context.Context, savingsPlanOrderID string, options *SavingsPlanOrderClientElevateOptions) (SavingsPlanOrderClientElevateResponse, error) { req, err := client.elevateCreateRequest(ctx, savingsPlanOrderID, options) if err != nil { return SavingsPlanOrderClientElevateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SavingsPlanOrderClientElevateResponse{}, err } @@ -83,7 +70,7 @@ func (client *SavingsPlanOrderClient) elevateCreateRequest(ctx context.Context, return nil, errors.New("parameter savingsPlanOrderID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{savingsPlanOrderId}", url.PathEscape(savingsPlanOrderID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -105,15 +92,16 @@ func (client *SavingsPlanOrderClient) elevateHandleResponse(resp *http.Response) // Get - Get a savings plan order. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-11-01 -// savingsPlanOrderID - Order ID of the savings plan -// options - SavingsPlanOrderClientGetOptions contains the optional parameters for the SavingsPlanOrderClient.Get method. +// - savingsPlanOrderID - Order ID of the savings plan +// - options - SavingsPlanOrderClientGetOptions contains the optional parameters for the SavingsPlanOrderClient.Get method. func (client *SavingsPlanOrderClient) Get(ctx context.Context, savingsPlanOrderID string, options *SavingsPlanOrderClientGetOptions) (SavingsPlanOrderClientGetResponse, error) { req, err := client.getCreateRequest(ctx, savingsPlanOrderID, options) if err != nil { return SavingsPlanOrderClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SavingsPlanOrderClientGetResponse{}, err } @@ -130,14 +118,14 @@ func (client *SavingsPlanOrderClient) getCreateRequest(ctx context.Context, savi return nil, errors.New("parameter savingsPlanOrderID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{savingsPlanOrderId}", url.PathEscape(savingsPlanOrderID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2022-11-01") - if client.expand != nil { - reqQP.Set("$expand", *client.expand) + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} @@ -154,8 +142,10 @@ func (client *SavingsPlanOrderClient) getHandleResponse(resp *http.Response) (Sa } // NewListPager - List all Savings plan orders. +// // Generated from API version 2022-11-01 -// options - SavingsPlanOrderClientListOptions contains the optional parameters for the SavingsPlanOrderClient.List method. +// - options - SavingsPlanOrderClientListOptions contains the optional parameters for the SavingsPlanOrderClient.NewListPager +// method. func (client *SavingsPlanOrderClient) NewListPager(options *SavingsPlanOrderClientListOptions) *runtime.Pager[SavingsPlanOrderClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SavingsPlanOrderClientListResponse]{ More: func(page SavingsPlanOrderClientListResponse) bool { @@ -172,7 +162,7 @@ func (client *SavingsPlanOrderClient) NewListPager(options *SavingsPlanOrderClie if err != nil { return SavingsPlanOrderClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SavingsPlanOrderClientListResponse{}, err } @@ -187,7 +177,7 @@ func (client *SavingsPlanOrderClient) NewListPager(options *SavingsPlanOrderClie // listCreateRequest creates the List request. func (client *SavingsPlanOrderClient) listCreateRequest(ctx context.Context, options *SavingsPlanOrderClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.BillingBenefits/savingsPlanOrders" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplanorder_client_example_test.go b/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplanorder_client_example_test.go index bcd3c19a7489..64efa388a118 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplanorder_client_example_test.go +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplanorder_client_example_test.go @@ -5,6 +5,7 @@ // 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 armbillingbenefits_test @@ -14,86 +15,464 @@ import ( "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/billingbenefits/armbillingbenefits" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billingbenefits/armbillingbenefits/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanOrderGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanOrderGet.json func ExampleSavingsPlanOrderClient_Get_savingsPlanOrderGet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armbillingbenefits.NewSavingsPlanOrderClient(nil, cred, nil) + clientFactory, err := armbillingbenefits.NewClientFactory(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "20000000-0000-0000-0000-000000000000", nil) + res, err := clientFactory.NewSavingsPlanOrderClient().Get(ctx, "20000000-0000-0000-0000-000000000000", &armbillingbenefits.SavingsPlanOrderClientGetOptions{Expand: nil}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SavingsPlanOrderModel = armbillingbenefits.SavingsPlanOrderModel{ + // Name: to.Ptr("20000000-0000-0000-0000-000000000000"), + // Type: to.Ptr("Microsoft.BillingBenefits/savingsPlanOrders"), + // ID: to.Ptr("/providers/microsoft.billingbenefits/savingsPlanOrders/20000000-0000-0000-0000-000000000000"), + // Properties: &armbillingbenefits.SavingsPlanOrderModelProperties{ + // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/20000000-1000-0000-0000-000000000000:20000000-0000-3000-0000-000000000000_2019-05-31"), + // BillingPlan: to.Ptr(armbillingbenefits.BillingPlanP1M), + // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/20000000-1000-0000-0000-000000000000:20000000-0000-3000-0000-000000000000_2019-05-31/billingProfiles/KPSV-DWNE-BG7-TGB"), + // BillingScopeID: to.Ptr("20000000-0000-0000-0000-000000000005"), + // DisplayName: to.Ptr("Compute_SavingsPlan_10-19-2022_11-01"), + // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-10-19T18:03:55.2519794Z"); return t}()), + // ProvisioningState: to.Ptr(armbillingbenefits.ProvisioningStateSucceeded), + // SavingsPlans: []*string{ + // to.Ptr("/providers/Microsoft.BillingBenefits/savingsPlanOrders/20000000-0000-0000-0000-000000000000/savingsPlans/30000000-0000-0000-0000-000000000000")}, + // Term: to.Ptr(armbillingbenefits.TermP3Y), + // }, + // SKU: &armbillingbenefits.SKU{ + // Name: to.Ptr("Compute_Savings_Plan"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanOrderExpandedGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanOrderExpandedGet.json func ExampleSavingsPlanOrderClient_Get_savingsPlanOrderWithExpandedPaymentsGet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armbillingbenefits.NewSavingsPlanOrderClient(to.Ptr("schedule"), cred, nil) + clientFactory, err := armbillingbenefits.NewClientFactory(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "20000000-0000-0000-0000-000000000000", nil) + res, err := clientFactory.NewSavingsPlanOrderClient().Get(ctx, "20000000-0000-0000-0000-000000000000", &armbillingbenefits.SavingsPlanOrderClientGetOptions{Expand: to.Ptr("schedule")}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SavingsPlanOrderModel = armbillingbenefits.SavingsPlanOrderModel{ + // Name: to.Ptr("20000000-0000-0000-0000-000000000000"), + // Type: to.Ptr("Microsoft.BillingBenefits/savingsPlanOrders"), + // ID: to.Ptr("/providers/microsoft.billingbenefits/savingsPlanOrders/20000000-0000-0000-0000-000000000000"), + // Properties: &armbillingbenefits.SavingsPlanOrderModelProperties{ + // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/20000000-1000-0000-0000-000000000000:20000000-0000-3000-0000-000000000000_2019-05-31"), + // BillingPlan: to.Ptr(armbillingbenefits.BillingPlanP1M), + // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/20000000-1000-0000-0000-000000000000:20000000-0000-3000-0000-000000000000_2019-05-31/billingProfiles/KPSV-DWNE-BG7-TGB"), + // BillingScopeID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234567/billingSubscriptions/30000000-0000-0000-0000-000000000003"), + // DisplayName: to.Ptr("Compute_SavingsPlan_10-19-2022_11-01"), + // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-10-19T18:03:55.2519794Z"); return t}()), + // PlanInformation: &armbillingbenefits.BillingPlanInformation{ + // NextPaymentDueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-11-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](26.28), + // CurrencyCode: to.Ptr("USD"), + // }, + // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-10-19"); return t}()), + // Transactions: []*armbillingbenefits.PaymentDetail{ + // { + // BillingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-10-19"); return t}()), + // PaymentDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-10-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatus("Completed")), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-11-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-12-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-01-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-02-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-03-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-04-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-05-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-06-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-07-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-08-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-09-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-10-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-11-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-12-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-01-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-02-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-03-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-04-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-05-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-06-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-07-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-08-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-09-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-10-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-11-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-12-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2025-01-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2025-02-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2025-03-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2025-04-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2025-05-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2025-06-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2025-07-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2025-08-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }, + // { + // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2025-09-19"); return t}()), + // PricingCurrencyTotal: &armbillingbenefits.Price{ + // Amount: to.Ptr[float64](0.73), + // CurrencyCode: to.Ptr("USD"), + // }, + // Status: to.Ptr(armbillingbenefits.PaymentStatusScheduled), + // }}, + // }, + // ProvisioningState: to.Ptr(armbillingbenefits.ProvisioningStateSucceeded), + // SavingsPlans: []*string{ + // to.Ptr("/providers/Microsoft.BillingBenefits/savingsPlanOrders/20000000-0000-0000-0000-000000000000/savingsPlans/30000000-0000-0000-0000-000000000000")}, + // Term: to.Ptr(armbillingbenefits.TermP3Y), + // }, + // SKU: &armbillingbenefits.SKU{ + // Name: to.Ptr("Compute_Savings_Plan"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanOrderElevate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanOrderElevate.json func ExampleSavingsPlanOrderClient_Elevate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armbillingbenefits.NewSavingsPlanOrderClient(nil, cred, nil) + clientFactory, err := armbillingbenefits.NewClientFactory(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Elevate(ctx, "20000000-0000-0000-0000-000000000000", nil) + res, err := clientFactory.NewSavingsPlanOrderClient().Elevate(ctx, "20000000-0000-0000-0000-000000000000", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RoleAssignmentEntity = armbillingbenefits.RoleAssignmentEntity{ + // Name: to.Ptr("70000000-0000-0000-0000-000000000005"), + // ID: to.Ptr("/providers/Microsoft.BillingBenefits/savingsPlanOrders/20000000-0000-0000-0000-000000000009/providers/Microsoft.Authorization/roleAssignments/70000000-0000-0000-0000-000000000005"), + // Properties: &armbillingbenefits.RoleAssignmentEntityProperties{ + // PrincipalID: to.Ptr("50000000-0000-0000-0000-000000000000"), + // RoleDefinitionID: to.Ptr("/providers/Microsoft.BillingBenefits/savingsPlanOrders/20000000-0000-0000-0000-000000000009/providers/Microsoft.Authorization/roleDefinitions/30000000-0000-0000-0000-000000000008"), + // Scope: to.Ptr("/providers/Microsoft.BillingBenefits/savingsPlanOrders/20000000-0000-0000-0000-000000000009"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanOrderList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanOrderList.json func ExampleSavingsPlanOrderClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armbillingbenefits.NewSavingsPlanOrderClient(nil, cred, nil) + clientFactory, err := armbillingbenefits.NewClientFactory(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(nil) + pager := clientFactory.NewSavingsPlanOrderClient().NewListPager(nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.SavingsPlanOrderModelList = armbillingbenefits.SavingsPlanOrderModelList{ + // Value: []*armbillingbenefits.SavingsPlanOrderModel{ + // { + // Name: to.Ptr("20000000-0000-0000-0000-000000000000"), + // Type: to.Ptr("Microsoft.BillingBenefits/savingsPlanOrders"), + // ID: to.Ptr("/providers/microsoft.billingbenefits/savingsPlanOrders/20000000-0000-0000-0000-000000000000"), + // Properties: &armbillingbenefits.SavingsPlanOrderModelProperties{ + // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/20000000-1000-0000-0000-000000000004:20000000-0000-3000-0000-000000000000_2019-05-31"), + // BillingPlan: to.Ptr(armbillingbenefits.BillingPlanP1M), + // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/20000000-1000-0000-0000-000000000004:20000000-0000-3000-0000-000000000000_2019-05-31/billingProfiles/KPSV-DWNE-BG7-TGB"), + // BillingScopeID: to.Ptr("20000000-0000-0000-0000-000000000005"), + // DisplayName: to.Ptr("Compute_SavingsPlan_10-28-2022_16-38"), + // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-10-28T23:40:30.6028303Z"); return t}()), + // ProvisioningState: to.Ptr(armbillingbenefits.ProvisioningStateSucceeded), + // SavingsPlans: []*string{ + // to.Ptr("/providers/Microsoft.BillingBenefits/savingsPlanOrders/20000000-0000-0000-0000-000000000000/savingsPlans/20000000-0000-0000-0000-000000000001")}, + // Term: to.Ptr(armbillingbenefits.TermP3Y), + // }, + // SKU: &armbillingbenefits.SKU{ + // Name: to.Ptr("Compute_Savings_Plan"), + // }, + // }}, + // } } } diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplanorderalias_client.go b/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplanorderalias_client.go index 0dbd46739039..126ac00e0675 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplanorderalias_client.go +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplanorderalias_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,62 +24,55 @@ import ( // SavingsPlanOrderAliasClient contains the methods for the SavingsPlanOrderAlias group. // Don't use this type directly, use NewSavingsPlanOrderAliasClient() instead. type SavingsPlanOrderAliasClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewSavingsPlanOrderAliasClient creates a new instance of SavingsPlanOrderAliasClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewSavingsPlanOrderAliasClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SavingsPlanOrderAliasClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".SavingsPlanOrderAliasClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &SavingsPlanOrderAliasClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // BeginCreate - Create a savings plan. Learn more about permissions needed at https://go.microsoft.com/fwlink/?linkid=2215851 // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-11-01 -// savingsPlanOrderAliasName - Name of the savings plan order alias -// body - Request body for creating a savings plan order alias -// options - SavingsPlanOrderAliasClientBeginCreateOptions contains the optional parameters for the SavingsPlanOrderAliasClient.BeginCreate -// method. +// - savingsPlanOrderAliasName - Name of the savings plan order alias +// - body - Request body for creating a savings plan order alias +// - options - SavingsPlanOrderAliasClientBeginCreateOptions contains the optional parameters for the SavingsPlanOrderAliasClient.BeginCreate +// method. func (client *SavingsPlanOrderAliasClient) BeginCreate(ctx context.Context, savingsPlanOrderAliasName string, body SavingsPlanOrderAliasModel, options *SavingsPlanOrderAliasClientBeginCreateOptions) (*runtime.Poller[SavingsPlanOrderAliasClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.create(ctx, savingsPlanOrderAliasName, body, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SavingsPlanOrderAliasClientCreateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SavingsPlanOrderAliasClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[SavingsPlanOrderAliasClientCreateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[SavingsPlanOrderAliasClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Create - Create a savings plan. Learn more about permissions needed at https://go.microsoft.com/fwlink/?linkid=2215851 // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-11-01 func (client *SavingsPlanOrderAliasClient) create(ctx context.Context, savingsPlanOrderAliasName string, body SavingsPlanOrderAliasModel, options *SavingsPlanOrderAliasClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, savingsPlanOrderAliasName, body, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -98,7 +89,7 @@ func (client *SavingsPlanOrderAliasClient) createCreateRequest(ctx context.Conte return nil, errors.New("parameter savingsPlanOrderAliasName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{savingsPlanOrderAliasName}", url.PathEscape(savingsPlanOrderAliasName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -111,16 +102,17 @@ func (client *SavingsPlanOrderAliasClient) createCreateRequest(ctx context.Conte // Get - Get a savings plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-11-01 -// savingsPlanOrderAliasName - Name of the savings plan order alias -// options - SavingsPlanOrderAliasClientGetOptions contains the optional parameters for the SavingsPlanOrderAliasClient.Get -// method. +// - savingsPlanOrderAliasName - Name of the savings plan order alias +// - options - SavingsPlanOrderAliasClientGetOptions contains the optional parameters for the SavingsPlanOrderAliasClient.Get +// method. func (client *SavingsPlanOrderAliasClient) Get(ctx context.Context, savingsPlanOrderAliasName string, options *SavingsPlanOrderAliasClientGetOptions) (SavingsPlanOrderAliasClientGetResponse, error) { req, err := client.getCreateRequest(ctx, savingsPlanOrderAliasName, options) if err != nil { return SavingsPlanOrderAliasClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SavingsPlanOrderAliasClientGetResponse{}, err } @@ -137,7 +129,7 @@ func (client *SavingsPlanOrderAliasClient) getCreateRequest(ctx context.Context, return nil, errors.New("parameter savingsPlanOrderAliasName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{savingsPlanOrderAliasName}", url.PathEscape(savingsPlanOrderAliasName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplanorderalias_client_example_test.go b/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplanorderalias_client_example_test.go index ec0d0cb5a530..a76dcd39d037 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplanorderalias_client_example_test.go +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/savingsplanorderalias_client_example_test.go @@ -5,6 +5,7 @@ // 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 armbillingbenefits_test @@ -14,21 +15,21 @@ import ( "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/billingbenefits/armbillingbenefits" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billingbenefits/armbillingbenefits/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanOrderAliasCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanOrderAliasCreate.json func ExampleSavingsPlanOrderAliasClient_BeginCreate_savingsPlanOrderAliasCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armbillingbenefits.NewSavingsPlanOrderAliasClient(cred, nil) + clientFactory, err := armbillingbenefits.NewClientFactory(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreate(ctx, "spAlias123", armbillingbenefits.SavingsPlanOrderAliasModel{ + poller, err := clientFactory.NewSavingsPlanOrderAliasClient().BeginCreate(ctx, "spAlias123", armbillingbenefits.SavingsPlanOrderAliasModel{ Properties: &armbillingbenefits.SavingsPlanOrderAliasProperties{ AppliedScopeType: to.Ptr(armbillingbenefits.AppliedScopeTypeShared), BillingPlan: to.Ptr(armbillingbenefits.BillingPlanP1M), @@ -52,22 +53,45 @@ func ExampleSavingsPlanOrderAliasClient_BeginCreate_savingsPlanOrderAliasCreate( if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SavingsPlanOrderAliasModel = armbillingbenefits.SavingsPlanOrderAliasModel{ + // Name: to.Ptr("SavingsPlan_1667000324595"), + // Type: to.Ptr("Microsoft.BillingBenefits/savingsPlanOrderAliases"), + // ID: to.Ptr("/providers/microsoft.billingbenefits/savingsPlanOrderAliases/SavingsPlan_1667000324595"), + // Properties: &armbillingbenefits.SavingsPlanOrderAliasProperties{ + // AppliedScopeType: to.Ptr(armbillingbenefits.AppliedScopeTypeShared), + // BillingPlan: to.Ptr(armbillingbenefits.BillingPlanP1M), + // BillingScopeID: to.Ptr("/subscriptions/30000000-0000-0000-0000-000000000000"), + // Commitment: &armbillingbenefits.Commitment{ + // Amount: to.Ptr[float64](0.001), + // CurrencyCode: to.Ptr("USD"), + // Grain: to.Ptr(armbillingbenefits.CommitmentGrainHourly), + // }, + // DisplayName: to.Ptr("Compute_SavingsPlan_10-28-2022_16-38"), + // ProvisioningState: to.Ptr(armbillingbenefits.ProvisioningStateSucceeded), + // SavingsPlanOrderID: to.Ptr("/providers/Microsoft.BillingBenefits/savingsPlanOrders/30000000-0000-0000-0000-000000000023"), + // Term: to.Ptr(armbillingbenefits.TermP3Y), + // }, + // SKU: &armbillingbenefits.SKU{ + // Name: to.Ptr("Compute_Savings_Plan"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanOrderAliasCreateSingleScope.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanOrderAliasCreateSingleScope.json func ExampleSavingsPlanOrderAliasClient_BeginCreate_savingsPlanOrderAliasCreateSingleScope() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armbillingbenefits.NewSavingsPlanOrderAliasClient(cred, nil) + clientFactory, err := armbillingbenefits.NewClientFactory(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreate(ctx, "spAlias123", armbillingbenefits.SavingsPlanOrderAliasModel{ + poller, err := clientFactory.NewSavingsPlanOrderAliasClient().BeginCreate(ctx, "spAlias123", armbillingbenefits.SavingsPlanOrderAliasModel{ Properties: &armbillingbenefits.SavingsPlanOrderAliasProperties{ AppliedScopeProperties: &armbillingbenefits.AppliedScopeProperties{ SubscriptionID: to.Ptr("/subscriptions/30000000-0000-0000-0000-000000000000"), @@ -94,25 +118,77 @@ func ExampleSavingsPlanOrderAliasClient_BeginCreate_savingsPlanOrderAliasCreateS if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SavingsPlanOrderAliasModel = armbillingbenefits.SavingsPlanOrderAliasModel{ + // Name: to.Ptr("SavingsPlan_1667000324595"), + // Type: to.Ptr("Microsoft.BillingBenefits/savingsPlanOrderAliases"), + // ID: to.Ptr("/providers/microsoft.billingbenefits/savingsPlanOrderAliases/SavingsPlan_1667000324595"), + // Properties: &armbillingbenefits.SavingsPlanOrderAliasProperties{ + // AppliedScopeProperties: &armbillingbenefits.AppliedScopeProperties{ + // SubscriptionID: to.Ptr("/subscriptions/30000000-0000-0000-0000-000000000000"), + // }, + // AppliedScopeType: to.Ptr(armbillingbenefits.AppliedScopeTypeSingle), + // BillingPlan: to.Ptr(armbillingbenefits.BillingPlanP1M), + // BillingScopeID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234567/billingSubscriptions/30000000-0000-0000-0000-000000000000"), + // Commitment: &armbillingbenefits.Commitment{ + // Amount: to.Ptr[float64](0.001), + // CurrencyCode: to.Ptr("USD"), + // Grain: to.Ptr(armbillingbenefits.CommitmentGrainHourly), + // }, + // DisplayName: to.Ptr("Compute_SavingsPlan_10-28-2022_16-38"), + // ProvisioningState: to.Ptr(armbillingbenefits.ProvisioningStateSucceeded), + // SavingsPlanOrderID: to.Ptr("/providers/Microsoft.BillingBenefits/savingsPlanOrders/30000000-0000-0000-0000-000000000023"), + // Term: to.Ptr(armbillingbenefits.TermP3Y), + // }, + // SKU: &armbillingbenefits.SKU{ + // Name: to.Ptr("Compute_Savings_Plan"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanOrderAliasGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/billingbenefits/resource-manager/Microsoft.BillingBenefits/stable/2022-11-01/examples/SavingsPlanOrderAliasGet.json func ExampleSavingsPlanOrderAliasClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armbillingbenefits.NewSavingsPlanOrderAliasClient(cred, nil) + clientFactory, err := armbillingbenefits.NewClientFactory(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "spAlias123", nil) + res, err := clientFactory.NewSavingsPlanOrderAliasClient().Get(ctx, "spAlias123", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SavingsPlanOrderAliasModel = armbillingbenefits.SavingsPlanOrderAliasModel{ + // Name: to.Ptr("spAlias123"), + // Type: to.Ptr("Microsoft.BillingBenefits/savingsPlanOrderAliases"), + // ID: to.Ptr("/providers/microsoft.billingbenefits/savingsPlanOrderAliases/spAlias123"), + // Properties: &armbillingbenefits.SavingsPlanOrderAliasProperties{ + // AppliedScopeProperties: &armbillingbenefits.AppliedScopeProperties{ + // ResourceGroupID: to.Ptr("/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/testrg"), + // }, + // AppliedScopeType: to.Ptr(armbillingbenefits.AppliedScopeTypeSingle), + // BillingPlan: to.Ptr(armbillingbenefits.BillingPlanP1M), + // BillingScopeID: to.Ptr("/subscriptions/10000000-0000-0000-0000-000000000000"), + // Commitment: &armbillingbenefits.Commitment{ + // Amount: to.Ptr[float64](15.23), + // CurrencyCode: to.Ptr("USD"), + // Grain: to.Ptr(armbillingbenefits.CommitmentGrainHourly), + // }, + // DisplayName: to.Ptr("ComputeSavingsPlan_2021-07-01"), + // ProvisioningState: to.Ptr(armbillingbenefits.ProvisioningStateSucceeded), + // SavingsPlanOrderID: to.Ptr("/providers/Microsoft.BillingBenefits/savingsPlanOrders/30000000-0000-0000-0000-000000000000"), + // Term: to.Ptr(armbillingbenefits.TermP1Y), + // }, + // SKU: &armbillingbenefits.SKU{ + // Name: to.Ptr("Compute_Savings_Plan"), + // }, + // } } diff --git a/sdk/resourcemanager/billingbenefits/armbillingbenefits/time_rfc3339.go b/sdk/resourcemanager/billingbenefits/armbillingbenefits/time_rfc3339.go index 0b9656ac2fdf..9e0aa2f2f945 100644 --- a/sdk/resourcemanager/billingbenefits/armbillingbenefits/time_rfc3339.go +++ b/sdk/resourcemanager/billingbenefits/armbillingbenefits/time_rfc3339.go @@ -62,7 +62,7 @@ func (t *timeRFC3339) Parse(layout, value string) error { return err } -func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/blueprint/armblueprint/CHANGELOG.md b/sdk/resourcemanager/blueprint/armblueprint/CHANGELOG.md index 562d68a0d01c..3fe46bb74d72 100644 --- a/sdk/resourcemanager/blueprint/armblueprint/CHANGELOG.md +++ b/sdk/resourcemanager/blueprint/armblueprint/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 0.6.0 (2023-04-03) +### Features Added + +- New struct `ClientFactory` which is a client factory used to create any client in this module + + ## 0.5.0 (2022-05-17) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/blueprint/armblueprint` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 0.5.0, which contains breaking changes. diff --git a/sdk/resourcemanager/blueprint/armblueprint/README.md b/sdk/resourcemanager/blueprint/armblueprint/README.md index 74e47e70840d..99efec3abc2b 100644 --- a/sdk/resourcemanager/blueprint/armblueprint/README.md +++ b/sdk/resourcemanager/blueprint/armblueprint/README.md @@ -33,12 +33,12 @@ 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). -## Clients +## Client Factory -Azure Blueprint modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. +Azure Blueprint module consists of one or more clients. We provide a client factory which could be used to create any client in this module. ```go -client, err := armblueprint.NewBlueprintsClient(, cred, nil) +clientFactory, err := armblueprint.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). @@ -49,7 +49,15 @@ options := arm.ClientOptions { Cloud: cloud.AzureChina, }, } -client, err := armblueprint.NewBlueprintsClient(, cred, &options) +clientFactory, err := armblueprint.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.NewBlueprintsClient() ``` ## Provide Feedback diff --git a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_artifacts_client.go b/sdk/resourcemanager/blueprint/armblueprint/artifacts_client.go similarity index 79% rename from sdk/resourcemanager/blueprint/armblueprint/zz_generated_artifacts_client.go rename to sdk/resourcemanager/blueprint/armblueprint/artifacts_client.go index bcf6fb7b09b2..29a1ded4f7f0 100644 --- a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_artifacts_client.go +++ b/sdk/resourcemanager/blueprint/armblueprint/artifacts_client.go @@ -5,6 +5,7 @@ // 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 armblueprint @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,48 +24,40 @@ import ( // ArtifactsClient contains the methods for the Artifacts group. // Don't use this type directly, use NewArtifactsClient() instead. type ArtifactsClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewArtifactsClient creates a new instance of ArtifactsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewArtifactsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ArtifactsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".ArtifactsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ArtifactsClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // CreateOrUpdate - Create or update blueprint artifact. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-11-01-preview -// resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: '/subscriptions/{subscriptionId}'). -// blueprintName - Name of the blueprint definition. -// artifactName - Name of the blueprint artifact. -// artifact - Blueprint artifact to create or update. -// options - ArtifactsClientCreateOrUpdateOptions contains the optional parameters for the ArtifactsClient.CreateOrUpdate -// method. +// - resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), +// subscription (format: '/subscriptions/{subscriptionId}'). +// - blueprintName - Name of the blueprint definition. +// - artifactName - Name of the blueprint artifact. +// - artifact - Blueprint artifact to create or update. +// - options - ArtifactsClientCreateOrUpdateOptions contains the optional parameters for the ArtifactsClient.CreateOrUpdate +// method. func (client *ArtifactsClient) CreateOrUpdate(ctx context.Context, resourceScope string, blueprintName string, artifactName string, artifact ArtifactClassification, options *ArtifactsClientCreateOrUpdateOptions) (ArtifactsClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceScope, blueprintName, artifactName, artifact, options) if err != nil { return ArtifactsClientCreateOrUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ArtifactsClientCreateOrUpdateResponse{}, err } @@ -88,7 +79,7 @@ func (client *ArtifactsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, errors.New("parameter artifactName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{artifactName}", url.PathEscape(artifactName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -110,18 +101,19 @@ func (client *ArtifactsClient) createOrUpdateHandleResponse(resp *http.Response) // Delete - Delete a blueprint artifact. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-11-01-preview -// resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: '/subscriptions/{subscriptionId}'). -// blueprintName - Name of the blueprint definition. -// artifactName - Name of the blueprint artifact. -// options - ArtifactsClientDeleteOptions contains the optional parameters for the ArtifactsClient.Delete method. +// - resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), +// subscription (format: '/subscriptions/{subscriptionId}'). +// - blueprintName - Name of the blueprint definition. +// - artifactName - Name of the blueprint artifact. +// - options - ArtifactsClientDeleteOptions contains the optional parameters for the ArtifactsClient.Delete method. func (client *ArtifactsClient) Delete(ctx context.Context, resourceScope string, blueprintName string, artifactName string, options *ArtifactsClientDeleteOptions) (ArtifactsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceScope, blueprintName, artifactName, options) if err != nil { return ArtifactsClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ArtifactsClientDeleteResponse{}, err } @@ -143,7 +135,7 @@ func (client *ArtifactsClient) deleteCreateRequest(ctx context.Context, resource return nil, errors.New("parameter artifactName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{artifactName}", url.PathEscape(artifactName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -165,18 +157,19 @@ func (client *ArtifactsClient) deleteHandleResponse(resp *http.Response) (Artifa // Get - Get a blueprint artifact. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-11-01-preview -// resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: '/subscriptions/{subscriptionId}'). -// blueprintName - Name of the blueprint definition. -// artifactName - Name of the blueprint artifact. -// options - ArtifactsClientGetOptions contains the optional parameters for the ArtifactsClient.Get method. +// - resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), +// subscription (format: '/subscriptions/{subscriptionId}'). +// - blueprintName - Name of the blueprint definition. +// - artifactName - Name of the blueprint artifact. +// - options - ArtifactsClientGetOptions contains the optional parameters for the ArtifactsClient.Get method. func (client *ArtifactsClient) Get(ctx context.Context, resourceScope string, blueprintName string, artifactName string, options *ArtifactsClientGetOptions) (ArtifactsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceScope, blueprintName, artifactName, options) if err != nil { return ArtifactsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ArtifactsClientGetResponse{}, err } @@ -198,7 +191,7 @@ func (client *ArtifactsClient) getCreateRequest(ctx context.Context, resourceSco return nil, errors.New("parameter artifactName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{artifactName}", url.PathEscape(artifactName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -219,12 +212,12 @@ func (client *ArtifactsClient) getHandleResponse(resp *http.Response) (Artifacts } // NewListPager - List artifacts for a given blueprint definition. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-11-01-preview -// resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: '/subscriptions/{subscriptionId}'). -// blueprintName - Name of the blueprint definition. -// options - ArtifactsClientListOptions contains the optional parameters for the ArtifactsClient.List method. +// - resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), +// subscription (format: '/subscriptions/{subscriptionId}'). +// - blueprintName - Name of the blueprint definition. +// - options - ArtifactsClientListOptions contains the optional parameters for the ArtifactsClient.NewListPager method. func (client *ArtifactsClient) NewListPager(resourceScope string, blueprintName string, options *ArtifactsClientListOptions) *runtime.Pager[ArtifactsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ArtifactsClientListResponse]{ More: func(page ArtifactsClientListResponse) bool { @@ -241,7 +234,7 @@ func (client *ArtifactsClient) NewListPager(resourceScope string, blueprintName if err != nil { return ArtifactsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ArtifactsClientListResponse{}, err } @@ -261,7 +254,7 @@ func (client *ArtifactsClient) listCreateRequest(ctx context.Context, resourceSc return nil, errors.New("parameter blueprintName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{blueprintName}", url.PathEscape(blueprintName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/blueprint/armblueprint/artifacts_client_example_test.go b/sdk/resourcemanager/blueprint/armblueprint/artifacts_client_example_test.go new file mode 100644 index 000000000000..7a35ce1291b5 --- /dev/null +++ b/sdk/resourcemanager/blueprint/armblueprint/artifacts_client_example_test.go @@ -0,0 +1,1087 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armblueprint_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/blueprint/armblueprint" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/ARMTemplateArtifact_Create.json +func ExampleArtifactsClient_CreateOrUpdate_mgArmTemplateArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewArtifactsClient().CreateOrUpdate(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", "storageTemplate", &armblueprint.TemplateArtifact{ + Kind: to.Ptr(armblueprint.ArtifactKindTemplate), + Properties: &armblueprint.TemplateArtifactProperties{ + Parameters: map[string]*armblueprint.ParameterValue{ + "storageAccountType": { + Value: "[parameters('storageAccountType')]", + }, + }, + ResourceGroup: to.Ptr("storageRG"), + Template: map[string]any{ + "contentVersion": "1.0.0.0", + "outputs": map[string]any{ + "storageAccountName": map[string]any{ + "type": "string", + "value": "[variables('storageAccountName')]", + }, + }, + "parameters": map[string]any{ + "storageAccountType": map[string]any{ + "type": "string", + "allowedValues": []any{ + "Standard_LRS", + "Standard_GRS", + "Standard_ZRS", + "Premium_LRS", + }, + "defaultValue": "Standard_LRS", + "metadata": map[string]any{ + "description": "Storage Account type", + }, + }, + }, + "resources": []any{ + map[string]any{ + "name": "[variables('storageAccountName')]", + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2016-01-01", + "kind": "Storage", + "location": "[resourceGroup().location]", + "properties": map[string]any{}, + "sku": map[string]any{ + "name": "[parameters('storageAccountType')]", + }, + }, + }, + "variables": map[string]any{ + "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'standardsa')]", + }, + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/PolicyAssignmentArtifact_Create.json +func ExampleArtifactsClient_CreateOrUpdate_mgPolicyAssignmentArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewArtifactsClient().CreateOrUpdate(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", "costCenterPolicy", &armblueprint.PolicyAssignmentArtifact{ + Kind: to.Ptr(armblueprint.ArtifactKindPolicyAssignment), + Properties: &armblueprint.PolicyAssignmentArtifactProperties{ + DisplayName: to.Ptr("force costCenter tag on all resources"), + Parameters: map[string]*armblueprint.ParameterValue{ + "tagName": { + Value: "costCenter", + }, + "tagValue": { + Value: "[parameter('costCenter')]", + }, + }, + PolicyDefinitionID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/RoleAssignmentArtifact_Create.json +func ExampleArtifactsClient_CreateOrUpdate_mgRoleAssignmentArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewArtifactsClient().CreateOrUpdate(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", "ownerAssignment", &armblueprint.RoleAssignmentArtifact{ + Kind: to.Ptr(armblueprint.ArtifactKindRoleAssignment), + Properties: &armblueprint.RoleAssignmentArtifactProperties{ + DisplayName: to.Ptr("enforce owners of given subscription"), + PrincipalIDs: "[parameters('owners')]", + RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/ARMTemplateArtifact_Create.json +func ExampleArtifactsClient_CreateOrUpdate_subArmTemplateArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewArtifactsClient().CreateOrUpdate(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", "storageTemplate", &armblueprint.TemplateArtifact{ + Kind: to.Ptr(armblueprint.ArtifactKindTemplate), + Properties: &armblueprint.TemplateArtifactProperties{ + Parameters: map[string]*armblueprint.ParameterValue{ + "storageAccountType": { + Value: "[parameters('storageAccountType')]", + }, + }, + ResourceGroup: to.Ptr("storageRG"), + Template: map[string]any{ + "contentVersion": "1.0.0.0", + "outputs": map[string]any{ + "storageAccountName": map[string]any{ + "type": "string", + "value": "[variables('storageAccountName')]", + }, + }, + "parameters": map[string]any{ + "storageAccountType": map[string]any{ + "type": "string", + "allowedValues": []any{ + "Standard_LRS", + "Standard_GRS", + "Standard_ZRS", + "Premium_LRS", + }, + "defaultValue": "Standard_LRS", + "metadata": map[string]any{ + "description": "Storage Account type", + }, + }, + }, + "resources": []any{ + map[string]any{ + "name": "[variables('storageAccountName')]", + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2016-01-01", + "kind": "Storage", + "location": "[resourceGroup().location]", + "properties": map[string]any{}, + "sku": map[string]any{ + "name": "[parameters('storageAccountType')]", + }, + }, + }, + "variables": map[string]any{ + "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'standardsa')]", + }, + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/PolicyAssignmentArtifact_Create.json +func ExampleArtifactsClient_CreateOrUpdate_subPolicyAssignmentArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewArtifactsClient().CreateOrUpdate(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", "costCenterPolicy", &armblueprint.PolicyAssignmentArtifact{ + Kind: to.Ptr(armblueprint.ArtifactKindPolicyAssignment), + Properties: &armblueprint.PolicyAssignmentArtifactProperties{ + DisplayName: to.Ptr("force costCenter tag on all resources"), + Parameters: map[string]*armblueprint.ParameterValue{ + "tagName": { + Value: "costCenter", + }, + "tagValue": { + Value: "[parameter('costCenter')]", + }, + }, + PolicyDefinitionID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/RoleAssignmentArtifact_Create.json +func ExampleArtifactsClient_CreateOrUpdate_subRoleAssignmentArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewArtifactsClient().CreateOrUpdate(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", "ownerAssignment", &armblueprint.RoleAssignmentArtifact{ + Kind: to.Ptr(armblueprint.ArtifactKindRoleAssignment), + Properties: &armblueprint.RoleAssignmentArtifactProperties{ + DisplayName: to.Ptr("enforce owners of given subscription"), + PrincipalIDs: "[parameters('owners')]", + RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/ARMTemplateArtifact_Get.json +func ExampleArtifactsClient_Get_mgArmTemplateArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewArtifactsClient().Get(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", "storageTemplate", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armblueprint.ArtifactsClientGetResponse{ + // ArtifactClassification: &armblueprint.TemplateArtifact{ + // Name: to.Ptr("storageTemplate"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/storageTemplate"), + // Kind: to.Ptr(armblueprint.ArtifactKindTemplate), + // Properties: &armblueprint.TemplateArtifactProperties{ + // Parameters: map[string]*armblueprint.ParameterValue{ + // "storageAccountType": &armblueprint.ParameterValue{ + // Value: "[parameters('storageAccountType')]", + // }, + // }, + // ResourceGroup: to.Ptr("storageRG"), + // Template: map[string]any{ + // "contentVersion": "1.0.0.0", + // "outputs":map[string]any{ + // "storageAccountName":map[string]any{ + // "type": "string", + // "value": "[variables('storageAccountName')]", + // }, + // }, + // "parameters":map[string]any{ + // "storageAccountType":map[string]any{ + // "type": "string", + // "allowedValues":[]any{ + // "Standard_LRS", + // "Standard_GRS", + // "Standard_ZRS", + // "Premium_LRS", + // }, + // "defaultValue": "Standard_LRS", + // "metadata":map[string]any{ + // "description": "Storage Account type", + // }, + // }, + // }, + // "resources":[]any{ + // map[string]any{ + // "name": "[variables('storageAccountName')]", + // "type": "Microsoft.Storage/storageAccounts", + // "apiVersion": "2016-01-01", + // "kind": "Storage", + // "location": "[resourceGroup().location]", + // "properties":map[string]any{ + // }, + // "sku":map[string]any{ + // "name": "[parameters('storageAccountType')]", + // }, + // }, + // }, + // "variables":map[string]any{ + // "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'standardsa')]", + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/PolicyAssignmentArtifact_Get.json +func ExampleArtifactsClient_Get_mgPolicyAssignmentArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewArtifactsClient().Get(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", "costCenterPolicy", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armblueprint.ArtifactsClientGetResponse{ + // ArtifactClassification: &armblueprint.PolicyAssignmentArtifact{ + // Name: to.Ptr("costCenterPolicy"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/costCenterPolicy"), + // Kind: to.Ptr(armblueprint.ArtifactKindPolicyAssignment), + // Properties: &armblueprint.PolicyAssignmentArtifactProperties{ + // DisplayName: to.Ptr("force costCenter tag on all resources"), + // Parameters: map[string]*armblueprint.ParameterValue{ + // "tagName": &armblueprint.ParameterValue{ + // Value: "costCenter", + // }, + // "tagValue": &armblueprint.ParameterValue{ + // Value: "[parameter('costCenter')]", + // }, + // }, + // PolicyDefinitionID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/RoleAssignmentArtifact_Get.json +func ExampleArtifactsClient_Get_mgRoleAssignmentArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewArtifactsClient().Get(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", "ownerAssignment", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armblueprint.ArtifactsClientGetResponse{ + // ArtifactClassification: &armblueprint.RoleAssignmentArtifact{ + // Name: to.Ptr("ownerAssignment"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/ownerAssignment"), + // Kind: to.Ptr(armblueprint.ArtifactKindRoleAssignment), + // Properties: &armblueprint.RoleAssignmentArtifactProperties{ + // DisplayName: to.Ptr("enforce owners of given subscription"), + // PrincipalIDs: "[parameters('owners')]", + // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/ARMTemplateArtifact_Get.json +func ExampleArtifactsClient_Get_subArmTemplateArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewArtifactsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", "storageTemplate", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armblueprint.ArtifactsClientGetResponse{ + // ArtifactClassification: &armblueprint.TemplateArtifact{ + // Name: to.Ptr("storageTemplate"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/storageTemplate"), + // Kind: to.Ptr(armblueprint.ArtifactKindTemplate), + // Properties: &armblueprint.TemplateArtifactProperties{ + // Parameters: map[string]*armblueprint.ParameterValue{ + // "storageAccountType": &armblueprint.ParameterValue{ + // Value: "[parameters('storageAccountType')]", + // }, + // }, + // ResourceGroup: to.Ptr("storageRG"), + // Template: map[string]any{ + // "contentVersion": "1.0.0.0", + // "outputs":map[string]any{ + // "storageAccountName":map[string]any{ + // "type": "string", + // "value": "[variables('storageAccountName')]", + // }, + // }, + // "parameters":map[string]any{ + // "storageAccountType":map[string]any{ + // "type": "string", + // "allowedValues":[]any{ + // "Standard_LRS", + // "Standard_GRS", + // "Standard_ZRS", + // "Premium_LRS", + // }, + // "defaultValue": "Standard_LRS", + // "metadata":map[string]any{ + // "description": "Storage Account type", + // }, + // }, + // }, + // "resources":[]any{ + // map[string]any{ + // "name": "[variables('storageAccountName')]", + // "type": "Microsoft.Storage/storageAccounts", + // "apiVersion": "2016-01-01", + // "kind": "Storage", + // "location": "[resourceGroup().location]", + // "properties":map[string]any{ + // }, + // "sku":map[string]any{ + // "name": "[parameters('storageAccountType')]", + // }, + // }, + // }, + // "variables":map[string]any{ + // "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'standardsa')]", + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/PolicyAssignmentArtifact_Get.json +func ExampleArtifactsClient_Get_subPolicyAssignmentArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewArtifactsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", "costCenterPolicy", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armblueprint.ArtifactsClientGetResponse{ + // ArtifactClassification: &armblueprint.PolicyAssignmentArtifact{ + // Name: to.Ptr("costCenterPolicy"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/costCenterPolicy"), + // Kind: to.Ptr(armblueprint.ArtifactKindPolicyAssignment), + // Properties: &armblueprint.PolicyAssignmentArtifactProperties{ + // DisplayName: to.Ptr("force costCenter tag on all resources"), + // Parameters: map[string]*armblueprint.ParameterValue{ + // "tagName": &armblueprint.ParameterValue{ + // Value: "costCenter", + // }, + // "tagValue": &armblueprint.ParameterValue{ + // Value: "[parameter('costCenter')]", + // }, + // }, + // PolicyDefinitionID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/RoleAssignmentArtifact_Get.json +func ExampleArtifactsClient_Get_subRoleAssignmentArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewArtifactsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", "ownerAssignment", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armblueprint.ArtifactsClientGetResponse{ + // ArtifactClassification: &armblueprint.RoleAssignmentArtifact{ + // Name: to.Ptr("ownerAssignment"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/ownerAssignment"), + // Kind: to.Ptr(armblueprint.ArtifactKindRoleAssignment), + // Properties: &armblueprint.RoleAssignmentArtifactProperties{ + // DisplayName: to.Ptr("enforce owners of given subscription"), + // PrincipalIDs: "[parameters('owners')]", + // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/ARMTemplateArtifact_Delete.json +func ExampleArtifactsClient_Delete_mgArmTemplateArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewArtifactsClient().Delete(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", "storageTemplate", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armblueprint.ArtifactsClientDeleteResponse{ + // ArtifactClassification: &armblueprint.TemplateArtifact{ + // Name: to.Ptr("storageTemplate"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/storageTemplate"), + // Kind: to.Ptr(armblueprint.ArtifactKindTemplate), + // Properties: &armblueprint.TemplateArtifactProperties{ + // Parameters: map[string]*armblueprint.ParameterValue{ + // "storageAccountType": &armblueprint.ParameterValue{ + // Value: "[parameters('storageAccountType')]", + // }, + // }, + // ResourceGroup: to.Ptr("storageRG"), + // Template: map[string]any{ + // "contentVersion": "1.0.0.0", + // "outputs":map[string]any{ + // "storageAccountName":map[string]any{ + // "type": "string", + // "value": "[variables('storageAccountName')]", + // }, + // }, + // "parameters":map[string]any{ + // "storageAccountType":map[string]any{ + // "type": "string", + // "allowedValues":[]any{ + // "Standard_LRS", + // "Standard_GRS", + // "Standard_ZRS", + // "Premium_LRS", + // }, + // "defaultValue": "Standard_LRS", + // "metadata":map[string]any{ + // "description": "Storage Account type", + // }, + // }, + // }, + // "resources":[]any{ + // map[string]any{ + // "name": "[variables('storageAccountName')]", + // "type": "Microsoft.Storage/storageAccounts", + // "apiVersion": "2016-01-01", + // "kind": "Storage", + // "location": "[resourceGroup().location]", + // "properties":map[string]any{ + // }, + // "sku":map[string]any{ + // "name": "[parameters('storageAccountType')]", + // }, + // }, + // }, + // "variables":map[string]any{ + // "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'standardsa')]", + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/PolicyAssignmentArtifact_Delete.json +func ExampleArtifactsClient_Delete_mgPolicyAssignmentArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewArtifactsClient().Delete(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", "costCenterPolicy", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armblueprint.ArtifactsClientDeleteResponse{ + // ArtifactClassification: &armblueprint.PolicyAssignmentArtifact{ + // Name: to.Ptr("costCenterPolicy"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/costCenterPolicy"), + // Kind: to.Ptr(armblueprint.ArtifactKindPolicyAssignment), + // Properties: &armblueprint.PolicyAssignmentArtifactProperties{ + // DisplayName: to.Ptr("force costCenter tag on all resources"), + // Parameters: map[string]*armblueprint.ParameterValue{ + // "tagName": &armblueprint.ParameterValue{ + // Value: "costCenter", + // }, + // "tagValue": &armblueprint.ParameterValue{ + // Value: "[parameter('costCenter')]", + // }, + // }, + // PolicyDefinitionID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/RoleAssignmentArtifact_Delete.json +func ExampleArtifactsClient_Delete_mgRoleAssignmentArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewArtifactsClient().Delete(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", "ownerAssignment", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armblueprint.ArtifactsClientDeleteResponse{ + // ArtifactClassification: &armblueprint.RoleAssignmentArtifact{ + // Name: to.Ptr("ownerAssignment"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/ownerAssignment"), + // Kind: to.Ptr(armblueprint.ArtifactKindRoleAssignment), + // Properties: &armblueprint.RoleAssignmentArtifactProperties{ + // DisplayName: to.Ptr("enforce owners of given subscription"), + // PrincipalIDs: "[parameters('owners')]", + // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/ARMTemplateArtifact_Delete.json +func ExampleArtifactsClient_Delete_subArmTemplateArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewArtifactsClient().Delete(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", "storageTemplate", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armblueprint.ArtifactsClientDeleteResponse{ + // ArtifactClassification: &armblueprint.TemplateArtifact{ + // Name: to.Ptr("storageTemplate"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/storageTemplate"), + // Kind: to.Ptr(armblueprint.ArtifactKindTemplate), + // Properties: &armblueprint.TemplateArtifactProperties{ + // Parameters: map[string]*armblueprint.ParameterValue{ + // "storageAccountType": &armblueprint.ParameterValue{ + // Value: "[parameters('storageAccountType')]", + // }, + // }, + // ResourceGroup: to.Ptr("storageRG"), + // Template: map[string]any{ + // "contentVersion": "1.0.0.0", + // "outputs":map[string]any{ + // "storageAccountName":map[string]any{ + // "type": "string", + // "value": "[variables('storageAccountName')]", + // }, + // }, + // "parameters":map[string]any{ + // "storageAccountType":map[string]any{ + // "type": "string", + // "allowedValues":[]any{ + // "Standard_LRS", + // "Standard_GRS", + // "Standard_ZRS", + // "Premium_LRS", + // }, + // "defaultValue": "Standard_LRS", + // "metadata":map[string]any{ + // "description": "Storage Account type", + // }, + // }, + // }, + // "resources":[]any{ + // map[string]any{ + // "name": "[variables('storageAccountName')]", + // "type": "Microsoft.Storage/storageAccounts", + // "apiVersion": "2016-01-01", + // "kind": "Storage", + // "location": "[resourceGroup().location]", + // "properties":map[string]any{ + // }, + // "sku":map[string]any{ + // "name": "[parameters('storageAccountType')]", + // }, + // }, + // }, + // "variables":map[string]any{ + // "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'standardsa')]", + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/PolicyAssignmentArtifact_Delete.json +func ExampleArtifactsClient_Delete_subPolicyAssignmentArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewArtifactsClient().Delete(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", "costCenterPolicy", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armblueprint.ArtifactsClientDeleteResponse{ + // ArtifactClassification: &armblueprint.PolicyAssignmentArtifact{ + // Name: to.Ptr("costCenterPolicy"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/costCenterPolicy"), + // Kind: to.Ptr(armblueprint.ArtifactKindPolicyAssignment), + // Properties: &armblueprint.PolicyAssignmentArtifactProperties{ + // DisplayName: to.Ptr("force costCenter tag on all resources"), + // Parameters: map[string]*armblueprint.ParameterValue{ + // "tagName": &armblueprint.ParameterValue{ + // Value: "costCenter", + // }, + // "tagValue": &armblueprint.ParameterValue{ + // Value: "[parameter('costCenter')]", + // }, + // }, + // PolicyDefinitionID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/RoleAssignmentArtifact_Delete.json +func ExampleArtifactsClient_Delete_subRoleAssignmentArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewArtifactsClient().Delete(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", "ownerAssignment", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armblueprint.ArtifactsClientDeleteResponse{ + // ArtifactClassification: &armblueprint.RoleAssignmentArtifact{ + // Name: to.Ptr("ownerAssignment"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/ownerAssignment"), + // Kind: to.Ptr(armblueprint.ArtifactKindRoleAssignment), + // Properties: &armblueprint.RoleAssignmentArtifactProperties{ + // DisplayName: to.Ptr("enforce owners of given subscription"), + // PrincipalIDs: "[parameters('owners')]", + // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/Artifact_List.json +func ExampleArtifactsClient_NewListPager_mgArtifactList() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewArtifactsClient().NewListPager("providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", 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.ArtifactList = armblueprint.ArtifactList{ + // Value: []armblueprint.ArtifactClassification{ + // &armblueprint.RoleAssignmentArtifact{ + // Name: to.Ptr("ownerAssignment"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/ownerAssignment"), + // Kind: to.Ptr(armblueprint.ArtifactKindRoleAssignment), + // Properties: &armblueprint.RoleAssignmentArtifactProperties{ + // DisplayName: to.Ptr("enforce owners of given subscription"), + // PrincipalIDs: "[parameters('owners')]", + // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7"), + // }, + // }, + // &armblueprint.PolicyAssignmentArtifact{ + // Name: to.Ptr("costCenterPolicy"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/costCenterPolicy"), + // Kind: to.Ptr(armblueprint.ArtifactKindPolicyAssignment), + // Properties: &armblueprint.PolicyAssignmentArtifactProperties{ + // DisplayName: to.Ptr("force costCenter tag on all resources"), + // Parameters: map[string]*armblueprint.ParameterValue{ + // "tagName": &armblueprint.ParameterValue{ + // Value: "costCenter", + // }, + // "tagValue": &armblueprint.ParameterValue{ + // Value: "[parameter('costCenter')]", + // }, + // }, + // PolicyDefinitionID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62"), + // }, + // }, + // &armblueprint.TemplateArtifact{ + // Name: to.Ptr("storageTemplate"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/storageTemplate"), + // Kind: to.Ptr(armblueprint.ArtifactKindTemplate), + // Properties: &armblueprint.TemplateArtifactProperties{ + // Parameters: map[string]*armblueprint.ParameterValue{ + // "storageAccountType": &armblueprint.ParameterValue{ + // Value: "[parameters('storageAccountType')]", + // }, + // }, + // ResourceGroup: to.Ptr("storageRG"), + // Template: map[string]any{ + // "contentVersion": "1.0.0.0", + // "outputs":map[string]any{ + // "storageAccountName":map[string]any{ + // "type": "string", + // "value": "[variables('storageAccountName')]", + // }, + // }, + // "parameters":map[string]any{ + // "storageAccountType":map[string]any{ + // "type": "string", + // "allowedValues":[]any{ + // "Standard_LRS", + // "Standard_GRS", + // "Standard_ZRS", + // "Premium_LRS", + // }, + // "defaultValue": "Standard_LRS", + // "metadata":map[string]any{ + // "description": "Storage Account type", + // }, + // }, + // }, + // "resources":[]any{ + // map[string]any{ + // "name": "[variables('storageAccountName')]", + // "type": "Microsoft.Storage/storageAccounts", + // "apiVersion": "2016-01-01", + // "kind": "Storage", + // "location": "[resourceGroup().location]", + // "properties":map[string]any{ + // }, + // "sku":map[string]any{ + // "name": "[parameters('storageAccountType')]", + // }, + // }, + // }, + // "variables":map[string]any{ + // "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'standardsa')]", + // }, + // }, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/Artifact_List.json +func ExampleArtifactsClient_NewListPager_subArtifactList() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewArtifactsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", 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.ArtifactList = armblueprint.ArtifactList{ + // Value: []armblueprint.ArtifactClassification{ + // &armblueprint.RoleAssignmentArtifact{ + // Name: to.Ptr("ownerAssignment"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/ownerAssignment"), + // Kind: to.Ptr(armblueprint.ArtifactKindRoleAssignment), + // Properties: &armblueprint.RoleAssignmentArtifactProperties{ + // DisplayName: to.Ptr("enforce owners of given subscription"), + // PrincipalIDs: "[parameters('owners')]", + // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7"), + // }, + // }, + // &armblueprint.PolicyAssignmentArtifact{ + // Name: to.Ptr("costCenterPolicy"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/costCenterPolicy"), + // Kind: to.Ptr(armblueprint.ArtifactKindPolicyAssignment), + // Properties: &armblueprint.PolicyAssignmentArtifactProperties{ + // DisplayName: to.Ptr("force costCenter tag on all resources"), + // Parameters: map[string]*armblueprint.ParameterValue{ + // "tagName": &armblueprint.ParameterValue{ + // Value: "costCenter", + // }, + // "tagValue": &armblueprint.ParameterValue{ + // Value: "[parameter('costCenter')]", + // }, + // }, + // PolicyDefinitionID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62"), + // }, + // }, + // &armblueprint.TemplateArtifact{ + // Name: to.Ptr("storageTemplate"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/storageTemplate"), + // Kind: to.Ptr(armblueprint.ArtifactKindTemplate), + // Properties: &armblueprint.TemplateArtifactProperties{ + // Parameters: map[string]*armblueprint.ParameterValue{ + // "storageAccountType": &armblueprint.ParameterValue{ + // Value: "[parameters('storageAccountType')]", + // }, + // }, + // ResourceGroup: to.Ptr("storageRG"), + // Template: map[string]any{ + // "contentVersion": "1.0.0.0", + // "outputs":map[string]any{ + // "storageAccountName":map[string]any{ + // "type": "string", + // "value": "[variables('storageAccountName')]", + // }, + // }, + // "parameters":map[string]any{ + // "storageAccountType":map[string]any{ + // "type": "string", + // "allowedValues":[]any{ + // "Standard_LRS", + // "Standard_GRS", + // "Standard_ZRS", + // "Premium_LRS", + // }, + // "defaultValue": "Standard_LRS", + // "metadata":map[string]any{ + // "description": "Storage Account type", + // }, + // }, + // }, + // "resources":[]any{ + // map[string]any{ + // "name": "[variables('storageAccountName')]", + // "type": "Microsoft.Storage/storageAccounts", + // "apiVersion": "2016-01-01", + // "kind": "Storage", + // "location": "[resourceGroup().location]", + // "properties":map[string]any{ + // }, + // "sku":map[string]any{ + // "name": "[parameters('storageAccountType')]", + // }, + // }, + // }, + // "variables":map[string]any{ + // "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'standardsa')]", + // }, + // }, + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_assignmentoperations_client.go b/sdk/resourcemanager/blueprint/armblueprint/assignmentoperations_client.go similarity index 78% rename from sdk/resourcemanager/blueprint/armblueprint/zz_generated_assignmentoperations_client.go rename to sdk/resourcemanager/blueprint/armblueprint/assignmentoperations_client.go index cfb94eba93ed..a2d72cf085f7 100644 --- a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_assignmentoperations_client.go +++ b/sdk/resourcemanager/blueprint/armblueprint/assignmentoperations_client.go @@ -5,6 +5,7 @@ // 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 armblueprint @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,47 +24,39 @@ import ( // AssignmentOperationsClient contains the methods for the AssignmentOperations group. // Don't use this type directly, use NewAssignmentOperationsClient() instead. type AssignmentOperationsClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewAssignmentOperationsClient creates a new instance of AssignmentOperationsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewAssignmentOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AssignmentOperationsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".AssignmentOperationsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &AssignmentOperationsClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // Get - Get a blueprint assignment operation. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-11-01-preview -// resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: '/subscriptions/{subscriptionId}'). -// assignmentName - Name of the blueprint assignment. -// assignmentOperationName - Name of the blueprint assignment operation. -// options - AssignmentOperationsClientGetOptions contains the optional parameters for the AssignmentOperationsClient.Get -// method. +// - resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), +// subscription (format: '/subscriptions/{subscriptionId}'). +// - assignmentName - Name of the blueprint assignment. +// - assignmentOperationName - Name of the blueprint assignment operation. +// - options - AssignmentOperationsClientGetOptions contains the optional parameters for the AssignmentOperationsClient.Get +// method. func (client *AssignmentOperationsClient) Get(ctx context.Context, resourceScope string, assignmentName string, assignmentOperationName string, options *AssignmentOperationsClientGetOptions) (AssignmentOperationsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceScope, assignmentName, assignmentOperationName, options) if err != nil { return AssignmentOperationsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AssignmentOperationsClientGetResponse{}, err } @@ -87,7 +78,7 @@ func (client *AssignmentOperationsClient) getCreateRequest(ctx context.Context, return nil, errors.New("parameter assignmentOperationName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{assignmentOperationName}", url.PathEscape(assignmentOperationName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -108,13 +99,13 @@ func (client *AssignmentOperationsClient) getHandleResponse(resp *http.Response) } // NewListPager - List operations for given blueprint assignment within a subscription or a management group. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-11-01-preview -// resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: '/subscriptions/{subscriptionId}'). -// assignmentName - Name of the blueprint assignment. -// options - AssignmentOperationsClientListOptions contains the optional parameters for the AssignmentOperationsClient.List -// method. +// - resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), +// subscription (format: '/subscriptions/{subscriptionId}'). +// - assignmentName - Name of the blueprint assignment. +// - options - AssignmentOperationsClientListOptions contains the optional parameters for the AssignmentOperationsClient.NewListPager +// method. func (client *AssignmentOperationsClient) NewListPager(resourceScope string, assignmentName string, options *AssignmentOperationsClientListOptions) *runtime.Pager[AssignmentOperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[AssignmentOperationsClientListResponse]{ More: func(page AssignmentOperationsClientListResponse) bool { @@ -131,7 +122,7 @@ func (client *AssignmentOperationsClient) NewListPager(resourceScope string, ass if err != nil { return AssignmentOperationsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AssignmentOperationsClientListResponse{}, err } @@ -151,7 +142,7 @@ func (client *AssignmentOperationsClient) listCreateRequest(ctx context.Context, return nil, errors.New("parameter assignmentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{assignmentName}", url.PathEscape(assignmentName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/blueprint/armblueprint/assignmentoperations_client_example_test.go b/sdk/resourcemanager/blueprint/armblueprint/assignmentoperations_client_example_test.go new file mode 100644 index 000000000000..eec8cb685504 --- /dev/null +++ b/sdk/resourcemanager/blueprint/armblueprint/assignmentoperations_client_example_test.go @@ -0,0 +1,250 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armblueprint_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/blueprint/armblueprint" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPAssignment/BlueprintAssignmentOperation_List.json +func ExampleAssignmentOperationsClient_NewListPager_assignmentAtManagementGroupScope() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAssignmentOperationsClient().NewListPager("managementGroups/ContosoOnlineGroup", "assignSimpleBlueprint", 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.AssignmentOperationList = armblueprint.AssignmentOperationList{ + // Value: []*armblueprint.AssignmentOperation{ + // { + // Name: to.Ptr("fb5d4dcb-7ce2-4087-ba7a-459aa74e5e0f"), + // Type: to.Ptr("microsoft.blueprint/blueprintAssignments/operations"), + // ID: to.Ptr("/managementGroups/ContosoOnlineGroup/providers/microsoft.blueprint/blueprintAssignments/assignSimpleBlueprint/assignmentOperations/fb5d4dcb-7ce2-4087-ba7a-459aa74e5e0f"), + // Properties: &armblueprint.AssignmentOperationProperties{ + // AssignmentState: to.Ptr("succeed"), + // BlueprintVersion: to.Ptr("v20181101"), + // Deployments: []*armblueprint.AssignmentDeploymentJob{ + // { + // Action: to.Ptr("put"), + // History: []*armblueprint.AssignmentDeploymentJobResult{ + // { + // Error: &armblueprint.AzureResourceManagerError{ + // Code: to.Ptr("dummy"), + // Message: to.Ptr("dummy"), + // }, + // }}, + // JobState: to.Ptr("succeeded"), + // Kind: to.Ptr("azureResource"), + // RequestURI: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.deployments/deployments/48432786-2f1b-4925-8032-a5d57bcb5b6e"), + // Result: &armblueprint.AssignmentDeploymentJobResult{ + // Resources: []*armblueprint.AssignmentJobCreatedResource{ + // { + // Name: to.Ptr("foobar"), + // Type: to.Ptr("foo/bar"), + // ID: to.Ptr("blabla"), + // }}, + // }, + // }}, + // TimeCreated: to.Ptr("2018-11-13T15:19:45-08:00"), + // TimeFinished: to.Ptr("2018-11-13T15:26:02-08:00"), + // TimeStarted: to.Ptr("2018-11-13T15:21:49-08:00"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPAssignment/BlueprintAssignmentOperation_List.json +func ExampleAssignmentOperationsClient_NewListPager_assignmentAtSubscriptionScope() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAssignmentOperationsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", "assignSimpleBlueprint", 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.AssignmentOperationList = armblueprint.AssignmentOperationList{ + // Value: []*armblueprint.AssignmentOperation{ + // { + // Name: to.Ptr("fb5d4dcb-7ce2-4087-ba7a-459aa74e5e0f"), + // Type: to.Ptr("microsoft.blueprint/blueprintAssignments/operations"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.blueprint/blueprintAssignments/assignSimpleBlueprint/assignmentOperations/fb5d4dcb-7ce2-4087-ba7a-459aa74e5e0f"), + // Properties: &armblueprint.AssignmentOperationProperties{ + // AssignmentState: to.Ptr("succeed"), + // BlueprintVersion: to.Ptr("v20181101"), + // Deployments: []*armblueprint.AssignmentDeploymentJob{ + // { + // Action: to.Ptr("put"), + // History: []*armblueprint.AssignmentDeploymentJobResult{ + // { + // Error: &armblueprint.AzureResourceManagerError{ + // Code: to.Ptr("dummy"), + // Message: to.Ptr("dummy"), + // }, + // }}, + // JobState: to.Ptr("succeeded"), + // Kind: to.Ptr("azureResource"), + // RequestURI: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.deployments/deployments/48432786-2f1b-4925-8032-a5d57bcb5b6e"), + // Result: &armblueprint.AssignmentDeploymentJobResult{ + // Resources: []*armblueprint.AssignmentJobCreatedResource{ + // { + // Name: to.Ptr("foobar"), + // Type: to.Ptr("foo/bar"), + // ID: to.Ptr("blabla"), + // }}, + // }, + // }}, + // TimeCreated: to.Ptr("2018-11-13T15:19:45-08:00"), + // TimeFinished: to.Ptr("2018-11-13T15:26:02-08:00"), + // TimeStarted: to.Ptr("2018-11-13T15:21:49-08:00"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPAssignment/BlueprintAssignmentOperation_Get.json +func ExampleAssignmentOperationsClient_Get_assignmentAtManagementGroupScope() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAssignmentOperationsClient().Get(ctx, "managementGroups/ContosoOnlineGroup", "assignSimpleBlueprint", "fb5d4dcb-7ce2-4087-ba7a-459aa74e5e0f", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AssignmentOperation = armblueprint.AssignmentOperation{ + // Name: to.Ptr("fb5d4dcb-7ce2-4087-ba7a-459aa74e5e0f"), + // Type: to.Ptr("microsoft.blueprint/blueprintAssignments/operations"), + // ID: to.Ptr("/managementGroups/ContosoOnlineGroup/providers/microsoft.blueprint/blueprintAssignments/assignSimpleBlueprint/assignmentOperations/fb5d4dcb-7ce2-4087-ba7a-459aa74e5e0f"), + // Properties: &armblueprint.AssignmentOperationProperties{ + // AssignmentState: to.Ptr("succeed"), + // BlueprintVersion: to.Ptr("v20181101"), + // Deployments: []*armblueprint.AssignmentDeploymentJob{ + // { + // Action: to.Ptr("put"), + // History: []*armblueprint.AssignmentDeploymentJobResult{ + // { + // Error: &armblueprint.AzureResourceManagerError{ + // Code: to.Ptr("dummy"), + // Message: to.Ptr("dummy"), + // }, + // }}, + // JobState: to.Ptr("succeeded"), + // Kind: to.Ptr("azureResource"), + // RequestURI: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.deployments/deployments/48432786-2f1b-4925-8032-a5d57bcb5b6e"), + // Result: &armblueprint.AssignmentDeploymentJobResult{ + // Resources: []*armblueprint.AssignmentJobCreatedResource{ + // { + // Name: to.Ptr("foobar"), + // Type: to.Ptr("foo/bar"), + // ID: to.Ptr("blabla"), + // }}, + // }, + // }}, + // TimeCreated: to.Ptr("2018-11-13T15:19:45-08:00"), + // TimeFinished: to.Ptr("2018-11-13T15:26:02-08:00"), + // TimeStarted: to.Ptr("2018-11-13T15:21:49-08:00"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPAssignment/BlueprintAssignmentOperation_Get.json +func ExampleAssignmentOperationsClient_Get_assignmentAtSubscriptionScope() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAssignmentOperationsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "assignSimpleBlueprint", "fb5d4dcb-7ce2-4087-ba7a-459aa74e5e0f", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AssignmentOperation = armblueprint.AssignmentOperation{ + // Name: to.Ptr("fb5d4dcb-7ce2-4087-ba7a-459aa74e5e0f"), + // Type: to.Ptr("microsoft.blueprint/blueprintAssignments/operations"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.blueprint/blueprintAssignments/assignSimpleBlueprint/assignmentOperations/fb5d4dcb-7ce2-4087-ba7a-459aa74e5e0f"), + // Properties: &armblueprint.AssignmentOperationProperties{ + // AssignmentState: to.Ptr("succeed"), + // BlueprintVersion: to.Ptr("v20181101"), + // Deployments: []*armblueprint.AssignmentDeploymentJob{ + // { + // Action: to.Ptr("put"), + // History: []*armblueprint.AssignmentDeploymentJobResult{ + // { + // Error: &armblueprint.AzureResourceManagerError{ + // Code: to.Ptr("dummy"), + // Message: to.Ptr("dummy"), + // }, + // }}, + // JobState: to.Ptr("succeeded"), + // Kind: to.Ptr("azureResource"), + // RequestURI: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.deployments/deployments/48432786-2f1b-4925-8032-a5d57bcb5b6e"), + // Result: &armblueprint.AssignmentDeploymentJobResult{ + // Resources: []*armblueprint.AssignmentJobCreatedResource{ + // { + // Name: to.Ptr("foobar"), + // Type: to.Ptr("foo/bar"), + // ID: to.Ptr("blabla"), + // }}, + // }, + // }}, + // TimeCreated: to.Ptr("2018-11-13T15:19:45-08:00"), + // TimeFinished: to.Ptr("2018-11-13T15:26:02-08:00"), + // TimeStarted: to.Ptr("2018-11-13T15:21:49-08:00"), + // }, + // } +} diff --git a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_assignments_client.go b/sdk/resourcemanager/blueprint/armblueprint/assignments_client.go similarity index 79% rename from sdk/resourcemanager/blueprint/armblueprint/zz_generated_assignments_client.go rename to sdk/resourcemanager/blueprint/armblueprint/assignments_client.go index dbadee726195..b26ddb4bedb8 100644 --- a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_assignments_client.go +++ b/sdk/resourcemanager/blueprint/armblueprint/assignments_client.go @@ -5,6 +5,7 @@ // 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 armblueprint @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,47 +24,39 @@ import ( // AssignmentsClient contains the methods for the Assignments group. // Don't use this type directly, use NewAssignmentsClient() instead. type AssignmentsClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewAssignmentsClient creates a new instance of AssignmentsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewAssignmentsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AssignmentsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".AssignmentsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &AssignmentsClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // CreateOrUpdate - Create or update a blueprint assignment. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-11-01-preview -// resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: '/subscriptions/{subscriptionId}'). -// assignmentName - Name of the blueprint assignment. -// assignment - Blueprint assignment object to save. -// options - AssignmentsClientCreateOrUpdateOptions contains the optional parameters for the AssignmentsClient.CreateOrUpdate -// method. +// - resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), +// subscription (format: '/subscriptions/{subscriptionId}'). +// - assignmentName - Name of the blueprint assignment. +// - assignment - Blueprint assignment object to save. +// - options - AssignmentsClientCreateOrUpdateOptions contains the optional parameters for the AssignmentsClient.CreateOrUpdate +// method. func (client *AssignmentsClient) CreateOrUpdate(ctx context.Context, resourceScope string, assignmentName string, assignment Assignment, options *AssignmentsClientCreateOrUpdateOptions) (AssignmentsClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceScope, assignmentName, assignment, options) if err != nil { return AssignmentsClientCreateOrUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AssignmentsClientCreateOrUpdateResponse{}, err } @@ -83,7 +74,7 @@ func (client *AssignmentsClient) createOrUpdateCreateRequest(ctx context.Context return nil, errors.New("parameter assignmentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{assignmentName}", url.PathEscape(assignmentName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -105,17 +96,18 @@ func (client *AssignmentsClient) createOrUpdateHandleResponse(resp *http.Respons // Delete - Delete a blueprint assignment. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-11-01-preview -// resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: '/subscriptions/{subscriptionId}'). -// assignmentName - Name of the blueprint assignment. -// options - AssignmentsClientDeleteOptions contains the optional parameters for the AssignmentsClient.Delete method. +// - resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), +// subscription (format: '/subscriptions/{subscriptionId}'). +// - assignmentName - Name of the blueprint assignment. +// - options - AssignmentsClientDeleteOptions contains the optional parameters for the AssignmentsClient.Delete method. func (client *AssignmentsClient) Delete(ctx context.Context, resourceScope string, assignmentName string, options *AssignmentsClientDeleteOptions) (AssignmentsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceScope, assignmentName, options) if err != nil { return AssignmentsClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AssignmentsClientDeleteResponse{}, err } @@ -133,7 +125,7 @@ func (client *AssignmentsClient) deleteCreateRequest(ctx context.Context, resour return nil, errors.New("parameter assignmentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{assignmentName}", url.PathEscape(assignmentName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -158,17 +150,18 @@ func (client *AssignmentsClient) deleteHandleResponse(resp *http.Response) (Assi // Get - Get a blueprint assignment. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-11-01-preview -// resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: '/subscriptions/{subscriptionId}'). -// assignmentName - Name of the blueprint assignment. -// options - AssignmentsClientGetOptions contains the optional parameters for the AssignmentsClient.Get method. +// - resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), +// subscription (format: '/subscriptions/{subscriptionId}'). +// - assignmentName - Name of the blueprint assignment. +// - options - AssignmentsClientGetOptions contains the optional parameters for the AssignmentsClient.Get method. func (client *AssignmentsClient) Get(ctx context.Context, resourceScope string, assignmentName string, options *AssignmentsClientGetOptions) (AssignmentsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceScope, assignmentName, options) if err != nil { return AssignmentsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AssignmentsClientGetResponse{}, err } @@ -186,7 +179,7 @@ func (client *AssignmentsClient) getCreateRequest(ctx context.Context, resourceS return nil, errors.New("parameter assignmentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{assignmentName}", url.PathEscape(assignmentName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -207,11 +200,11 @@ func (client *AssignmentsClient) getHandleResponse(resp *http.Response) (Assignm } // NewListPager - List blueprint assignments within a subscription or a management group. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-11-01-preview -// resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: '/subscriptions/{subscriptionId}'). -// options - AssignmentsClientListOptions contains the optional parameters for the AssignmentsClient.List method. +// - resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), +// subscription (format: '/subscriptions/{subscriptionId}'). +// - options - AssignmentsClientListOptions contains the optional parameters for the AssignmentsClient.NewListPager method. func (client *AssignmentsClient) NewListPager(resourceScope string, options *AssignmentsClientListOptions) *runtime.Pager[AssignmentsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[AssignmentsClientListResponse]{ More: func(page AssignmentsClientListResponse) bool { @@ -228,7 +221,7 @@ func (client *AssignmentsClient) NewListPager(resourceScope string, options *Ass if err != nil { return AssignmentsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AssignmentsClientListResponse{}, err } @@ -244,7 +237,7 @@ func (client *AssignmentsClient) NewListPager(resourceScope string, options *Ass func (client *AssignmentsClient) listCreateRequest(ctx context.Context, resourceScope string, options *AssignmentsClientListOptions) (*policy.Request, error) { urlPath := "/{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments" urlPath = strings.ReplaceAll(urlPath, "{resourceScope}", resourceScope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -266,18 +259,19 @@ func (client *AssignmentsClient) listHandleResponse(resp *http.Response) (Assign // WhoIsBlueprint - Get Blueprints service SPN objectId // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-11-01-preview -// resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: '/subscriptions/{subscriptionId}'). -// assignmentName - Name of the blueprint assignment. -// options - AssignmentsClientWhoIsBlueprintOptions contains the optional parameters for the AssignmentsClient.WhoIsBlueprint -// method. +// - resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), +// subscription (format: '/subscriptions/{subscriptionId}'). +// - assignmentName - Name of the blueprint assignment. +// - options - AssignmentsClientWhoIsBlueprintOptions contains the optional parameters for the AssignmentsClient.WhoIsBlueprint +// method. func (client *AssignmentsClient) WhoIsBlueprint(ctx context.Context, resourceScope string, assignmentName string, options *AssignmentsClientWhoIsBlueprintOptions) (AssignmentsClientWhoIsBlueprintResponse, error) { req, err := client.whoIsBlueprintCreateRequest(ctx, resourceScope, assignmentName, options) if err != nil { return AssignmentsClientWhoIsBlueprintResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AssignmentsClientWhoIsBlueprintResponse{}, err } @@ -295,7 +289,7 @@ func (client *AssignmentsClient) whoIsBlueprintCreateRequest(ctx context.Context return nil, errors.New("parameter assignmentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{assignmentName}", url.PathEscape(assignmentName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/blueprint/armblueprint/assignments_client_example_test.go b/sdk/resourcemanager/blueprint/armblueprint/assignments_client_example_test.go new file mode 100644 index 000000000000..2b95d439a70c --- /dev/null +++ b/sdk/resourcemanager/blueprint/armblueprint/assignments_client_example_test.go @@ -0,0 +1,567 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armblueprint_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/blueprint/armblueprint" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPAssignment/BlueprintAssignment_Create_SystemAssignedMSI.json +func ExampleAssignmentsClient_CreateOrUpdate_assignmentWithSystemAssignedManagedIdentityAtManagementGroupScope() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewAssignmentsClient().CreateOrUpdate(ctx, "managementGroups/ContosoOnlineGroup", "assignSimpleBlueprint", armblueprint.Assignment{ + Location: to.Ptr("eastus"), + Identity: &armblueprint.ManagedServiceIdentity{ + Type: to.Ptr(armblueprint.ManagedServiceIdentityTypeSystemAssigned), + }, + Properties: &armblueprint.AssignmentProperties{ + Description: to.Ptr("enforce pre-defined simpleBlueprint to this XXXXXXXX subscription."), + BlueprintID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"), + Parameters: map[string]*armblueprint.ParameterValue{ + "costCenter": { + Value: "Contoso/Online/Shopping/Production", + }, + "owners": { + Value: []any{ + "johnDoe@contoso.com", + "johnsteam@contoso.com", + }, + }, + "storageAccountType": { + Value: "Standard_LRS", + }, + }, + ResourceGroups: map[string]*armblueprint.ResourceGroupValue{ + "storageRG": { + Name: to.Ptr("defaultRG"), + Location: to.Ptr("eastus"), + }, + }, + Scope: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPAssignment/BlueprintAssignment_Create_SystemAssignedMSI.json +func ExampleAssignmentsClient_CreateOrUpdate_assignmentWithSystemAssignedManagedIdentityAtSubscriptionScope() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewAssignmentsClient().CreateOrUpdate(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "assignSimpleBlueprint", armblueprint.Assignment{ + Location: to.Ptr("eastus"), + Identity: &armblueprint.ManagedServiceIdentity{ + Type: to.Ptr(armblueprint.ManagedServiceIdentityTypeSystemAssigned), + }, + Properties: &armblueprint.AssignmentProperties{ + Description: to.Ptr("enforce pre-defined simpleBlueprint to this XXXXXXXX subscription."), + BlueprintID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"), + Parameters: map[string]*armblueprint.ParameterValue{ + "costCenter": { + Value: "Contoso/Online/Shopping/Production", + }, + "owners": { + Value: []any{ + "johnDoe@contoso.com", + "johnsteam@contoso.com", + }, + }, + "storageAccountType": { + Value: "Standard_LRS", + }, + }, + ResourceGroups: map[string]*armblueprint.ResourceGroupValue{ + "storageRG": { + Name: to.Ptr("defaultRG"), + Location: to.Ptr("eastus"), + }, + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPAssignment/BlueprintAssignment_Create_UserAssignedMSI.json +func ExampleAssignmentsClient_CreateOrUpdate_assignmentWithUserAssignedManagedIdentityAtManagementGroupScope() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewAssignmentsClient().CreateOrUpdate(ctx, "managementGroups/ContosoOnlineGroup", "assignSimpleBlueprint", armblueprint.Assignment{ + Location: to.Ptr("eastus"), + Identity: &armblueprint.ManagedServiceIdentity{ + Type: to.Ptr(armblueprint.ManagedServiceIdentityTypeUserAssigned), + UserAssignedIdentities: map[string]*armblueprint.UserAssignedIdentity{ + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": {}, + }, + }, + Properties: &armblueprint.AssignmentProperties{ + Description: to.Ptr("enforce pre-defined simpleBlueprint to this XXXXXXXX subscription."), + BlueprintID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"), + Parameters: map[string]*armblueprint.ParameterValue{ + "costCenter": { + Value: "Contoso/Online/Shopping/Production", + }, + "owners": { + Value: []any{ + "johnDoe@contoso.com", + "johnsteam@contoso.com", + }, + }, + "storageAccountType": { + Value: "Standard_LRS", + }, + }, + ResourceGroups: map[string]*armblueprint.ResourceGroupValue{ + "storageRG": { + Name: to.Ptr("defaultRG"), + Location: to.Ptr("eastus"), + }, + }, + Scope: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPAssignment/BlueprintAssignment_Create_UserAssignedMSI.json +func ExampleAssignmentsClient_CreateOrUpdate_assignmentWithUserAssignedManagedIdentityAtSubscriptionScope() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewAssignmentsClient().CreateOrUpdate(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "assignSimpleBlueprint", armblueprint.Assignment{ + Location: to.Ptr("eastus"), + Identity: &armblueprint.ManagedServiceIdentity{ + Type: to.Ptr(armblueprint.ManagedServiceIdentityTypeUserAssigned), + UserAssignedIdentities: map[string]*armblueprint.UserAssignedIdentity{ + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": {}, + }, + }, + Properties: &armblueprint.AssignmentProperties{ + Description: to.Ptr("enforce pre-defined simpleBlueprint to this XXXXXXXX subscription."), + BlueprintID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"), + Parameters: map[string]*armblueprint.ParameterValue{ + "costCenter": { + Value: "Contoso/Online/Shopping/Production", + }, + "owners": { + Value: []any{ + "johnDoe@contoso.com", + "johnsteam@contoso.com", + }, + }, + "storageAccountType": { + Value: "Standard_LRS", + }, + }, + ResourceGroups: map[string]*armblueprint.ResourceGroupValue{ + "storageRG": { + Name: to.Ptr("defaultRG"), + Location: to.Ptr("eastus"), + }, + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPAssignment/BlueprintAssignment_Get.json +func ExampleAssignmentsClient_Get_assignmentAtManagementGroupScope() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAssignmentsClient().Get(ctx, "managementGroups/ContosoOnlineGroup", "assignSimpleBlueprint", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Assignment = armblueprint.Assignment{ + // Name: to.Ptr("assignSimpleBlueprint"), + // Type: to.Ptr("Microsoft.Blueprint/Assignment"), + // ID: to.Ptr("/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprintAssignments/assignSimpleBlueprint"), + // Location: to.Ptr("eastus"), + // Identity: &armblueprint.ManagedServiceIdentity{ + // Type: to.Ptr(armblueprint.ManagedServiceIdentityTypeSystemAssigned), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // Properties: &armblueprint.AssignmentProperties{ + // Description: to.Ptr("enforce pre-defined simpleBlueprint to this XXXXXXXX subscription."), + // BlueprintID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"), + // Parameters: map[string]*armblueprint.ParameterValue{ + // "costCenter": &armblueprint.ParameterValue{ + // Value: "Contoso/Online/Shopping/Production", + // }, + // "owners": &armblueprint.ParameterValue{ + // Value: []any{ + // "johnDoe@contoso.com", + // "johnsteam@contoso.com", + // }, + // }, + // "storageAccountType": &armblueprint.ParameterValue{ + // Value: "Standard_LRS", + // }, + // }, + // ProvisioningState: to.Ptr(armblueprint.AssignmentProvisioningState("Succeeded")), + // ResourceGroups: map[string]*armblueprint.ResourceGroupValue{ + // "storageRG": &armblueprint.ResourceGroupValue{ + // Name: to.Ptr("defaultRG"), + // Location: to.Ptr("eastus"), + // }, + // }, + // Scope: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPAssignment/BlueprintAssignment_Get.json +func ExampleAssignmentsClient_Get_assignmentAtSubscriptionScope() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAssignmentsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "assignSimpleBlueprint", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Assignment = armblueprint.Assignment{ + // Name: to.Ptr("assignSimpleBlueprint"), + // Type: to.Ptr("Microsoft.Blueprint/Assignment"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprintAssignments/assignSimpleBlueprint"), + // Location: to.Ptr("eastus"), + // Identity: &armblueprint.ManagedServiceIdentity{ + // Type: to.Ptr(armblueprint.ManagedServiceIdentityTypeSystemAssigned), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // Properties: &armblueprint.AssignmentProperties{ + // Description: to.Ptr("enforce pre-defined simpleBlueprint to this XXXXXXXX subscription."), + // BlueprintID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"), + // Parameters: map[string]*armblueprint.ParameterValue{ + // "costCenter": &armblueprint.ParameterValue{ + // Value: "Contoso/Online/Shopping/Production", + // }, + // "owners": &armblueprint.ParameterValue{ + // Value: []any{ + // "johnDoe@contoso.com", + // "johnsteam@contoso.com", + // }, + // }, + // "storageAccountType": &armblueprint.ParameterValue{ + // Value: "Standard_LRS", + // }, + // }, + // ProvisioningState: to.Ptr(armblueprint.AssignmentProvisioningState("Succeeded")), + // ResourceGroups: map[string]*armblueprint.ResourceGroupValue{ + // "storageRG": &armblueprint.ResourceGroupValue{ + // Name: to.Ptr("defaultRG"), + // Location: to.Ptr("eastus"), + // }, + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPAssignment/BlueprintAssignment_Delete.json +func ExampleAssignmentsClient_Delete_assignmentDeleteAtManagementGroupScope() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewAssignmentsClient().Delete(ctx, "managementGroups/ContosoOnlineGroup", "assignSimpleBlueprint", &armblueprint.AssignmentsClientDeleteOptions{DeleteBehavior: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPAssignment/BlueprintAssignment_Delete_AndDeleteChildren.json +func ExampleAssignmentsClient_Delete_assignmentDeleteAtManagementGroupScopeAndDeleteTheResourcesCreatedByTheAssignment() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewAssignmentsClient().Delete(ctx, "managementGroups/ContosoOnlineGroup", "assignSimpleBlueprint", &armblueprint.AssignmentsClientDeleteOptions{DeleteBehavior: to.Ptr(armblueprint.AssignmentDeleteBehaviorAll)}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPAssignment/BlueprintAssignment_Delete.json +func ExampleAssignmentsClient_Delete_assignmentDeleteAtSubscriptionScope() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewAssignmentsClient().Delete(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "assignSimpleBlueprint", &armblueprint.AssignmentsClientDeleteOptions{DeleteBehavior: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPAssignment/BlueprintAssignment_Delete_AndDeleteChildren.json +func ExampleAssignmentsClient_Delete_assignmentDeleteAtSubscriptionScopeAndDeleteTheResourcesCreatedByTheAssignment() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewAssignmentsClient().Delete(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "assignSimpleBlueprint", &armblueprint.AssignmentsClientDeleteOptions{DeleteBehavior: to.Ptr(armblueprint.AssignmentDeleteBehaviorAll)}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPAssignment/WhoIsBlueprint_Action.json +func ExampleAssignmentsClient_WhoIsBlueprint_whoIsBlueprintActionAtManagementGroupScope() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAssignmentsClient().WhoIsBlueprint(ctx, "managementGroups/ContosoOnlineGroup", "assignSimpleBlueprint", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.WhoIsBlueprintContract = armblueprint.WhoIsBlueprintContract{ + // ObjectID: to.Ptr("00000000-1111-0000-1111-000000000000"), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPAssignment/WhoIsBlueprint_Action.json +func ExampleAssignmentsClient_WhoIsBlueprint_whoIsBlueprintActionAtSubscriptionScope() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAssignmentsClient().WhoIsBlueprint(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "assignSimpleBlueprint", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.WhoIsBlueprintContract = armblueprint.WhoIsBlueprintContract{ + // ObjectID: to.Ptr("00000000-1111-0000-1111-000000000000"), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPAssignment/BlueprintAssignment_List.json +func ExampleAssignmentsClient_NewListPager_assignmentAtManagementGroupScope() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAssignmentsClient().NewListPager("managementGroups/ContosoOnlineGroup", 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.AssignmentList = armblueprint.AssignmentList{ + // Value: []*armblueprint.Assignment{ + // { + // Name: to.Ptr("assignSimpleBlueprint"), + // Type: to.Ptr("Microsoft.Blueprint/Assignment"), + // ID: to.Ptr("/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprintAssignments/assignSimpleBlueprint"), + // Location: to.Ptr("eastus"), + // Identity: &armblueprint.ManagedServiceIdentity{ + // Type: to.Ptr(armblueprint.ManagedServiceIdentityTypeSystemAssigned), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // Properties: &armblueprint.AssignmentProperties{ + // Description: to.Ptr("enforce pre-defined simpleBlueprint to this XXXXXXXX subscription."), + // BlueprintID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"), + // Parameters: map[string]*armblueprint.ParameterValue{ + // "costCenter": &armblueprint.ParameterValue{ + // Value: "Contoso/Online/Shopping/Production", + // }, + // "owners": &armblueprint.ParameterValue{ + // Value: []any{ + // "johnDoe@contoso.com", + // "johnsteam@contoso.com", + // }, + // }, + // "storageAccountType": &armblueprint.ParameterValue{ + // Value: "Standard_LRS", + // }, + // }, + // ProvisioningState: to.Ptr(armblueprint.AssignmentProvisioningState("Succeeded")), + // ResourceGroups: map[string]*armblueprint.ResourceGroupValue{ + // "storageRG": &armblueprint.ResourceGroupValue{ + // Name: to.Ptr("defaultRG"), + // Location: to.Ptr("eastus"), + // }, + // }, + // Scope: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPAssignment/BlueprintAssignment_List.json +func ExampleAssignmentsClient_NewListPager_assignmentAtSubscriptionScope() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAssignmentsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", 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.AssignmentList = armblueprint.AssignmentList{ + // Value: []*armblueprint.Assignment{ + // { + // Name: to.Ptr("assignSimpleBlueprint"), + // Type: to.Ptr("Microsoft.Blueprint/Assignment"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprintAssignments/assignSimpleBlueprint"), + // Location: to.Ptr("eastus"), + // Identity: &armblueprint.ManagedServiceIdentity{ + // Type: to.Ptr(armblueprint.ManagedServiceIdentityTypeSystemAssigned), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // Properties: &armblueprint.AssignmentProperties{ + // Description: to.Ptr("enforce pre-defined simpleBlueprint to this XXXXXXXX subscription."), + // BlueprintID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"), + // Parameters: map[string]*armblueprint.ParameterValue{ + // "costCenter": &armblueprint.ParameterValue{ + // Value: "Contoso/Online/Shopping/Production", + // }, + // "owners": &armblueprint.ParameterValue{ + // Value: []any{ + // "johnDoe@contoso.com", + // "johnsteam@contoso.com", + // }, + // }, + // "storageAccountType": &armblueprint.ParameterValue{ + // Value: "Standard_LRS", + // }, + // }, + // ProvisioningState: to.Ptr(armblueprint.AssignmentProvisioningState("Succeeded")), + // ResourceGroups: map[string]*armblueprint.ResourceGroupValue{ + // "storageRG": &armblueprint.ResourceGroupValue{ + // Name: to.Ptr("defaultRG"), + // Location: to.Ptr("eastus"), + // }, + // }, + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/blueprint/armblueprint/autorest.md b/sdk/resourcemanager/blueprint/armblueprint/autorest.md index 56e3a2a514d5..30d01c8ce36a 100644 --- a/sdk/resourcemanager/blueprint/armblueprint/autorest.md +++ b/sdk/resourcemanager/blueprint/armblueprint/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/blueprint/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/blueprint/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.5.0 +module-version: 0.6.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_blueprints_client.go b/sdk/resourcemanager/blueprint/armblueprint/blueprints_client.go similarity index 78% rename from sdk/resourcemanager/blueprint/armblueprint/zz_generated_blueprints_client.go rename to sdk/resourcemanager/blueprint/armblueprint/blueprints_client.go index ceb794a3c7dd..0e100696e771 100644 --- a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_blueprints_client.go +++ b/sdk/resourcemanager/blueprint/armblueprint/blueprints_client.go @@ -5,6 +5,7 @@ // 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 armblueprint @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,47 +24,39 @@ import ( // BlueprintsClient contains the methods for the Blueprints group. // Don't use this type directly, use NewBlueprintsClient() instead. type BlueprintsClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewBlueprintsClient creates a new instance of BlueprintsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewBlueprintsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*BlueprintsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".BlueprintsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &BlueprintsClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // CreateOrUpdate - Create or update a blueprint definition. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-11-01-preview -// resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: '/subscriptions/{subscriptionId}'). -// blueprintName - Name of the blueprint definition. -// blueprint - Blueprint definition. -// options - BlueprintsClientCreateOrUpdateOptions contains the optional parameters for the BlueprintsClient.CreateOrUpdate -// method. +// - resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), +// subscription (format: '/subscriptions/{subscriptionId}'). +// - blueprintName - Name of the blueprint definition. +// - blueprint - Blueprint definition. +// - options - BlueprintsClientCreateOrUpdateOptions contains the optional parameters for the BlueprintsClient.CreateOrUpdate +// method. func (client *BlueprintsClient) CreateOrUpdate(ctx context.Context, resourceScope string, blueprintName string, blueprint Blueprint, options *BlueprintsClientCreateOrUpdateOptions) (BlueprintsClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceScope, blueprintName, blueprint, options) if err != nil { return BlueprintsClientCreateOrUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlueprintsClientCreateOrUpdateResponse{}, err } @@ -83,7 +74,7 @@ func (client *BlueprintsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, errors.New("parameter blueprintName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{blueprintName}", url.PathEscape(blueprintName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -105,17 +96,18 @@ func (client *BlueprintsClient) createOrUpdateHandleResponse(resp *http.Response // Delete - Delete a blueprint definition. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-11-01-preview -// resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: '/subscriptions/{subscriptionId}'). -// blueprintName - Name of the blueprint definition. -// options - BlueprintsClientDeleteOptions contains the optional parameters for the BlueprintsClient.Delete method. +// - resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), +// subscription (format: '/subscriptions/{subscriptionId}'). +// - blueprintName - Name of the blueprint definition. +// - options - BlueprintsClientDeleteOptions contains the optional parameters for the BlueprintsClient.Delete method. func (client *BlueprintsClient) Delete(ctx context.Context, resourceScope string, blueprintName string, options *BlueprintsClientDeleteOptions) (BlueprintsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceScope, blueprintName, options) if err != nil { return BlueprintsClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlueprintsClientDeleteResponse{}, err } @@ -133,7 +125,7 @@ func (client *BlueprintsClient) deleteCreateRequest(ctx context.Context, resourc return nil, errors.New("parameter blueprintName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{blueprintName}", url.PathEscape(blueprintName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -155,17 +147,18 @@ func (client *BlueprintsClient) deleteHandleResponse(resp *http.Response) (Bluep // Get - Get a blueprint definition. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-11-01-preview -// resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: '/subscriptions/{subscriptionId}'). -// blueprintName - Name of the blueprint definition. -// options - BlueprintsClientGetOptions contains the optional parameters for the BlueprintsClient.Get method. +// - resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), +// subscription (format: '/subscriptions/{subscriptionId}'). +// - blueprintName - Name of the blueprint definition. +// - options - BlueprintsClientGetOptions contains the optional parameters for the BlueprintsClient.Get method. func (client *BlueprintsClient) Get(ctx context.Context, resourceScope string, blueprintName string, options *BlueprintsClientGetOptions) (BlueprintsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceScope, blueprintName, options) if err != nil { return BlueprintsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlueprintsClientGetResponse{}, err } @@ -183,7 +176,7 @@ func (client *BlueprintsClient) getCreateRequest(ctx context.Context, resourceSc return nil, errors.New("parameter blueprintName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{blueprintName}", url.PathEscape(blueprintName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -204,11 +197,11 @@ func (client *BlueprintsClient) getHandleResponse(resp *http.Response) (Blueprin } // NewListPager - List blueprint definitions. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-11-01-preview -// resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: '/subscriptions/{subscriptionId}'). -// options - BlueprintsClientListOptions contains the optional parameters for the BlueprintsClient.List method. +// - resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), +// subscription (format: '/subscriptions/{subscriptionId}'). +// - options - BlueprintsClientListOptions contains the optional parameters for the BlueprintsClient.NewListPager method. func (client *BlueprintsClient) NewListPager(resourceScope string, options *BlueprintsClientListOptions) *runtime.Pager[BlueprintsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[BlueprintsClientListResponse]{ More: func(page BlueprintsClientListResponse) bool { @@ -225,7 +218,7 @@ func (client *BlueprintsClient) NewListPager(resourceScope string, options *Blue if err != nil { return BlueprintsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BlueprintsClientListResponse{}, err } @@ -241,7 +234,7 @@ func (client *BlueprintsClient) NewListPager(resourceScope string, options *Blue func (client *BlueprintsClient) listCreateRequest(ctx context.Context, resourceScope string, options *BlueprintsClientListOptions) (*policy.Request, error) { urlPath := "/{resourceScope}/providers/Microsoft.Blueprint/blueprints" urlPath = strings.ReplaceAll(urlPath, "{resourceScope}", resourceScope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/blueprint/armblueprint/blueprints_client_example_test.go b/sdk/resourcemanager/blueprint/armblueprint/blueprints_client_example_test.go new file mode 100644 index 000000000000..0cd3e5e185fe --- /dev/null +++ b/sdk/resourcemanager/blueprint/armblueprint/blueprints_client_example_test.go @@ -0,0 +1,512 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armblueprint_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/blueprint/armblueprint" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/Blueprint_Create.json +func ExampleBlueprintsClient_CreateOrUpdate_managementGroupBlueprint() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewBlueprintsClient().CreateOrUpdate(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", armblueprint.Blueprint{ + Properties: &armblueprint.Properties{ + Description: to.Ptr("blueprint contains all artifact kinds {'template', 'rbac', 'policy'}"), + Parameters: map[string]*armblueprint.ParameterDefinition{ + "costCenter": { + Type: to.Ptr(armblueprint.TemplateParameterTypeString), + Metadata: &armblueprint.ParameterDefinitionMetadata{ + DisplayName: to.Ptr("force cost center tag for all resources under given subscription."), + }, + }, + "owners": { + Type: to.Ptr(armblueprint.TemplateParameterTypeArray), + Metadata: &armblueprint.ParameterDefinitionMetadata{ + DisplayName: to.Ptr("assign owners to subscription along with blueprint assignment."), + }, + }, + "storageAccountType": { + Type: to.Ptr(armblueprint.TemplateParameterTypeString), + Metadata: &armblueprint.ParameterDefinitionMetadata{ + DisplayName: to.Ptr("storage account type."), + }, + }, + }, + ResourceGroups: map[string]*armblueprint.ResourceGroupDefinition{ + "storageRG": { + Metadata: &armblueprint.ParameterDefinitionMetadata{ + Description: to.Ptr("Contains storageAccounts that collect all shoebox logs."), + DisplayName: to.Ptr("storage resource group"), + }, + }, + }, + TargetScope: to.Ptr(armblueprint.BlueprintTargetScopeSubscription), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/ResourceGroupWithTags.json +func ExampleBlueprintsClient_CreateOrUpdate_resourceGroupWithTags() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewBlueprintsClient().CreateOrUpdate(ctx, "providers/Microsoft.Management/managementGroups/{ManagementGroupId}", "simpleBlueprint", armblueprint.Blueprint{ + Properties: &armblueprint.Properties{ + Description: to.Ptr("An example blueprint containing an RG with two tags."), + ResourceGroups: map[string]*armblueprint.ResourceGroupDefinition{ + "myRGName": { + Name: to.Ptr("myRGName"), + Location: to.Ptr("westus"), + Metadata: &armblueprint.ParameterDefinitionMetadata{ + DisplayName: to.Ptr("My Resource Group"), + }, + Tags: map[string]*string{ + "costcenter": to.Ptr("123456"), + "nameOnlyTag": to.Ptr(""), + }, + }, + }, + TargetScope: to.Ptr(armblueprint.BlueprintTargetScopeSubscription), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/Blueprint_Create.json +func ExampleBlueprintsClient_CreateOrUpdate_subscriptionBlueprint() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewBlueprintsClient().CreateOrUpdate(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", armblueprint.Blueprint{ + Properties: &armblueprint.Properties{ + Description: to.Ptr("blueprint contains all artifact kinds {'template', 'rbac', 'policy'}"), + Parameters: map[string]*armblueprint.ParameterDefinition{ + "costCenter": { + Type: to.Ptr(armblueprint.TemplateParameterTypeString), + Metadata: &armblueprint.ParameterDefinitionMetadata{ + DisplayName: to.Ptr("force cost center tag for all resources under given subscription."), + }, + }, + "owners": { + Type: to.Ptr(armblueprint.TemplateParameterTypeArray), + Metadata: &armblueprint.ParameterDefinitionMetadata{ + DisplayName: to.Ptr("assign owners to subscription along with blueprint assignment."), + }, + }, + "storageAccountType": { + Type: to.Ptr(armblueprint.TemplateParameterTypeString), + Metadata: &armblueprint.ParameterDefinitionMetadata{ + DisplayName: to.Ptr("storage account type."), + }, + }, + }, + ResourceGroups: map[string]*armblueprint.ResourceGroupDefinition{ + "storageRG": { + Metadata: &armblueprint.ParameterDefinitionMetadata{ + Description: to.Ptr("Contains storageAccounts that collect all shoebox logs."), + DisplayName: to.Ptr("storage resource group"), + }, + }, + }, + TargetScope: to.Ptr(armblueprint.BlueprintTargetScopeSubscription), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/Blueprint_Get.json +func ExampleBlueprintsClient_Get_managementGroupBlueprint() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewBlueprintsClient().Get(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Blueprint = armblueprint.Blueprint{ + // Name: to.Ptr("simpleBlueprint"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"), + // Properties: &armblueprint.Properties{ + // Description: to.Ptr("blueprint contains all artifact kinds {'template', 'rbac', 'policy'}"), + // Parameters: map[string]*armblueprint.ParameterDefinition{ + // "costCenter": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("force cost center tag for all resources under given subscription."), + // }, + // }, + // "owners": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeArray), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("assign owners to subscription along with blueprint assignment."), + // }, + // }, + // "storageAccountType": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("storage account type."), + // }, + // }, + // }, + // ResourceGroups: map[string]*armblueprint.ResourceGroupDefinition{ + // "storageRG": &armblueprint.ResourceGroupDefinition{ + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // Description: to.Ptr("Contains storageAccounts that collect all shoebox logs."), + // DisplayName: to.Ptr("storage resource group"), + // }, + // }, + // }, + // TargetScope: to.Ptr(armblueprint.BlueprintTargetScopeSubscription), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/Blueprint_Get.json +func ExampleBlueprintsClient_Get_subscriptionBlueprint() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewBlueprintsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Blueprint = armblueprint.Blueprint{ + // Name: to.Ptr("simpleBlueprint"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"), + // Properties: &armblueprint.Properties{ + // Description: to.Ptr("blueprint contains all artifact kinds {'template', 'rbac', 'policy'}"), + // Parameters: map[string]*armblueprint.ParameterDefinition{ + // "costCenter": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("force cost center tag for all resources under given subscription."), + // }, + // }, + // "owners": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeArray), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("assign owners to subscription along with blueprint assignment."), + // }, + // }, + // "storageAccountType": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("storage account type."), + // }, + // }, + // }, + // ResourceGroups: map[string]*armblueprint.ResourceGroupDefinition{ + // "storageRG": &armblueprint.ResourceGroupDefinition{ + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // Description: to.Ptr("Contains storageAccounts that collect all shoebox logs."), + // DisplayName: to.Ptr("storage resource group"), + // }, + // }, + // }, + // TargetScope: to.Ptr(armblueprint.BlueprintTargetScopeSubscription), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/Blueprint_Delete.json +func ExampleBlueprintsClient_Delete_managementGroupBlueprint() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewBlueprintsClient().Delete(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Blueprint = armblueprint.Blueprint{ + // Name: to.Ptr("simpleBlueprint"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"), + // Properties: &armblueprint.Properties{ + // Description: to.Ptr("blueprint contains all artifact kinds {'template', 'rbac', 'policy'}"), + // Parameters: map[string]*armblueprint.ParameterDefinition{ + // "costCenter": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("force cost center tag for all resources under given subscription."), + // }, + // }, + // "owners": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeArray), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("assign owners to subscription along with blueprint assignment."), + // }, + // }, + // "storageAccountType": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("storage account type."), + // }, + // }, + // }, + // ResourceGroups: map[string]*armblueprint.ResourceGroupDefinition{ + // "storageRG": &armblueprint.ResourceGroupDefinition{ + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // Description: to.Ptr("Contains storageAccounts that collect all shoebox logs."), + // DisplayName: to.Ptr("storage resource group"), + // }, + // }, + // }, + // TargetScope: to.Ptr(armblueprint.BlueprintTargetScopeSubscription), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/Blueprint_Delete.json +func ExampleBlueprintsClient_Delete_subscriptionBlueprint() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewBlueprintsClient().Delete(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Blueprint = armblueprint.Blueprint{ + // Name: to.Ptr("simpleBlueprint"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"), + // Properties: &armblueprint.Properties{ + // Description: to.Ptr("blueprint contains all artifact kinds {'template', 'rbac', 'policy'}"), + // Parameters: map[string]*armblueprint.ParameterDefinition{ + // "costCenter": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("force cost center tag for all resources under given subscription."), + // }, + // }, + // "owners": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeArray), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("assign owners to subscription along with blueprint assignment."), + // }, + // }, + // "storageAccountType": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("storage account type."), + // }, + // }, + // }, + // ResourceGroups: map[string]*armblueprint.ResourceGroupDefinition{ + // "storageRG": &armblueprint.ResourceGroupDefinition{ + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // Description: to.Ptr("Contains storageAccounts that collect all shoebox logs."), + // DisplayName: to.Ptr("storage resource group"), + // }, + // }, + // }, + // TargetScope: to.Ptr(armblueprint.BlueprintTargetScopeSubscription), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/Blueprint_List.json +func ExampleBlueprintsClient_NewListPager_managementGroupBlueprint() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewBlueprintsClient().NewListPager("providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", 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.List = armblueprint.List{ + // Value: []*armblueprint.Blueprint{ + // { + // Name: to.Ptr("simpleBlueprint"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"), + // Properties: &armblueprint.Properties{ + // Description: to.Ptr("blueprint contains all artifact kinds {'template', 'rbac', 'policy'}"), + // Parameters: map[string]*armblueprint.ParameterDefinition{ + // "costCenter": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("force cost center tag for all resources under given subscription."), + // }, + // }, + // "owners": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeArray), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("assign owners to subscription along with blueprint assignment."), + // }, + // }, + // "storageAccountType": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("storage account type."), + // }, + // }, + // }, + // ResourceGroups: map[string]*armblueprint.ResourceGroupDefinition{ + // "storageRG": &armblueprint.ResourceGroupDefinition{ + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // Description: to.Ptr("Contains storageAccounts that collect all shoebox logs."), + // DisplayName: to.Ptr("storage resource group"), + // }, + // }, + // }, + // TargetScope: to.Ptr(armblueprint.BlueprintTargetScopeSubscription), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/Blueprint_List.json +func ExampleBlueprintsClient_NewListPager_subscriptionBlueprint() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewBlueprintsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", 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.List = armblueprint.List{ + // Value: []*armblueprint.Blueprint{ + // { + // Name: to.Ptr("simpleBlueprint"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"), + // Properties: &armblueprint.Properties{ + // Description: to.Ptr("blueprint contains all artifact kinds {'template', 'rbac', 'policy'}"), + // Parameters: map[string]*armblueprint.ParameterDefinition{ + // "costCenter": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("force cost center tag for all resources under given subscription."), + // }, + // }, + // "owners": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeArray), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("assign owners to subscription along with blueprint assignment."), + // }, + // }, + // "storageAccountType": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("storage account type."), + // }, + // }, + // }, + // ResourceGroups: map[string]*armblueprint.ResourceGroupDefinition{ + // "storageRG": &armblueprint.ResourceGroupDefinition{ + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // Description: to.Ptr("Contains storageAccounts that collect all shoebox logs."), + // DisplayName: to.Ptr("storage resource group"), + // }, + // }, + // }, + // TargetScope: to.Ptr(armblueprint.BlueprintTargetScopeSubscription), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/blueprint/armblueprint/client_factory.go b/sdk/resourcemanager/blueprint/armblueprint/client_factory.go new file mode 100644 index 000000000000..49097af03b28 --- /dev/null +++ b/sdk/resourcemanager/blueprint/armblueprint/client_factory.go @@ -0,0 +1,67 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armblueprint + +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 { + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + credential: credential, + options: options.Clone(), + }, nil +} + +func (c *ClientFactory) NewBlueprintsClient() *BlueprintsClient { + subClient, _ := NewBlueprintsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewArtifactsClient() *ArtifactsClient { + subClient, _ := NewArtifactsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPublishedBlueprintsClient() *PublishedBlueprintsClient { + subClient, _ := NewPublishedBlueprintsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPublishedArtifactsClient() *PublishedArtifactsClient { + subClient, _ := NewPublishedArtifactsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAssignmentsClient() *AssignmentsClient { + subClient, _ := NewAssignmentsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAssignmentOperationsClient() *AssignmentOperationsClient { + subClient, _ := NewAssignmentOperationsClient(c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_constants.go b/sdk/resourcemanager/blueprint/armblueprint/constants.go similarity index 99% rename from sdk/resourcemanager/blueprint/armblueprint/zz_generated_constants.go rename to sdk/resourcemanager/blueprint/armblueprint/constants.go index 3a0bd04c359d..9ce88f13ae06 100644 --- a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_constants.go +++ b/sdk/resourcemanager/blueprint/armblueprint/constants.go @@ -5,12 +5,13 @@ // 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 armblueprint const ( moduleName = "armblueprint" - moduleVersion = "v0.5.0" + moduleVersion = "v0.6.0" ) // ArtifactKind - Specifies the kind of blueprint artifact. diff --git a/sdk/resourcemanager/blueprint/armblueprint/go.mod b/sdk/resourcemanager/blueprint/armblueprint/go.mod index b58f6af37145..2593082f2a32 100644 --- a/sdk/resourcemanager/blueprint/armblueprint/go.mod +++ b/sdk/resourcemanager/blueprint/armblueprint/go.mod @@ -3,19 +3,19 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/blueprint/armbluepr go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect + github.com/golang-jwt/jwt/v4 v4.5.0 // indirect + github.com/google/uuid v1.3.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect - golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect - golang.org/x/text v0.3.7 // indirect + github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect + golang.org/x/crypto v0.6.0 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect ) diff --git a/sdk/resourcemanager/blueprint/armblueprint/go.sum b/sdk/resourcemanager/blueprint/armblueprint/go.sum index ed5b814680ee..8ba445a8c4da 100644 --- a/sdk/resourcemanager/blueprint/armblueprint/go.sum +++ b/sdk/resourcemanager/blueprint/armblueprint/go.sum @@ -1,33 +1,31 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= +github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.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/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= +golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= diff --git a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_models.go b/sdk/resourcemanager/blueprint/armblueprint/models.go similarity index 92% rename from sdk/resourcemanager/blueprint/armblueprint/zz_generated_models.go rename to sdk/resourcemanager/blueprint/armblueprint/models.go index 9656ff6730c0..181ff2e96506 100644 --- a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_models.go +++ b/sdk/resourcemanager/blueprint/armblueprint/models.go @@ -5,6 +5,7 @@ // 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 armblueprint @@ -46,12 +47,6 @@ type ArtifactList struct { NextLink *string `json:"nextLink,omitempty" azure:"ro"` } -// ArtifactPropertiesBase - Common properties shared by different artifacts. -type ArtifactPropertiesBase struct { - // Artifacts which need to be deployed before the specified artifact. - DependsOn []*string `json:"dependsOn,omitempty"` -} - // ArtifactsClientCreateOrUpdateOptions contains the optional parameters for the ArtifactsClient.CreateOrUpdate method. type ArtifactsClientCreateOrUpdateOptions struct { // placeholder for future optional parameters @@ -67,7 +62,7 @@ type ArtifactsClientGetOptions struct { // placeholder for future optional parameters } -// ArtifactsClientListOptions contains the optional parameters for the ArtifactsClient.List method. +// ArtifactsClientListOptions contains the optional parameters for the ArtifactsClient.NewListPager method. type ArtifactsClientListOptions struct { // placeholder for future optional parameters } @@ -217,7 +212,8 @@ type AssignmentOperationsClientGetOptions struct { // placeholder for future optional parameters } -// AssignmentOperationsClientListOptions contains the optional parameters for the AssignmentOperationsClient.List method. +// AssignmentOperationsClientListOptions contains the optional parameters for the AssignmentOperationsClient.NewListPager +// method. type AssignmentOperationsClientListOptions struct { // placeholder for future optional parameters } @@ -281,7 +277,7 @@ type AssignmentsClientGetOptions struct { // placeholder for future optional parameters } -// AssignmentsClientListOptions contains the optional parameters for the AssignmentsClient.List method. +// AssignmentsClientListOptions contains the optional parameters for the AssignmentsClient.NewListPager method. type AssignmentsClientListOptions struct { // placeholder for future optional parameters } @@ -342,21 +338,15 @@ type BlueprintsClientGetOptions struct { // placeholder for future optional parameters } -// BlueprintsClientListOptions contains the optional parameters for the BlueprintsClient.List method. +// BlueprintsClientListOptions contains the optional parameters for the BlueprintsClient.NewListPager method. type BlueprintsClientListOptions struct { // placeholder for future optional parameters } -type CloudError struct { - // Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows - // the OData error response format.) - Error *ErrorResponse `json:"error,omitempty"` -} - // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty" azure:"ro"` + Info any `json:"info,omitempty" azure:"ro"` // READ-ONLY; The additional info type. Type *string `json:"type,omitempty" azure:"ro"` @@ -418,10 +408,10 @@ type ParameterDefinition struct { Type *TemplateParameterType `json:"type,omitempty"` // Array of allowed values for this parameter. - AllowedValues []interface{} `json:"allowedValues,omitempty"` + AllowedValues []any `json:"allowedValues,omitempty"` // Default Value for this parameter. - DefaultValue interface{} `json:"defaultValue,omitempty"` + DefaultValue any `json:"defaultValue,omitempty"` // User-friendly properties for this parameter. Metadata *ParameterDefinitionMetadata `json:"metadata,omitempty"` @@ -446,7 +436,7 @@ type ParameterValue struct { Reference *SecretValueReference `json:"reference,omitempty"` // Parameter value. Any valid JSON value is allowed including objects, arrays, strings, numbers and booleans. - Value interface{} `json:"value,omitempty"` + Value any `json:"value,omitempty"` } // PolicyAssignmentArtifact - Blueprint artifact that applies a Policy assignment. @@ -516,10 +506,10 @@ type Properties struct { TargetScope *BlueprintTargetScope `json:"targetScope,omitempty"` // Published versions of this blueprint definition. - Versions interface{} `json:"versions,omitempty"` + Versions any `json:"versions,omitempty"` // READ-ONLY; Layout view of the blueprint definition for UI reference. - Layout interface{} `json:"layout,omitempty" azure:"ro"` + Layout any `json:"layout,omitempty" azure:"ro"` // READ-ONLY; Status of the blueprint. This field is readonly. Status *Status `json:"status,omitempty" azure:"ro"` @@ -530,7 +520,7 @@ type PublishedArtifactsClientGetOptions struct { // placeholder for future optional parameters } -// PublishedArtifactsClientListOptions contains the optional parameters for the PublishedArtifactsClient.List method. +// PublishedArtifactsClientListOptions contains the optional parameters for the PublishedArtifactsClient.NewListPager method. type PublishedArtifactsClientListOptions struct { // placeholder for future optional parameters } @@ -602,7 +592,7 @@ type PublishedBlueprintsClientGetOptions struct { // placeholder for future optional parameters } -// PublishedBlueprintsClientListOptions contains the optional parameters for the PublishedBlueprintsClient.List method. +// PublishedBlueprintsClientListOptions contains the optional parameters for the PublishedBlueprintsClient.NewListPager method. type PublishedBlueprintsClientListOptions struct { // placeholder for future optional parameters } @@ -634,15 +624,6 @@ type ResourceGroupValue struct { Name *string `json:"name,omitempty"` } -// ResourcePropertiesBase - Shared properties between all blueprint resources. -type ResourcePropertiesBase struct { - // Multi-line explain this resource. - Description *string `json:"description,omitempty"` - - // One-liner string explain this resource. - DisplayName *string `json:"displayName,omitempty"` -} - // ResourceProviderOperation - Supported operations of this resource provider. type ResourceProviderOperation struct { // Display metadata associated with the operation. @@ -713,7 +694,7 @@ func (r *RoleAssignmentArtifact) GetArtifact() *Artifact { // RoleAssignmentArtifactProperties - Properties of a Role assignment blueprint artifact. type RoleAssignmentArtifactProperties struct { // REQUIRED; Array of user or group identities in Azure Active Directory. The roleDefinition will apply to each identity. - PrincipalIDs interface{} `json:"principalIds,omitempty"` + PrincipalIDs any `json:"principalIds,omitempty"` // REQUIRED; Azure resource ID of the RoleDefinition. RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` @@ -743,27 +724,6 @@ type SecretValueReference struct { SecretVersion *string `json:"secretVersion,omitempty"` } -// SharedBlueprintProperties - Shared Schema for both blueprintProperties and publishedBlueprintProperties. -type SharedBlueprintProperties struct { - // Multi-line explain this resource. - Description *string `json:"description,omitempty"` - - // One-liner string explain this resource. - DisplayName *string `json:"displayName,omitempty"` - - // Parameters required by this blueprint definition. - Parameters map[string]*ParameterDefinition `json:"parameters,omitempty"` - - // Resource group placeholders defined by this blueprint definition. - ResourceGroups map[string]*ResourceGroupDefinition `json:"resourceGroups,omitempty"` - - // The scope where this blueprint definition can be assigned. - TargetScope *BlueprintTargetScope `json:"targetScope,omitempty"` - - // READ-ONLY; Status of the blueprint. This field is readonly. - Status *Status `json:"status,omitempty" azure:"ro"` -} - // Status - The status of the blueprint. This field is readonly. type Status struct { // READ-ONLY; Last modified time of this blueprint definition. @@ -807,7 +767,7 @@ type TemplateArtifactProperties struct { Parameters map[string]*ParameterValue `json:"parameters,omitempty"` // REQUIRED; The Resource Manager template blueprint artifact body. - Template interface{} `json:"template,omitempty"` + Template any `json:"template,omitempty"` // Artifacts which need to be deployed before the specified artifact. DependsOn []*string `json:"dependsOn,omitempty"` diff --git a/sdk/resourcemanager/blueprint/armblueprint/models_serde.go b/sdk/resourcemanager/blueprint/armblueprint/models_serde.go new file mode 100644 index 000000000000..a3f57e2561dd --- /dev/null +++ b/sdk/resourcemanager/blueprint/armblueprint/models_serde.go @@ -0,0 +1,1748 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armblueprint + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Artifact. +func (a Artifact) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + objectMap["kind"] = a.Kind + populate(objectMap, "name", a.Name) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Artifact. +func (a *Artifact) UnmarshalJSON(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 "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + 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 ArtifactList. +func (a ArtifactList) 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 ArtifactList. +func (a *ArtifactList) UnmarshalJSON(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": + a.Value, err = unmarshalArtifactClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Assignment. +func (a Assignment) 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, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Assignment. +func (a *Assignment) UnmarshalJSON(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 "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 AssignmentDeploymentJob. +func (a AssignmentDeploymentJob) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "action", a.Action) + populate(objectMap, "history", a.History) + populate(objectMap, "jobId", a.JobID) + populate(objectMap, "jobState", a.JobState) + populate(objectMap, "kind", a.Kind) + populate(objectMap, "requestUri", a.RequestURI) + populate(objectMap, "result", a.Result) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentDeploymentJob. +func (a *AssignmentDeploymentJob) UnmarshalJSON(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 "action": + err = unpopulate(val, "Action", &a.Action) + delete(rawMsg, key) + case "history": + err = unpopulate(val, "History", &a.History) + delete(rawMsg, key) + case "jobId": + err = unpopulate(val, "JobID", &a.JobID) + delete(rawMsg, key) + case "jobState": + err = unpopulate(val, "JobState", &a.JobState) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "requestUri": + err = unpopulate(val, "RequestURI", &a.RequestURI) + delete(rawMsg, key) + case "result": + err = unpopulate(val, "Result", &a.Result) + 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 AssignmentDeploymentJobResult. +func (a AssignmentDeploymentJobResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", a.Error) + populate(objectMap, "resources", a.Resources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentDeploymentJobResult. +func (a *AssignmentDeploymentJobResult) UnmarshalJSON(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 "error": + err = unpopulate(val, "Error", &a.Error) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &a.Resources) + 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 AssignmentJobCreatedResource. +func (a AssignmentJobCreatedResource) 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, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentJobCreatedResource. +func (a *AssignmentJobCreatedResource) UnmarshalJSON(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 "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 AssignmentList. +func (a AssignmentList) 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 AssignmentList. +func (a *AssignmentList) UnmarshalJSON(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 AssignmentLockSettings. +func (a AssignmentLockSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "excludedActions", a.ExcludedActions) + populate(objectMap, "excludedPrincipals", a.ExcludedPrincipals) + populate(objectMap, "mode", a.Mode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentLockSettings. +func (a *AssignmentLockSettings) UnmarshalJSON(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 "excludedActions": + err = unpopulate(val, "ExcludedActions", &a.ExcludedActions) + delete(rawMsg, key) + case "excludedPrincipals": + err = unpopulate(val, "ExcludedPrincipals", &a.ExcludedPrincipals) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, "Mode", &a.Mode) + 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 AssignmentOperation. +func (a AssignmentOperation) 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, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentOperation. +func (a *AssignmentOperation) UnmarshalJSON(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 "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 AssignmentOperationList. +func (a AssignmentOperationList) 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 AssignmentOperationList. +func (a *AssignmentOperationList) UnmarshalJSON(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 AssignmentOperationProperties. +func (a AssignmentOperationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "assignmentState", a.AssignmentState) + populate(objectMap, "blueprintVersion", a.BlueprintVersion) + populate(objectMap, "deployments", a.Deployments) + populate(objectMap, "timeCreated", a.TimeCreated) + populate(objectMap, "timeFinished", a.TimeFinished) + populate(objectMap, "timeStarted", a.TimeStarted) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentOperationProperties. +func (a *AssignmentOperationProperties) UnmarshalJSON(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 "assignmentState": + err = unpopulate(val, "AssignmentState", &a.AssignmentState) + delete(rawMsg, key) + case "blueprintVersion": + err = unpopulate(val, "BlueprintVersion", &a.BlueprintVersion) + delete(rawMsg, key) + case "deployments": + err = unpopulate(val, "Deployments", &a.Deployments) + delete(rawMsg, key) + case "timeCreated": + err = unpopulate(val, "TimeCreated", &a.TimeCreated) + delete(rawMsg, key) + case "timeFinished": + err = unpopulate(val, "TimeFinished", &a.TimeFinished) + delete(rawMsg, key) + case "timeStarted": + err = unpopulate(val, "TimeStarted", &a.TimeStarted) + 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 AssignmentProperties. +func (a AssignmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blueprintId", a.BlueprintID) + populate(objectMap, "description", a.Description) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "locks", a.Locks) + populate(objectMap, "parameters", a.Parameters) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "resourceGroups", a.ResourceGroups) + populate(objectMap, "scope", a.Scope) + populate(objectMap, "status", a.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentProperties. +func (a *AssignmentProperties) UnmarshalJSON(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 "blueprintId": + err = unpopulate(val, "BlueprintID", &a.BlueprintID) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "locks": + err = unpopulate(val, "Locks", &a.Locks) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, "Parameters", &a.Parameters) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "resourceGroups": + err = unpopulate(val, "ResourceGroups", &a.ResourceGroups) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &a.Scope) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + 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 AssignmentStatus. +func (a AssignmentStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "lastModified", a.LastModified) + populate(objectMap, "managedResources", a.ManagedResources) + populateTimeRFC3339(objectMap, "timeCreated", a.TimeCreated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentStatus. +func (a *AssignmentStatus) UnmarshalJSON(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 "lastModified": + err = unpopulateTimeRFC3339(val, "LastModified", &a.LastModified) + delete(rawMsg, key) + case "managedResources": + err = unpopulate(val, "ManagedResources", &a.ManagedResources) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateTimeRFC3339(val, "TimeCreated", &a.TimeCreated) + 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 AzureResourceBase. +func (a AzureResourceBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceBase. +func (a *AzureResourceBase) UnmarshalJSON(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 "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 AzureResourceManagerError. +func (a AzureResourceManagerError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", a.Code) + populate(objectMap, "message", a.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceManagerError. +func (a *AzureResourceManagerError) UnmarshalJSON(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 "code": + err = unpopulate(val, "Code", &a.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &a.Message) + 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 Blueprint. +func (b Blueprint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", b.ID) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Blueprint. +func (b *Blueprint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "info", &e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type 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 "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyVaultReference. +func (k KeyVaultReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", k.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultReference. +func (k *KeyVaultReference) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &k.ID) + 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 List. +func (l List) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type List. +func (l *List) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, 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 ParameterDefinition. +func (p ParameterDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowedValues", p.AllowedValues) + populate(objectMap, "defaultValue", &p.DefaultValue) + populate(objectMap, "metadata", p.Metadata) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ParameterDefinition. +func (p *ParameterDefinition) UnmarshalJSON(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 "allowedValues": + err = unpopulate(val, "AllowedValues", &p.AllowedValues) + delete(rawMsg, key) + case "defaultValue": + err = unpopulate(val, "DefaultValue", &p.DefaultValue) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &p.Metadata) + 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 ParameterDefinitionMetadata. +func (p ParameterDefinitionMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", p.Description) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "strongType", p.StrongType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ParameterDefinitionMetadata. +func (p *ParameterDefinitionMetadata) UnmarshalJSON(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 "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "strongType": + err = unpopulate(val, "StrongType", &p.StrongType) + 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 ParameterValue. +func (p ParameterValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "reference", p.Reference) + populate(objectMap, "value", &p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ParameterValue. +func (p *ParameterValue) UnmarshalJSON(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 "reference": + err = unpopulate(val, "Reference", &p.Reference) + 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 PolicyAssignmentArtifact. +func (p PolicyAssignmentArtifact) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + objectMap["kind"] = ArtifactKindPolicyAssignment + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyAssignmentArtifact. +func (p *PolicyAssignmentArtifact) UnmarshalJSON(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 "kind": + err = unpopulate(val, "Kind", &p.Kind) + 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 "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 PolicyAssignmentArtifactProperties. +func (p PolicyAssignmentArtifactProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dependsOn", p.DependsOn) + populate(objectMap, "description", p.Description) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "parameters", p.Parameters) + populate(objectMap, "policyDefinitionId", p.PolicyDefinitionID) + populate(objectMap, "resourceGroup", p.ResourceGroup) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyAssignmentArtifactProperties. +func (p *PolicyAssignmentArtifactProperties) UnmarshalJSON(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 "dependsOn": + err = unpopulate(val, "DependsOn", &p.DependsOn) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, "Parameters", &p.Parameters) + delete(rawMsg, key) + case "policyDefinitionId": + err = unpopulate(val, "PolicyDefinitionID", &p.PolicyDefinitionID) + delete(rawMsg, key) + case "resourceGroup": + err = unpopulate(val, "ResourceGroup", &p.ResourceGroup) + 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 Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", p.Description) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "layout", &p.Layout) + populate(objectMap, "parameters", p.Parameters) + populate(objectMap, "resourceGroups", p.ResourceGroups) + populate(objectMap, "status", p.Status) + populate(objectMap, "targetScope", p.TargetScope) + populate(objectMap, "versions", &p.Versions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Properties. +func (p *Properties) UnmarshalJSON(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 "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "layout": + err = unpopulate(val, "Layout", &p.Layout) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, "Parameters", &p.Parameters) + delete(rawMsg, key) + case "resourceGroups": + err = unpopulate(val, "ResourceGroups", &p.ResourceGroups) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + case "targetScope": + err = unpopulate(val, "TargetScope", &p.TargetScope) + delete(rawMsg, key) + case "versions": + err = unpopulate(val, "Versions", &p.Versions) + 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 PublishedBlueprint. +func (p PublishedBlueprint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublishedBlueprint. +func (p *PublishedBlueprint) UnmarshalJSON(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 "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 PublishedBlueprintList. +func (p PublishedBlueprintList) 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 PublishedBlueprintList. +func (p *PublishedBlueprintList) UnmarshalJSON(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 PublishedBlueprintProperties. +func (p PublishedBlueprintProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blueprintName", p.BlueprintName) + populate(objectMap, "changeNotes", p.ChangeNotes) + populate(objectMap, "description", p.Description) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "parameters", p.Parameters) + populate(objectMap, "resourceGroups", p.ResourceGroups) + populate(objectMap, "status", p.Status) + populate(objectMap, "targetScope", p.TargetScope) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublishedBlueprintProperties. +func (p *PublishedBlueprintProperties) UnmarshalJSON(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 "blueprintName": + err = unpopulate(val, "BlueprintName", &p.BlueprintName) + delete(rawMsg, key) + case "changeNotes": + err = unpopulate(val, "ChangeNotes", &p.ChangeNotes) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, "Parameters", &p.Parameters) + delete(rawMsg, key) + case "resourceGroups": + err = unpopulate(val, "ResourceGroups", &p.ResourceGroups) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + case "targetScope": + err = unpopulate(val, "TargetScope", &p.TargetScope) + 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 ResourceGroupDefinition. +func (r ResourceGroupDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dependsOn", r.DependsOn) + populate(objectMap, "location", r.Location) + populate(objectMap, "metadata", r.Metadata) + populate(objectMap, "name", r.Name) + populate(objectMap, "tags", r.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGroupDefinition. +func (r *ResourceGroupDefinition) UnmarshalJSON(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 "dependsOn": + err = unpopulate(val, "DependsOn", &r.DependsOn) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &r.Metadata) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + 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 ResourceGroupValue. +func (r ResourceGroupValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGroupValue. +func (r *ResourceGroupValue) UnmarshalJSON(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 "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + 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 ResourceProviderOperation. +func (r ResourceProviderOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "display", r.Display) + populate(objectMap, "name", r.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceProviderOperation. +func (r *ResourceProviderOperation) UnmarshalJSON(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 "display": + err = unpopulate(val, "Display", &r.Display) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + 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 ResourceProviderOperationDisplay. +func (r ResourceProviderOperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", r.Description) + populate(objectMap, "operation", r.Operation) + populate(objectMap, "provider", r.Provider) + populate(objectMap, "resource", r.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceProviderOperationDisplay. +func (r *ResourceProviderOperationDisplay) UnmarshalJSON(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 "description": + err = unpopulate(val, "Description", &r.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &r.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &r.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &r.Resource) + 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 ResourceProviderOperationList. +func (r ResourceProviderOperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceProviderOperationList. +func (r *ResourceProviderOperationList) UnmarshalJSON(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 "value": + err = unpopulate(val, "Value", &r.Value) + 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 ResourceStatusBase. +func (r ResourceStatusBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "lastModified", r.LastModified) + populateTimeRFC3339(objectMap, "timeCreated", r.TimeCreated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceStatusBase. +func (r *ResourceStatusBase) UnmarshalJSON(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 "lastModified": + err = unpopulateTimeRFC3339(val, "LastModified", &r.LastModified) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateTimeRFC3339(val, "TimeCreated", &r.TimeCreated) + 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 RoleAssignmentArtifact. +func (r RoleAssignmentArtifact) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + objectMap["kind"] = ArtifactKindRoleAssignment + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentArtifact. +func (r *RoleAssignmentArtifact) UnmarshalJSON(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 "kind": + err = unpopulate(val, "Kind", &r.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + 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 RoleAssignmentArtifactProperties. +func (r RoleAssignmentArtifactProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dependsOn", r.DependsOn) + populate(objectMap, "description", r.Description) + populate(objectMap, "displayName", r.DisplayName) + populate(objectMap, "principalIds", &r.PrincipalIDs) + populate(objectMap, "resourceGroup", r.ResourceGroup) + populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentArtifactProperties. +func (r *RoleAssignmentArtifactProperties) UnmarshalJSON(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 "dependsOn": + err = unpopulate(val, "DependsOn", &r.DependsOn) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &r.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &r.DisplayName) + delete(rawMsg, key) + case "principalIds": + err = unpopulate(val, "PrincipalIDs", &r.PrincipalIDs) + delete(rawMsg, key) + case "resourceGroup": + err = unpopulate(val, "ResourceGroup", &r.ResourceGroup) + delete(rawMsg, key) + case "roleDefinitionId": + err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) + 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 SecretValueReference. +func (s SecretValueReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "keyVault", s.KeyVault) + populate(objectMap, "secretName", s.SecretName) + populate(objectMap, "secretVersion", s.SecretVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretValueReference. +func (s *SecretValueReference) UnmarshalJSON(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 "keyVault": + err = unpopulate(val, "KeyVault", &s.KeyVault) + delete(rawMsg, key) + case "secretName": + err = unpopulate(val, "SecretName", &s.SecretName) + delete(rawMsg, key) + case "secretVersion": + err = unpopulate(val, "SecretVersion", &s.SecretVersion) + 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 Status. +func (s Status) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "lastModified", s.LastModified) + populateTimeRFC3339(objectMap, "timeCreated", s.TimeCreated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Status. +func (s *Status) UnmarshalJSON(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 "lastModified": + err = unpopulateTimeRFC3339(val, "LastModified", &s.LastModified) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateTimeRFC3339(val, "TimeCreated", &s.TimeCreated) + 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 TemplateArtifact. +func (t TemplateArtifact) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + objectMap["kind"] = ArtifactKindTemplate + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TemplateArtifact. +func (t *TemplateArtifact) UnmarshalJSON(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 "kind": + err = unpopulate(val, "Kind", &t.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "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 TemplateArtifactProperties. +func (t TemplateArtifactProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dependsOn", t.DependsOn) + populate(objectMap, "description", t.Description) + populate(objectMap, "displayName", t.DisplayName) + populate(objectMap, "parameters", t.Parameters) + populate(objectMap, "resourceGroup", t.ResourceGroup) + populate(objectMap, "template", &t.Template) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TemplateArtifactProperties. +func (t *TemplateArtifactProperties) UnmarshalJSON(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 "dependsOn": + err = unpopulate(val, "DependsOn", &t.DependsOn) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &t.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &t.DisplayName) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, "Parameters", &t.Parameters) + delete(rawMsg, key) + case "resourceGroup": + err = unpopulate(val, "ResourceGroup", &t.ResourceGroup) + delete(rawMsg, key) + case "template": + err = unpopulate(val, "Template", &t.Template) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "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 "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) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WhoIsBlueprintContract. +func (w WhoIsBlueprintContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "objectId", w.ObjectID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WhoIsBlueprintContract. +func (w *WhoIsBlueprintContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "objectId": + err = unpopulate(val, "ObjectID", &w.ObjectID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil { + 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/blueprint/armblueprint/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/blueprint/armblueprint/polymorphic_helpers.go similarity index 97% rename from sdk/resourcemanager/blueprint/armblueprint/zz_generated_polymorphic_helpers.go rename to sdk/resourcemanager/blueprint/armblueprint/polymorphic_helpers.go index fdd3633c7a8a..38e807dda7d6 100644 --- a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/blueprint/armblueprint/polymorphic_helpers.go @@ -5,6 +5,7 @@ // 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 armblueprint @@ -14,7 +15,7 @@ func unmarshalArtifactClassification(rawMsg json.RawMessage) (ArtifactClassifica if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } diff --git a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_publishedartifacts_client.go b/sdk/resourcemanager/blueprint/armblueprint/publishedartifacts_client.go similarity index 78% rename from sdk/resourcemanager/blueprint/armblueprint/zz_generated_publishedartifacts_client.go rename to sdk/resourcemanager/blueprint/armblueprint/publishedartifacts_client.go index be7ed671e43b..edb4e64091c6 100644 --- a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_publishedartifacts_client.go +++ b/sdk/resourcemanager/blueprint/armblueprint/publishedartifacts_client.go @@ -5,6 +5,7 @@ // 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 armblueprint @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,47 +24,39 @@ import ( // PublishedArtifactsClient contains the methods for the PublishedArtifacts group. // Don't use this type directly, use NewPublishedArtifactsClient() instead. type PublishedArtifactsClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewPublishedArtifactsClient creates a new instance of PublishedArtifactsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewPublishedArtifactsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*PublishedArtifactsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".PublishedArtifactsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &PublishedArtifactsClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // Get - Get an artifact for a published blueprint definition. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-11-01-preview -// resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: '/subscriptions/{subscriptionId}'). -// blueprintName - Name of the blueprint definition. -// versionID - Version of the published blueprint definition. -// artifactName - Name of the blueprint artifact. -// options - PublishedArtifactsClientGetOptions contains the optional parameters for the PublishedArtifactsClient.Get method. +// - resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), +// subscription (format: '/subscriptions/{subscriptionId}'). +// - blueprintName - Name of the blueprint definition. +// - versionID - Version of the published blueprint definition. +// - artifactName - Name of the blueprint artifact. +// - options - PublishedArtifactsClientGetOptions contains the optional parameters for the PublishedArtifactsClient.Get method. func (client *PublishedArtifactsClient) Get(ctx context.Context, resourceScope string, blueprintName string, versionID string, artifactName string, options *PublishedArtifactsClientGetOptions) (PublishedArtifactsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceScope, blueprintName, versionID, artifactName, options) if err != nil { return PublishedArtifactsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PublishedArtifactsClientGetResponse{}, err } @@ -91,7 +82,7 @@ func (client *PublishedArtifactsClient) getCreateRequest(ctx context.Context, re return nil, errors.New("parameter artifactName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{artifactName}", url.PathEscape(artifactName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -112,13 +103,14 @@ func (client *PublishedArtifactsClient) getHandleResponse(resp *http.Response) ( } // NewListPager - List artifacts for a version of a published blueprint definition. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-11-01-preview -// resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: '/subscriptions/{subscriptionId}'). -// blueprintName - Name of the blueprint definition. -// versionID - Version of the published blueprint definition. -// options - PublishedArtifactsClientListOptions contains the optional parameters for the PublishedArtifactsClient.List method. +// - resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), +// subscription (format: '/subscriptions/{subscriptionId}'). +// - blueprintName - Name of the blueprint definition. +// - versionID - Version of the published blueprint definition. +// - options - PublishedArtifactsClientListOptions contains the optional parameters for the PublishedArtifactsClient.NewListPager +// method. func (client *PublishedArtifactsClient) NewListPager(resourceScope string, blueprintName string, versionID string, options *PublishedArtifactsClientListOptions) *runtime.Pager[PublishedArtifactsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[PublishedArtifactsClientListResponse]{ More: func(page PublishedArtifactsClientListResponse) bool { @@ -135,7 +127,7 @@ func (client *PublishedArtifactsClient) NewListPager(resourceScope string, bluep if err != nil { return PublishedArtifactsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PublishedArtifactsClientListResponse{}, err } @@ -159,7 +151,7 @@ func (client *PublishedArtifactsClient) listCreateRequest(ctx context.Context, r return nil, errors.New("parameter versionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{versionId}", url.PathEscape(versionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/blueprint/armblueprint/publishedartifacts_client_example_test.go b/sdk/resourcemanager/blueprint/armblueprint/publishedartifacts_client_example_test.go new file mode 100644 index 000000000000..c7dc890a0842 --- /dev/null +++ b/sdk/resourcemanager/blueprint/armblueprint/publishedartifacts_client_example_test.go @@ -0,0 +1,542 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armblueprint_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/blueprint/armblueprint" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/SealedARMTemplateArtifact_Get.json +func ExamplePublishedArtifactsClient_Get_mgArmTemplateArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPublishedArtifactsClient().Get(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", "V2", "storageTemplate", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armblueprint.PublishedArtifactsClientGetResponse{ + // ArtifactClassification: &armblueprint.TemplateArtifact{ + // Name: to.Ptr("storageTemplate"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/versions/artifacts"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/versions/V2/artifacts/storageTemplate"), + // Kind: to.Ptr(armblueprint.ArtifactKindTemplate), + // Properties: &armblueprint.TemplateArtifactProperties{ + // Parameters: map[string]*armblueprint.ParameterValue{ + // "storageAccountType": &armblueprint.ParameterValue{ + // Value: "[parameters('storageAccountType')]", + // }, + // }, + // ResourceGroup: to.Ptr("storageRG"), + // Template: map[string]any{ + // "contentVersion": "1.0.0.0", + // "outputs":map[string]any{ + // "storageAccountName":map[string]any{ + // "type": "string", + // "value": "[variables('storageAccountName')]", + // }, + // }, + // "parameters":map[string]any{ + // "storageAccountType":map[string]any{ + // "type": "string", + // "allowedValues":[]any{ + // "Standard_LRS", + // "Standard_GRS", + // "Standard_ZRS", + // "Premium_LRS", + // }, + // "defaultValue": "Standard_LRS", + // "metadata":map[string]any{ + // "description": "Storage Account type", + // }, + // }, + // }, + // "resources":[]any{ + // map[string]any{ + // "name": "[variables('storageAccountName')]", + // "type": "Microsoft.Storage/storageAccounts", + // "apiVersion": "2016-01-01", + // "kind": "Storage", + // "location": "[resourceGroup().location]", + // "properties":map[string]any{ + // }, + // "sku":map[string]any{ + // "name": "[parameters('storageAccountType')]", + // }, + // }, + // }, + // "variables":map[string]any{ + // "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'standardsa')]", + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/SealedPolicyAssignmentArtifact_Get.json +func ExamplePublishedArtifactsClient_Get_mgPolicyAssignmentArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPublishedArtifactsClient().Get(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", "V2", "costCenterPolicy", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armblueprint.PublishedArtifactsClientGetResponse{ + // ArtifactClassification: &armblueprint.PolicyAssignmentArtifact{ + // Name: to.Ptr("costCenterPolicy"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/versions/artifacts"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/versions/V2/artifacts/costCenterPolicy"), + // Kind: to.Ptr(armblueprint.ArtifactKindPolicyAssignment), + // Properties: &armblueprint.PolicyAssignmentArtifactProperties{ + // DisplayName: to.Ptr("force costCenter tag on all resources"), + // Parameters: map[string]*armblueprint.ParameterValue{ + // "tagName": &armblueprint.ParameterValue{ + // Value: "costCenter", + // }, + // "tagValue": &armblueprint.ParameterValue{ + // Value: "[parameter('costCenter')]", + // }, + // }, + // PolicyDefinitionID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/SealedRoleAssignmentArtifact_Get.json +func ExamplePublishedArtifactsClient_Get_mgRoleAssignmentArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPublishedArtifactsClient().Get(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", "V2", "ownerAssignment", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armblueprint.PublishedArtifactsClientGetResponse{ + // ArtifactClassification: &armblueprint.RoleAssignmentArtifact{ + // Name: to.Ptr("ownerAssignment"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/versions/artifacts"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/versions/V2/artifacts/ownerAssignment"), + // Kind: to.Ptr(armblueprint.ArtifactKindRoleAssignment), + // Properties: &armblueprint.RoleAssignmentArtifactProperties{ + // DisplayName: to.Ptr("enforce owners of given subscription"), + // PrincipalIDs: "[parameters('owners')]", + // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/SealedARMTemplateArtifact_Get.json +func ExamplePublishedArtifactsClient_Get_subArmTemplateArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPublishedArtifactsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", "V2", "storageTemplate", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armblueprint.PublishedArtifactsClientGetResponse{ + // ArtifactClassification: &armblueprint.TemplateArtifact{ + // Name: to.Ptr("storageTemplate"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/versions/artifacts"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/versions/V2/artifacts/storageTemplate"), + // Kind: to.Ptr(armblueprint.ArtifactKindTemplate), + // Properties: &armblueprint.TemplateArtifactProperties{ + // Parameters: map[string]*armblueprint.ParameterValue{ + // "storageAccountType": &armblueprint.ParameterValue{ + // Value: "[parameters('storageAccountType')]", + // }, + // }, + // ResourceGroup: to.Ptr("storageRG"), + // Template: map[string]any{ + // "contentVersion": "1.0.0.0", + // "outputs":map[string]any{ + // "storageAccountName":map[string]any{ + // "type": "string", + // "value": "[variables('storageAccountName')]", + // }, + // }, + // "parameters":map[string]any{ + // "storageAccountType":map[string]any{ + // "type": "string", + // "allowedValues":[]any{ + // "Standard_LRS", + // "Standard_GRS", + // "Standard_ZRS", + // "Premium_LRS", + // }, + // "defaultValue": "Standard_LRS", + // "metadata":map[string]any{ + // "description": "Storage Account type", + // }, + // }, + // }, + // "resources":[]any{ + // map[string]any{ + // "name": "[variables('storageAccountName')]", + // "type": "Microsoft.Storage/storageAccounts", + // "apiVersion": "2016-01-01", + // "kind": "Storage", + // "location": "[resourceGroup().location]", + // "properties":map[string]any{ + // }, + // "sku":map[string]any{ + // "name": "[parameters('storageAccountType')]", + // }, + // }, + // }, + // "variables":map[string]any{ + // "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'standardsa')]", + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/SealedPolicyAssignmentArtifact_Get.json +func ExamplePublishedArtifactsClient_Get_subPolicyAssignmentArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPublishedArtifactsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", "V2", "costCenterPolicy", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armblueprint.PublishedArtifactsClientGetResponse{ + // ArtifactClassification: &armblueprint.PolicyAssignmentArtifact{ + // Name: to.Ptr("costCenterPolicy"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/versions/artifacts"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/versions/V2/artifacts/costCenterPolicy"), + // Kind: to.Ptr(armblueprint.ArtifactKindPolicyAssignment), + // Properties: &armblueprint.PolicyAssignmentArtifactProperties{ + // DisplayName: to.Ptr("force costCenter tag on all resources"), + // Parameters: map[string]*armblueprint.ParameterValue{ + // "tagName": &armblueprint.ParameterValue{ + // Value: "costCenter", + // }, + // "tagValue": &armblueprint.ParameterValue{ + // Value: "[parameter('costCenter')]", + // }, + // }, + // PolicyDefinitionID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/SealedRoleAssignmentArtifact_Get.json +func ExamplePublishedArtifactsClient_Get_subRoleAssignmentArtifact() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPublishedArtifactsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", "V2", "ownerAssignment", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armblueprint.PublishedArtifactsClientGetResponse{ + // ArtifactClassification: &armblueprint.RoleAssignmentArtifact{ + // Name: to.Ptr("ownerAssignment"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/versions/artifacts"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/versions/V2/artifacts/ownerAssignment"), + // Kind: to.Ptr(armblueprint.ArtifactKindRoleAssignment), + // Properties: &armblueprint.RoleAssignmentArtifactProperties{ + // DisplayName: to.Ptr("enforce owners of given subscription"), + // PrincipalIDs: "[parameters('owners')]", + // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/SealedArtifact_List.json +func ExamplePublishedArtifactsClient_NewListPager_mgArtifactList() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPublishedArtifactsClient().NewListPager("providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", "V2", 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.ArtifactList = armblueprint.ArtifactList{ + // Value: []armblueprint.ArtifactClassification{ + // &armblueprint.RoleAssignmentArtifact{ + // Name: to.Ptr("ownerAssignment"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/versions/artifacts"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/versions/V2/artifacts/ownerAssignment"), + // Kind: to.Ptr(armblueprint.ArtifactKindRoleAssignment), + // Properties: &armblueprint.RoleAssignmentArtifactProperties{ + // DisplayName: to.Ptr("enforce owners of given subscription"), + // PrincipalIDs: "[parameters('owners')]", + // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7"), + // }, + // }, + // &armblueprint.PolicyAssignmentArtifact{ + // Name: to.Ptr("costCenterPolicy"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/versions/artifacts"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/versions/V2/artifacts/costCenterPolicy"), + // Kind: to.Ptr(armblueprint.ArtifactKindPolicyAssignment), + // Properties: &armblueprint.PolicyAssignmentArtifactProperties{ + // DisplayName: to.Ptr("force costCenter tag on all resources"), + // Parameters: map[string]*armblueprint.ParameterValue{ + // "tagName": &armblueprint.ParameterValue{ + // Value: "costCenter", + // }, + // "tagValue": &armblueprint.ParameterValue{ + // Value: "[parameter('costCenter')]", + // }, + // }, + // PolicyDefinitionID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62"), + // }, + // }, + // &armblueprint.TemplateArtifact{ + // Name: to.Ptr("storageTemplate"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/versions/artifacts"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/versions/V2/artifacts/storageTemplate"), + // Kind: to.Ptr(armblueprint.ArtifactKindTemplate), + // Properties: &armblueprint.TemplateArtifactProperties{ + // Parameters: map[string]*armblueprint.ParameterValue{ + // "storageAccountType": &armblueprint.ParameterValue{ + // Value: "[parameters('storageAccountType')]", + // }, + // }, + // ResourceGroup: to.Ptr("storageRG"), + // Template: map[string]any{ + // "contentVersion": "1.0.0.0", + // "outputs":map[string]any{ + // "storageAccountName":map[string]any{ + // "type": "string", + // "value": "[variables('storageAccountName')]", + // }, + // }, + // "parameters":map[string]any{ + // "storageAccountType":map[string]any{ + // "type": "string", + // "allowedValues":[]any{ + // "Standard_LRS", + // "Standard_GRS", + // "Standard_ZRS", + // "Premium_LRS", + // }, + // "defaultValue": "Standard_LRS", + // "metadata":map[string]any{ + // "description": "Storage Account type", + // }, + // }, + // }, + // "resources":[]any{ + // map[string]any{ + // "name": "[variables('storageAccountName')]", + // "type": "Microsoft.Storage/storageAccounts", + // "apiVersion": "2016-01-01", + // "kind": "Storage", + // "location": "[resourceGroup().location]", + // "properties":map[string]any{ + // }, + // "sku":map[string]any{ + // "name": "[parameters('storageAccountType')]", + // }, + // }, + // }, + // "variables":map[string]any{ + // "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'standardsa')]", + // }, + // }, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/SealedArtifact_List.json +func ExamplePublishedArtifactsClient_NewListPager_subArtifactList() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPublishedArtifactsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", "V2", 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.ArtifactList = armblueprint.ArtifactList{ + // Value: []armblueprint.ArtifactClassification{ + // &armblueprint.RoleAssignmentArtifact{ + // Name: to.Ptr("ownerAssignment"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/versions/artifacts"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/versions/V2/artifacts/ownerAssignment"), + // Kind: to.Ptr(armblueprint.ArtifactKindRoleAssignment), + // Properties: &armblueprint.RoleAssignmentArtifactProperties{ + // DisplayName: to.Ptr("enforce owners of given subscription"), + // PrincipalIDs: "[parameters('owners')]", + // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7"), + // }, + // }, + // &armblueprint.PolicyAssignmentArtifact{ + // Name: to.Ptr("costCenterPolicy"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/versions/artifacts"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/versions/V2/artifacts/costCenterPolicy"), + // Kind: to.Ptr(armblueprint.ArtifactKindPolicyAssignment), + // Properties: &armblueprint.PolicyAssignmentArtifactProperties{ + // DisplayName: to.Ptr("force costCenter tag on all resources"), + // Parameters: map[string]*armblueprint.ParameterValue{ + // "tagName": &armblueprint.ParameterValue{ + // Value: "costCenter", + // }, + // "tagValue": &armblueprint.ParameterValue{ + // Value: "[parameter('costCenter')]", + // }, + // }, + // PolicyDefinitionID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62"), + // }, + // }, + // &armblueprint.TemplateArtifact{ + // Name: to.Ptr("storageTemplate"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/versions/artifacts"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/versions/V2/artifacts/storageTemplate"), + // Kind: to.Ptr(armblueprint.ArtifactKindTemplate), + // Properties: &armblueprint.TemplateArtifactProperties{ + // Parameters: map[string]*armblueprint.ParameterValue{ + // "storageAccountType": &armblueprint.ParameterValue{ + // Value: "[parameters('storageAccountType')]", + // }, + // }, + // ResourceGroup: to.Ptr("storageRG"), + // Template: map[string]any{ + // "contentVersion": "1.0.0.0", + // "outputs":map[string]any{ + // "storageAccountName":map[string]any{ + // "type": "string", + // "value": "[variables('storageAccountName')]", + // }, + // }, + // "parameters":map[string]any{ + // "storageAccountType":map[string]any{ + // "type": "string", + // "allowedValues":[]any{ + // "Standard_LRS", + // "Standard_GRS", + // "Standard_ZRS", + // "Premium_LRS", + // }, + // "defaultValue": "Standard_LRS", + // "metadata":map[string]any{ + // "description": "Storage Account type", + // }, + // }, + // }, + // "resources":[]any{ + // map[string]any{ + // "name": "[variables('storageAccountName')]", + // "type": "Microsoft.Storage/storageAccounts", + // "apiVersion": "2016-01-01", + // "kind": "Storage", + // "location": "[resourceGroup().location]", + // "properties":map[string]any{ + // }, + // "sku":map[string]any{ + // "name": "[parameters('storageAccountType')]", + // }, + // }, + // }, + // "variables":map[string]any{ + // "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'standardsa')]", + // }, + // }, + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_publishedblueprints_client.go b/sdk/resourcemanager/blueprint/armblueprint/publishedblueprints_client.go similarity index 79% rename from sdk/resourcemanager/blueprint/armblueprint/zz_generated_publishedblueprints_client.go rename to sdk/resourcemanager/blueprint/armblueprint/publishedblueprints_client.go index ff5e4e4ae082..0ab4f3cbe29d 100644 --- a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_publishedblueprints_client.go +++ b/sdk/resourcemanager/blueprint/armblueprint/publishedblueprints_client.go @@ -5,6 +5,7 @@ // 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 armblueprint @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,28 +24,19 @@ import ( // PublishedBlueprintsClient contains the methods for the PublishedBlueprints group. // Don't use this type directly, use NewPublishedBlueprintsClient() instead. type PublishedBlueprintsClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewPublishedBlueprintsClient creates a new instance of PublishedBlueprintsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewPublishedBlueprintsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*PublishedBlueprintsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".PublishedBlueprintsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &PublishedBlueprintsClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } @@ -54,19 +44,20 @@ func NewPublishedBlueprintsClient(credential azcore.TokenCredential, options *ar // Create - Publish a new version of the blueprint definition with the latest artifacts. Published blueprint definitions are // immutable. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-11-01-preview -// resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: '/subscriptions/{subscriptionId}'). -// blueprintName - Name of the blueprint definition. -// versionID - Version of the published blueprint definition. -// options - PublishedBlueprintsClientCreateOptions contains the optional parameters for the PublishedBlueprintsClient.Create -// method. +// - resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), +// subscription (format: '/subscriptions/{subscriptionId}'). +// - blueprintName - Name of the blueprint definition. +// - versionID - Version of the published blueprint definition. +// - options - PublishedBlueprintsClientCreateOptions contains the optional parameters for the PublishedBlueprintsClient.Create +// method. func (client *PublishedBlueprintsClient) Create(ctx context.Context, resourceScope string, blueprintName string, versionID string, options *PublishedBlueprintsClientCreateOptions) (PublishedBlueprintsClientCreateResponse, error) { req, err := client.createCreateRequest(ctx, resourceScope, blueprintName, versionID, options) if err != nil { return PublishedBlueprintsClientCreateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PublishedBlueprintsClientCreateResponse{}, err } @@ -88,7 +79,7 @@ func (client *PublishedBlueprintsClient) createCreateRequest(ctx context.Context return nil, errors.New("parameter versionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{versionId}", url.PathEscape(versionID)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -113,19 +104,20 @@ func (client *PublishedBlueprintsClient) createHandleResponse(resp *http.Respons // Delete - Delete a published version of a blueprint definition. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-11-01-preview -// resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: '/subscriptions/{subscriptionId}'). -// blueprintName - Name of the blueprint definition. -// versionID - Version of the published blueprint definition. -// options - PublishedBlueprintsClientDeleteOptions contains the optional parameters for the PublishedBlueprintsClient.Delete -// method. +// - resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), +// subscription (format: '/subscriptions/{subscriptionId}'). +// - blueprintName - Name of the blueprint definition. +// - versionID - Version of the published blueprint definition. +// - options - PublishedBlueprintsClientDeleteOptions contains the optional parameters for the PublishedBlueprintsClient.Delete +// method. func (client *PublishedBlueprintsClient) Delete(ctx context.Context, resourceScope string, blueprintName string, versionID string, options *PublishedBlueprintsClientDeleteOptions) (PublishedBlueprintsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceScope, blueprintName, versionID, options) if err != nil { return PublishedBlueprintsClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PublishedBlueprintsClientDeleteResponse{}, err } @@ -147,7 +139,7 @@ func (client *PublishedBlueprintsClient) deleteCreateRequest(ctx context.Context return nil, errors.New("parameter versionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{versionId}", url.PathEscape(versionID)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -169,18 +161,19 @@ func (client *PublishedBlueprintsClient) deleteHandleResponse(resp *http.Respons // Get - Get a published version of a blueprint definition. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-11-01-preview -// resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: '/subscriptions/{subscriptionId}'). -// blueprintName - Name of the blueprint definition. -// versionID - Version of the published blueprint definition. -// options - PublishedBlueprintsClientGetOptions contains the optional parameters for the PublishedBlueprintsClient.Get method. +// - resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), +// subscription (format: '/subscriptions/{subscriptionId}'). +// - blueprintName - Name of the blueprint definition. +// - versionID - Version of the published blueprint definition. +// - options - PublishedBlueprintsClientGetOptions contains the optional parameters for the PublishedBlueprintsClient.Get method. func (client *PublishedBlueprintsClient) Get(ctx context.Context, resourceScope string, blueprintName string, versionID string, options *PublishedBlueprintsClientGetOptions) (PublishedBlueprintsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceScope, blueprintName, versionID, options) if err != nil { return PublishedBlueprintsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PublishedBlueprintsClientGetResponse{}, err } @@ -202,7 +195,7 @@ func (client *PublishedBlueprintsClient) getCreateRequest(ctx context.Context, r return nil, errors.New("parameter versionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{versionId}", url.PathEscape(versionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -223,13 +216,13 @@ func (client *PublishedBlueprintsClient) getHandleResponse(resp *http.Response) } // NewListPager - List published versions of given blueprint definition. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-11-01-preview -// resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: '/subscriptions/{subscriptionId}'). -// blueprintName - Name of the blueprint definition. -// options - PublishedBlueprintsClientListOptions contains the optional parameters for the PublishedBlueprintsClient.List -// method. +// - resourceScope - The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), +// subscription (format: '/subscriptions/{subscriptionId}'). +// - blueprintName - Name of the blueprint definition. +// - options - PublishedBlueprintsClientListOptions contains the optional parameters for the PublishedBlueprintsClient.NewListPager +// method. func (client *PublishedBlueprintsClient) NewListPager(resourceScope string, blueprintName string, options *PublishedBlueprintsClientListOptions) *runtime.Pager[PublishedBlueprintsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[PublishedBlueprintsClientListResponse]{ More: func(page PublishedBlueprintsClientListResponse) bool { @@ -246,7 +239,7 @@ func (client *PublishedBlueprintsClient) NewListPager(resourceScope string, blue if err != nil { return PublishedBlueprintsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PublishedBlueprintsClientListResponse{}, err } @@ -266,7 +259,7 @@ func (client *PublishedBlueprintsClient) listCreateRequest(ctx context.Context, return nil, errors.New("parameter blueprintName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{blueprintName}", url.PathEscape(blueprintName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/blueprint/armblueprint/publishedblueprints_client_example_test.go b/sdk/resourcemanager/blueprint/armblueprint/publishedblueprints_client_example_test.go new file mode 100644 index 000000000000..b58bee7cee0d --- /dev/null +++ b/sdk/resourcemanager/blueprint/armblueprint/publishedblueprints_client_example_test.go @@ -0,0 +1,416 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armblueprint_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/blueprint/armblueprint" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/SealedBlueprint_Publish.json +func ExamplePublishedBlueprintsClient_Create_publishedManagementGroupBlueprintPublish() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewPublishedBlueprintsClient().Create(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", "v2", &armblueprint.PublishedBlueprintsClientCreateOptions{PublishedBlueprint: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/SealedBlueprint_Publish.json +func ExamplePublishedBlueprintsClient_Create_publishedSubscriptionBlueprintPublish() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewPublishedBlueprintsClient().Create(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", "v2", &armblueprint.PublishedBlueprintsClientCreateOptions{PublishedBlueprint: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/SealedBlueprint_Get.json +func ExamplePublishedBlueprintsClient_Get_publishedManagementGroupBlueprint() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPublishedBlueprintsClient().Get(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", "v2", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PublishedBlueprint = armblueprint.PublishedBlueprint{ + // Name: to.Ptr("v2"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/versions"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"), + // Properties: &armblueprint.PublishedBlueprintProperties{ + // Description: to.Ptr("blueprint contains all artifact kinds {'template', 'rbac', 'policy'}"), + // Parameters: map[string]*armblueprint.ParameterDefinition{ + // "costCenter": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("force cost center tag for all resources under given subscription."), + // }, + // }, + // "owners": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeArray), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("assign owners to subscription along with blueprint assignment."), + // }, + // }, + // "storageAccountType": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("storage account type."), + // }, + // }, + // }, + // ResourceGroups: map[string]*armblueprint.ResourceGroupDefinition{ + // "storageRG": &armblueprint.ResourceGroupDefinition{ + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // Description: to.Ptr("Contains storageAccounts that collect all shoebox logs."), + // DisplayName: to.Ptr("storage resource group"), + // }, + // }, + // }, + // TargetScope: to.Ptr(armblueprint.BlueprintTargetScopeSubscription), + // BlueprintName: to.Ptr("simpleBlueprint"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/SealedBlueprint_Get.json +func ExamplePublishedBlueprintsClient_Get_publishedSubscriptionBlueprint() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPublishedBlueprintsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", "v2", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PublishedBlueprint = armblueprint.PublishedBlueprint{ + // Name: to.Ptr("v2"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/versions"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"), + // Properties: &armblueprint.PublishedBlueprintProperties{ + // Description: to.Ptr("blueprint contains all artifact kinds {'template', 'rbac', 'policy'}"), + // Parameters: map[string]*armblueprint.ParameterDefinition{ + // "costCenter": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("force cost center tag for all resources under given subscription."), + // }, + // }, + // "owners": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeArray), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("assign owners to subscription along with blueprint assignment."), + // }, + // }, + // "storageAccountType": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("storage account type."), + // }, + // }, + // }, + // ResourceGroups: map[string]*armblueprint.ResourceGroupDefinition{ + // "storageRG": &armblueprint.ResourceGroupDefinition{ + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // Description: to.Ptr("Contains storageAccounts that collect all shoebox logs."), + // DisplayName: to.Ptr("storage resource group"), + // }, + // }, + // }, + // TargetScope: to.Ptr(armblueprint.BlueprintTargetScopeSubscription), + // BlueprintName: to.Ptr("simpleBlueprint"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/SealedBlueprint_Delete.json +func ExamplePublishedBlueprintsClient_Delete_publishedManagementGroupBlueprint() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPublishedBlueprintsClient().Delete(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", "v2", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PublishedBlueprint = armblueprint.PublishedBlueprint{ + // Name: to.Ptr("v2"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/versions"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"), + // Properties: &armblueprint.PublishedBlueprintProperties{ + // Description: to.Ptr("blueprint contains all artifact kinds {'template', 'rbac', 'policy'}"), + // Parameters: map[string]*armblueprint.ParameterDefinition{ + // "costCenter": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("force cost center tag for all resources under given subscription."), + // }, + // }, + // "owners": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeArray), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("assign owners to subscription along with blueprint assignment."), + // }, + // }, + // "storageAccountType": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("storage account type."), + // }, + // }, + // }, + // ResourceGroups: map[string]*armblueprint.ResourceGroupDefinition{ + // "storageRG": &armblueprint.ResourceGroupDefinition{ + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // Description: to.Ptr("Contains storageAccounts that collect all shoebox logs."), + // DisplayName: to.Ptr("storage resource group"), + // }, + // }, + // }, + // TargetScope: to.Ptr(armblueprint.BlueprintTargetScopeSubscription), + // BlueprintName: to.Ptr("simpleBlueprint"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/SealedBlueprint_Delete.json +func ExamplePublishedBlueprintsClient_Delete_publishedSubscriptionBlueprint() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPublishedBlueprintsClient().Delete(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", "v2", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PublishedBlueprint = armblueprint.PublishedBlueprint{ + // Name: to.Ptr("v2"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/versions"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"), + // Properties: &armblueprint.PublishedBlueprintProperties{ + // Description: to.Ptr("blueprint contains all artifact kinds {'template', 'rbac', 'policy'}"), + // Parameters: map[string]*armblueprint.ParameterDefinition{ + // "costCenter": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("force cost center tag for all resources under given subscription."), + // }, + // }, + // "owners": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeArray), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("assign owners to subscription along with blueprint assignment."), + // }, + // }, + // "storageAccountType": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("storage account type."), + // }, + // }, + // }, + // ResourceGroups: map[string]*armblueprint.ResourceGroupDefinition{ + // "storageRG": &armblueprint.ResourceGroupDefinition{ + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // Description: to.Ptr("Contains storageAccounts that collect all shoebox logs."), + // DisplayName: to.Ptr("storage resource group"), + // }, + // }, + // }, + // TargetScope: to.Ptr(armblueprint.BlueprintTargetScopeSubscription), + // BlueprintName: to.Ptr("simpleBlueprint"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/SealedBlueprint_List.json +func ExamplePublishedBlueprintsClient_NewListPager_publishedManagementGroupBlueprint() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPublishedBlueprintsClient().NewListPager("providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", 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.PublishedBlueprintList = armblueprint.PublishedBlueprintList{ + // Value: []*armblueprint.PublishedBlueprint{ + // { + // Name: to.Ptr("v1"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/versions"), + // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/versions/v1"), + // Properties: &armblueprint.PublishedBlueprintProperties{ + // Description: to.Ptr("blueprint contains all artifact kinds {'template', 'rbac', 'policy'}"), + // Parameters: map[string]*armblueprint.ParameterDefinition{ + // "costCenter": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("force cost center tag for all resources under given subscription."), + // }, + // }, + // "owners": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeArray), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("assign owners to subscription along with blueprint assignment."), + // }, + // }, + // "storageAccountType": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("storage account type."), + // }, + // }, + // }, + // ResourceGroups: map[string]*armblueprint.ResourceGroupDefinition{ + // "storageRG": &armblueprint.ResourceGroupDefinition{ + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // Description: to.Ptr("Contains storageAccounts that collect all shoebox logs."), + // DisplayName: to.Ptr("storage resource group"), + // }, + // }, + // }, + // TargetScope: to.Ptr(armblueprint.BlueprintTargetScopeSubscription), + // BlueprintName: to.Ptr("simpleBlueprint"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/SealedBlueprint_List.json +func ExamplePublishedBlueprintsClient_NewListPager_publishedSubscriptionBlueprint() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armblueprint.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPublishedBlueprintsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", 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.PublishedBlueprintList = armblueprint.PublishedBlueprintList{ + // Value: []*armblueprint.PublishedBlueprint{ + // { + // Name: to.Ptr("v1"), + // Type: to.Ptr("Microsoft.Blueprint/blueprints/versions"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/versions/v1"), + // Properties: &armblueprint.PublishedBlueprintProperties{ + // Description: to.Ptr("blueprint contains all artifact kinds {'template', 'rbac', 'policy'}"), + // Parameters: map[string]*armblueprint.ParameterDefinition{ + // "costCenter": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("force cost center tag for all resources under given subscription."), + // }, + // }, + // "owners": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeArray), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("assign owners to subscription along with blueprint assignment."), + // }, + // }, + // "storageAccountType": &armblueprint.ParameterDefinition{ + // Type: to.Ptr(armblueprint.TemplateParameterTypeString), + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // DisplayName: to.Ptr("storage account type."), + // }, + // }, + // }, + // ResourceGroups: map[string]*armblueprint.ResourceGroupDefinition{ + // "storageRG": &armblueprint.ResourceGroupDefinition{ + // Metadata: &armblueprint.ParameterDefinitionMetadata{ + // Description: to.Ptr("Contains storageAccounts that collect all shoebox logs."), + // DisplayName: to.Ptr("storage resource group"), + // }, + // }, + // }, + // TargetScope: to.Ptr(armblueprint.BlueprintTargetScopeSubscription), + // BlueprintName: to.Ptr("simpleBlueprint"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_response_types.go b/sdk/resourcemanager/blueprint/armblueprint/response_types.go similarity index 94% rename from sdk/resourcemanager/blueprint/armblueprint/zz_generated_response_types.go rename to sdk/resourcemanager/blueprint/armblueprint/response_types.go index 4b9ce37756c9..cab95c2b027f 100644 --- a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_response_types.go +++ b/sdk/resourcemanager/blueprint/armblueprint/response_types.go @@ -5,6 +5,7 @@ // 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 armblueprint @@ -53,7 +54,7 @@ func (a *ArtifactsClientGetResponse) UnmarshalJSON(data []byte) error { return nil } -// ArtifactsClientListResponse contains the response from method ArtifactsClient.List. +// ArtifactsClientListResponse contains the response from method ArtifactsClient.NewListPager. type ArtifactsClientListResponse struct { ArtifactList } @@ -63,7 +64,7 @@ type AssignmentOperationsClientGetResponse struct { AssignmentOperation } -// AssignmentOperationsClientListResponse contains the response from method AssignmentOperationsClient.List. +// AssignmentOperationsClientListResponse contains the response from method AssignmentOperationsClient.NewListPager. type AssignmentOperationsClientListResponse struct { AssignmentOperationList } @@ -83,7 +84,7 @@ type AssignmentsClientGetResponse struct { Assignment } -// AssignmentsClientListResponse contains the response from method AssignmentsClient.List. +// AssignmentsClientListResponse contains the response from method AssignmentsClient.NewListPager. type AssignmentsClientListResponse struct { AssignmentList } @@ -108,7 +109,7 @@ type BlueprintsClientGetResponse struct { Blueprint } -// BlueprintsClientListResponse contains the response from method BlueprintsClient.List. +// BlueprintsClientListResponse contains the response from method BlueprintsClient.NewListPager. type BlueprintsClientListResponse struct { List } @@ -128,7 +129,7 @@ func (p *PublishedArtifactsClientGetResponse) UnmarshalJSON(data []byte) error { return nil } -// PublishedArtifactsClientListResponse contains the response from method PublishedArtifactsClient.List. +// PublishedArtifactsClientListResponse contains the response from method PublishedArtifactsClient.NewListPager. type PublishedArtifactsClientListResponse struct { ArtifactList } @@ -148,7 +149,7 @@ type PublishedBlueprintsClientGetResponse struct { PublishedBlueprint } -// PublishedBlueprintsClientListResponse contains the response from method PublishedBlueprintsClient.List. +// PublishedBlueprintsClientListResponse contains the response from method PublishedBlueprintsClient.NewListPager. type PublishedBlueprintsClientListResponse struct { PublishedBlueprintList } diff --git a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_time_rfc3339.go b/sdk/resourcemanager/blueprint/armblueprint/time_rfc3339.go similarity index 96% rename from sdk/resourcemanager/blueprint/armblueprint/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/blueprint/armblueprint/time_rfc3339.go index 2d0a46b1712f..fa2420e7c64b 100644 --- a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/blueprint/armblueprint/time_rfc3339.go @@ -5,6 +5,7 @@ // 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 armblueprint @@ -61,7 +62,7 @@ func (t *timeRFC3339) Parse(layout, value string) error { return err } -func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_artifacts_client_test.go b/sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_artifacts_client_test.go deleted file mode 100644 index 34411dff6b9f..000000000000 --- a/sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_artifacts_client_test.go +++ /dev/null @@ -1,162 +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. - -package armblueprint_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/blueprint/armblueprint" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/ARMTemplateArtifact_Create.json -func ExampleArtifactsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armblueprint.NewArtifactsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.CreateOrUpdate(ctx, - "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", - "simpleBlueprint", - "storageTemplate", - &armblueprint.TemplateArtifact{ - Kind: to.Ptr(armblueprint.ArtifactKindTemplate), - Properties: &armblueprint.TemplateArtifactProperties{ - Parameters: map[string]*armblueprint.ParameterValue{ - "storageAccountType": { - Value: "[parameters('storageAccountType')]", - }, - }, - ResourceGroup: to.Ptr("storageRG"), - Template: map[string]interface{}{ - "contentVersion": "1.0.0.0", - "outputs": map[string]interface{}{ - "storageAccountName": map[string]interface{}{ - "type": "string", - "value": "[variables('storageAccountName')]", - }, - }, - "parameters": map[string]interface{}{ - "storageAccountType": map[string]interface{}{ - "type": "string", - "allowedValues": []interface{}{ - "Standard_LRS", - "Standard_GRS", - "Standard_ZRS", - "Premium_LRS", - }, - "defaultValue": "Standard_LRS", - "metadata": map[string]interface{}{ - "description": "Storage Account type", - }, - }, - }, - "resources": []interface{}{ - map[string]interface{}{ - "name": "[variables('storageAccountName')]", - "type": "Microsoft.Storage/storageAccounts", - "apiVersion": "2016-01-01", - "kind": "Storage", - "location": "[resourceGroup().location]", - "properties": map[string]interface{}{}, - "sku": map[string]interface{}{ - "name": "[parameters('storageAccountType')]", - }, - }, - }, - "variables": map[string]interface{}{ - "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'standardsa')]", - }, - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/ARMTemplateArtifact_Get.json -func ExampleArtifactsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armblueprint.NewArtifactsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", - "simpleBlueprint", - "storageTemplate", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/ARMTemplateArtifact_Delete.json -func ExampleArtifactsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armblueprint.NewArtifactsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Delete(ctx, - "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", - "simpleBlueprint", - "storageTemplate", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/Artifact_List.json -func ExampleArtifactsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armblueprint.NewArtifactsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", - "simpleBlueprint", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_assignmentoperations_client_test.go b/sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_assignmentoperations_client_test.go deleted file mode 100644 index 6565986fc92c..000000000000 --- a/sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_assignmentoperations_client_test.go +++ /dev/null @@ -1,66 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armblueprint_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/blueprint/armblueprint" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPAssignment/BlueprintAssignmentOperation_List.json -func ExampleAssignmentOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armblueprint.NewAssignmentOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("managementGroups/ContosoOnlineGroup", - "assignSimpleBlueprint", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPAssignment/BlueprintAssignmentOperation_Get.json -func ExampleAssignmentOperationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armblueprint.NewAssignmentOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "managementGroups/ContosoOnlineGroup", - "assignSimpleBlueprint", - "fb5d4dcb-7ce2-4087-ba7a-459aa74e5e0f", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_assignments_client_test.go b/sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_assignments_client_test.go deleted file mode 100644 index 0d9bec7a5edd..000000000000 --- a/sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_assignments_client_test.go +++ /dev/null @@ -1,158 +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. - -package armblueprint_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/blueprint/armblueprint" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPAssignment/BlueprintAssignment_Create_SystemAssignedMSI.json -func ExampleAssignmentsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armblueprint.NewAssignmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.CreateOrUpdate(ctx, - "managementGroups/ContosoOnlineGroup", - "assignSimpleBlueprint", - armblueprint.Assignment{ - Location: to.Ptr("eastus"), - Identity: &armblueprint.ManagedServiceIdentity{ - Type: to.Ptr(armblueprint.ManagedServiceIdentityTypeSystemAssigned), - }, - Properties: &armblueprint.AssignmentProperties{ - Description: to.Ptr("enforce pre-defined simpleBlueprint to this XXXXXXXX subscription."), - BlueprintID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint"), - Parameters: map[string]*armblueprint.ParameterValue{ - "costCenter": { - Value: "Contoso/Online/Shopping/Production", - }, - "owners": { - Value: []interface{}{ - "johnDoe@contoso.com", - "johnsteam@contoso.com", - }, - }, - "storageAccountType": { - Value: "Standard_LRS", - }, - }, - ResourceGroups: map[string]*armblueprint.ResourceGroupValue{ - "storageRG": { - Name: to.Ptr("defaultRG"), - Location: to.Ptr("eastus"), - }, - }, - Scope: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPAssignment/BlueprintAssignment_Get.json -func ExampleAssignmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armblueprint.NewAssignmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "managementGroups/ContosoOnlineGroup", - "assignSimpleBlueprint", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPAssignment/BlueprintAssignment_Delete.json -func ExampleAssignmentsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armblueprint.NewAssignmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "managementGroups/ContosoOnlineGroup", - "assignSimpleBlueprint", - &armblueprint.AssignmentsClientDeleteOptions{DeleteBehavior: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPAssignment/WhoIsBlueprint_Action.json -func ExampleAssignmentsClient_WhoIsBlueprint() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armblueprint.NewAssignmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.WhoIsBlueprint(ctx, - "managementGroups/ContosoOnlineGroup", - "assignSimpleBlueprint", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPAssignment/BlueprintAssignment_List.json -func ExampleAssignmentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armblueprint.NewAssignmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("managementGroups/ContosoOnlineGroup", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_blueprints_client_test.go b/sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_blueprints_client_test.go deleted file mode 100644 index 3ebf8df6837c..000000000000 --- a/sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_blueprints_client_test.go +++ /dev/null @@ -1,141 +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. - -package armblueprint_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/blueprint/armblueprint" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/Blueprint_Create.json -func ExampleBlueprintsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armblueprint.NewBlueprintsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.CreateOrUpdate(ctx, - "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", - "simpleBlueprint", - armblueprint.Blueprint{ - Properties: &armblueprint.Properties{ - Description: to.Ptr("blueprint contains all artifact kinds {'template', 'rbac', 'policy'}"), - Parameters: map[string]*armblueprint.ParameterDefinition{ - "costCenter": { - Type: to.Ptr(armblueprint.TemplateParameterTypeString), - Metadata: &armblueprint.ParameterDefinitionMetadata{ - DisplayName: to.Ptr("force cost center tag for all resources under given subscription."), - }, - }, - "owners": { - Type: to.Ptr(armblueprint.TemplateParameterTypeArray), - Metadata: &armblueprint.ParameterDefinitionMetadata{ - DisplayName: to.Ptr("assign owners to subscription along with blueprint assignment."), - }, - }, - "storageAccountType": { - Type: to.Ptr(armblueprint.TemplateParameterTypeString), - Metadata: &armblueprint.ParameterDefinitionMetadata{ - DisplayName: to.Ptr("storage account type."), - }, - }, - }, - ResourceGroups: map[string]*armblueprint.ResourceGroupDefinition{ - "storageRG": { - Metadata: &armblueprint.ParameterDefinitionMetadata{ - Description: to.Ptr("Contains storageAccounts that collect all shoebox logs."), - DisplayName: to.Ptr("storage resource group"), - }, - }, - }, - TargetScope: to.Ptr(armblueprint.BlueprintTargetScopeSubscription), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/Blueprint_Get.json -func ExampleBlueprintsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armblueprint.NewBlueprintsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", - "simpleBlueprint", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/Blueprint_Delete.json -func ExampleBlueprintsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armblueprint.NewBlueprintsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Delete(ctx, - "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", - "simpleBlueprint", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/Blueprint_List.json -func ExampleBlueprintsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armblueprint.NewBlueprintsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_publishedartifacts_client_test.go b/sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_publishedartifacts_client_test.go deleted file mode 100644 index 24d296880afe..000000000000 --- a/sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_publishedartifacts_client_test.go +++ /dev/null @@ -1,68 +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. - -package armblueprint_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/blueprint/armblueprint" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/SealedARMTemplateArtifact_Get.json -func ExamplePublishedArtifactsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armblueprint.NewPublishedArtifactsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", - "simpleBlueprint", - "V2", - "storageTemplate", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/SealedArtifact_List.json -func ExamplePublishedArtifactsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armblueprint.NewPublishedArtifactsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", - "simpleBlueprint", - "V2", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_publishedblueprints_client_test.go b/sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_publishedblueprints_client_test.go deleted file mode 100644 index 9388afa24647..000000000000 --- a/sdk/resourcemanager/blueprint/armblueprint/ze_generated_example_publishedblueprints_client_test.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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armblueprint_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/blueprint/armblueprint" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/SealedBlueprint_Publish.json -func ExamplePublishedBlueprintsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armblueprint.NewPublishedBlueprintsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Create(ctx, - "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", - "simpleBlueprint", - "v2", - &armblueprint.PublishedBlueprintsClientCreateOptions{PublishedBlueprint: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/SealedBlueprint_Get.json -func ExamplePublishedBlueprintsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armblueprint.NewPublishedBlueprintsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", - "simpleBlueprint", - "v2", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/SealedBlueprint_Delete.json -func ExamplePublishedBlueprintsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armblueprint.NewPublishedBlueprintsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Delete(ctx, - "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", - "simpleBlueprint", - "v2", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/SealedBlueprint_List.json -func ExamplePublishedBlueprintsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armblueprint.NewPublishedBlueprintsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", - "simpleBlueprint", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_models_serde.go b/sdk/resourcemanager/blueprint/armblueprint/zz_generated_models_serde.go deleted file mode 100644 index 891ee73a3b33..000000000000 --- a/sdk/resourcemanager/blueprint/armblueprint/zz_generated_models_serde.go +++ /dev/null @@ -1,466 +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. - -package armblueprint - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// UnmarshalJSON implements the json.Unmarshaller interface for type ArtifactList. -func (a *ArtifactList) UnmarshalJSON(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": - a.Value, err = unmarshalArtifactClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ArtifactPropertiesBase. -func (a ArtifactPropertiesBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dependsOn", a.DependsOn) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AssignmentDeploymentJob. -func (a AssignmentDeploymentJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "action", a.Action) - populate(objectMap, "history", a.History) - populate(objectMap, "jobId", a.JobID) - populate(objectMap, "jobState", a.JobState) - populate(objectMap, "kind", a.Kind) - populate(objectMap, "requestUri", a.RequestURI) - populate(objectMap, "result", a.Result) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AssignmentDeploymentJobResult. -func (a AssignmentDeploymentJobResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "error", a.Error) - populate(objectMap, "resources", a.Resources) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AssignmentJobCreatedResource. -func (a AssignmentJobCreatedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AssignmentLockSettings. -func (a AssignmentLockSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "excludedActions", a.ExcludedActions) - populate(objectMap, "excludedPrincipals", a.ExcludedPrincipals) - populate(objectMap, "mode", a.Mode) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AssignmentOperationProperties. -func (a AssignmentOperationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "assignmentState", a.AssignmentState) - populate(objectMap, "blueprintVersion", a.BlueprintVersion) - populate(objectMap, "deployments", a.Deployments) - populate(objectMap, "timeCreated", a.TimeCreated) - populate(objectMap, "timeFinished", a.TimeFinished) - populate(objectMap, "timeStarted", a.TimeStarted) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AssignmentProperties. -func (a AssignmentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "blueprintId", a.BlueprintID) - populate(objectMap, "description", a.Description) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "locks", a.Locks) - populate(objectMap, "parameters", a.Parameters) - populate(objectMap, "provisioningState", a.ProvisioningState) - populate(objectMap, "resourceGroups", a.ResourceGroups) - populate(objectMap, "scope", a.Scope) - populate(objectMap, "status", a.Status) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AssignmentStatus. -func (a AssignmentStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "lastModified", a.LastModified) - populate(objectMap, "managedResources", a.ManagedResources) - populateTimeRFC3339(objectMap, "timeCreated", a.TimeCreated) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentStatus. -func (a *AssignmentStatus) UnmarshalJSON(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 "lastModified": - err = unpopulateTimeRFC3339(val, "LastModified", &a.LastModified) - delete(rawMsg, key) - case "managedResources": - err = unpopulate(val, "ManagedResources", &a.ManagedResources) - delete(rawMsg, key) - case "timeCreated": - err = unpopulateTimeRFC3339(val, "TimeCreated", &a.TimeCreated) - 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 ManagedServiceIdentity. -func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "principalId", m.PrincipalID) - populate(objectMap, "tenantId", m.TenantID) - populate(objectMap, "type", m.Type) - populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ParameterDefinition. -func (p ParameterDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allowedValues", p.AllowedValues) - populate(objectMap, "defaultValue", &p.DefaultValue) - populate(objectMap, "metadata", p.Metadata) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PolicyAssignmentArtifact. -func (p PolicyAssignmentArtifact) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - objectMap["kind"] = ArtifactKindPolicyAssignment - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyAssignmentArtifact. -func (p *PolicyAssignmentArtifact) UnmarshalJSON(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 "kind": - err = unpopulate(val, "Kind", &p.Kind) - 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 "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 PolicyAssignmentArtifactProperties. -func (p PolicyAssignmentArtifactProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dependsOn", p.DependsOn) - populate(objectMap, "description", p.Description) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "parameters", p.Parameters) - populate(objectMap, "policyDefinitionId", p.PolicyDefinitionID) - populate(objectMap, "resourceGroup", p.ResourceGroup) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Properties. -func (p Properties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", p.Description) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "layout", &p.Layout) - populate(objectMap, "parameters", p.Parameters) - populate(objectMap, "resourceGroups", p.ResourceGroups) - populate(objectMap, "status", p.Status) - populate(objectMap, "targetScope", p.TargetScope) - populate(objectMap, "versions", &p.Versions) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PublishedBlueprintProperties. -func (p PublishedBlueprintProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "blueprintName", p.BlueprintName) - populate(objectMap, "changeNotes", p.ChangeNotes) - populate(objectMap, "description", p.Description) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "parameters", p.Parameters) - populate(objectMap, "resourceGroups", p.ResourceGroups) - populate(objectMap, "status", p.Status) - populate(objectMap, "targetScope", p.TargetScope) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceGroupDefinition. -func (r ResourceGroupDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dependsOn", r.DependsOn) - populate(objectMap, "location", r.Location) - populate(objectMap, "metadata", r.Metadata) - populate(objectMap, "name", r.Name) - populate(objectMap, "tags", r.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceStatusBase. -func (r ResourceStatusBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "lastModified", r.LastModified) - populateTimeRFC3339(objectMap, "timeCreated", r.TimeCreated) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceStatusBase. -func (r *ResourceStatusBase) UnmarshalJSON(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 "lastModified": - err = unpopulateTimeRFC3339(val, "LastModified", &r.LastModified) - delete(rawMsg, key) - case "timeCreated": - err = unpopulateTimeRFC3339(val, "TimeCreated", &r.TimeCreated) - 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 RoleAssignmentArtifact. -func (r RoleAssignmentArtifact) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - objectMap["kind"] = ArtifactKindRoleAssignment - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentArtifact. -func (r *RoleAssignmentArtifact) UnmarshalJSON(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 "kind": - err = unpopulate(val, "Kind", &r.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - 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 RoleAssignmentArtifactProperties. -func (r RoleAssignmentArtifactProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dependsOn", r.DependsOn) - populate(objectMap, "description", r.Description) - populate(objectMap, "displayName", r.DisplayName) - populate(objectMap, "principalIds", &r.PrincipalIDs) - populate(objectMap, "resourceGroup", r.ResourceGroup) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SharedBlueprintProperties. -func (s SharedBlueprintProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", s.Description) - populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "parameters", s.Parameters) - populate(objectMap, "resourceGroups", s.ResourceGroups) - populate(objectMap, "status", s.Status) - populate(objectMap, "targetScope", s.TargetScope) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Status. -func (s Status) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "lastModified", s.LastModified) - populateTimeRFC3339(objectMap, "timeCreated", s.TimeCreated) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Status. -func (s *Status) UnmarshalJSON(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 "lastModified": - err = unpopulateTimeRFC3339(val, "LastModified", &s.LastModified) - delete(rawMsg, key) - case "timeCreated": - err = unpopulateTimeRFC3339(val, "TimeCreated", &s.TimeCreated) - 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 TemplateArtifact. -func (t TemplateArtifact) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - objectMap["kind"] = ArtifactKindTemplate - populate(objectMap, "name", t.Name) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TemplateArtifact. -func (t *TemplateArtifact) UnmarshalJSON(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 "kind": - err = unpopulate(val, "Kind", &t.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &t.Properties) - delete(rawMsg, key) - case "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 TemplateArtifactProperties. -func (t TemplateArtifactProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dependsOn", t.DependsOn) - populate(objectMap, "description", t.Description) - populate(objectMap, "displayName", t.DisplayName) - populate(objectMap, "parameters", t.Parameters) - populate(objectMap, "resourceGroup", t.ResourceGroup) - populate(objectMap, "template", &t.Template) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - 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 interface{}) error { - if data == nil { - 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/iotsecurity/armiotsecurity/CHANGELOG.md b/sdk/resourcemanager/iotsecurity/armiotsecurity/CHANGELOG.md index 366c9afc01bb..88f8c2c4131b 100644 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/CHANGELOG.md +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/CHANGELOG.md @@ -1,5 +1,24 @@ # Release History +## 0.6.0 (2023-04-03) +### Breaking Changes + +- Function `NewDeviceGroupsClient` parameter(s) have been changed from `(string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*DeviceGroupsClient.CreateOrUpdate` parameter(s) have been changed from `(context.Context, string, DeviceGroupModel, *DeviceGroupsClientCreateOrUpdateOptions)` to `(context.Context, string, string, DeviceGroupModel, *DeviceGroupsClientCreateOrUpdateOptions)` +- Function `*DeviceGroupsClient.Delete` parameter(s) have been changed from `(context.Context, string, *DeviceGroupsClientDeleteOptions)` to `(context.Context, string, string, *DeviceGroupsClientDeleteOptions)` +- Function `*DeviceGroupsClient.Get` parameter(s) have been changed from `(context.Context, string, *DeviceGroupsClientGetOptions)` to `(context.Context, string, string, *DeviceGroupsClientGetOptions)` +- Function `*DeviceGroupsClient.NewListPager` parameter(s) have been changed from `(*DeviceGroupsClientListOptions)` to `(string, *DeviceGroupsClientListOptions)` +- Function `NewDevicesClient` parameter(s) have been changed from `(string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*DevicesClient.Get` parameter(s) have been changed from `(context.Context, string, string, *DevicesClientGetOptions)` to `(context.Context, string, string, string, *DevicesClientGetOptions)` +- Function `*DevicesClient.NewListPager` parameter(s) have been changed from `(string, *DevicesClientListOptions)` to `(string, string, *DevicesClientListOptions)` +- Function `NewLocationsClient` parameter(s) have been changed from `(string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*LocationsClient.Get` parameter(s) have been changed from `(context.Context, *LocationsClientGetOptions)` to `(context.Context, string, *LocationsClientGetOptions)` + +### Features Added + +- New struct `ClientFactory` which is a client factory used to create any client in this module + + ## 0.5.0 (2022-05-18) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotsecurity/armiotsecurity` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 0.5.0, which contains breaking changes. diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/README.md b/sdk/resourcemanager/iotsecurity/armiotsecurity/README.md index c5c7b2e527df..8bada2d94800 100644 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/README.md +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/README.md @@ -33,12 +33,12 @@ 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). -## Clients +## Client Factory -Azure IoT Security modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. +Azure IoT Security module consists of one or more clients. We provide a client factory which could be used to create any client in this module. ```go -client, err := armiotsecurity.NewDevicesClient(, cred, nil) +clientFactory, err := armiotsecurity.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). @@ -49,7 +49,15 @@ options := arm.ClientOptions { Cloud: cloud.AzureChina, }, } -client, err := armiotsecurity.NewDevicesClient(, cred, &options) +clientFactory, err := armiotsecurity.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.NewDevicesClient() ``` ## Provide Feedback diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/autorest.md b/sdk/resourcemanager/iotsecurity/armiotsecurity/autorest.md index 5ff96f9fb16b..1e4349538982 100644 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/autorest.md +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/iotsecurity/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/iotsecurity/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.5.0 +module-version: 0.6.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/client_factory.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/client_factory.go new file mode 100644 index 000000000000..1160ffb8507e --- /dev/null +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/client_factory.go @@ -0,0 +1,79 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armiotsecurity + +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 + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// 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. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +func (c *ClientFactory) NewDefenderSettingsClient() *DefenderSettingsClient { + subClient, _ := NewDefenderSettingsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSitesClient() *SitesClient { + subClient, _ := NewSitesClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSensorsClient() *SensorsClient { + subClient, _ := NewSensorsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewOnPremiseSensorsClient() *OnPremiseSensorsClient { + subClient, _ := NewOnPremiseSensorsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewLocationsClient() *LocationsClient { + subClient, _ := NewLocationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewDeviceGroupsClient() *DeviceGroupsClient { + subClient, _ := NewDeviceGroupsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewDevicesClient() *DevicesClient { + subClient, _ := NewDevicesClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_constants.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/constants.go similarity index 99% rename from sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_constants.go rename to sdk/resourcemanager/iotsecurity/armiotsecurity/constants.go index 98a9a39e52df..cdaed6fcfc12 100644 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_constants.go +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/constants.go @@ -5,12 +5,13 @@ // 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 armiotsecurity const ( moduleName = "armiotsecurity" - moduleVersion = "v0.5.0" + moduleVersion = "v0.6.0" ) // AuthorizedState - Authorized state of the device. diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_defendersettings_client.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/defendersettings_client.go similarity index 86% rename from sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_defendersettings_client.go rename to sdk/resourcemanager/iotsecurity/armiotsecurity/defendersettings_client.go index ec6ee7668208..20e6e315b0dd 100644 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_defendersettings_client.go +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/defendersettings_client.go @@ -5,6 +5,7 @@ // 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 armiotsecurity @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,47 +24,39 @@ import ( // DefenderSettingsClient contains the methods for the DefenderSettings group. // Don't use this type directly, use NewDefenderSettingsClient() instead. type DefenderSettingsClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewDefenderSettingsClient creates a new instance of DefenderSettingsClient 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. +// - 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 NewDefenderSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DefenderSettingsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".DefenderSettingsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &DefenderSettingsClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // CreateOrUpdate - Create or update IoT Defender settings // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// defenderSettingsModel - The IoT defender settings model -// options - DefenderSettingsClientCreateOrUpdateOptions contains the optional parameters for the DefenderSettingsClient.CreateOrUpdate -// method. +// - defenderSettingsModel - The IoT defender settings model +// - options - DefenderSettingsClientCreateOrUpdateOptions contains the optional parameters for the DefenderSettingsClient.CreateOrUpdate +// method. func (client *DefenderSettingsClient) CreateOrUpdate(ctx context.Context, defenderSettingsModel DefenderSettingsModel, options *DefenderSettingsClientCreateOrUpdateOptions) (DefenderSettingsClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, defenderSettingsModel, options) if err != nil { return DefenderSettingsClientCreateOrUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return DefenderSettingsClientCreateOrUpdateResponse{}, err } @@ -82,7 +73,7 @@ func (client *DefenderSettingsClient) createOrUpdateCreateRequest(ctx context.Co 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.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -104,14 +95,15 @@ func (client *DefenderSettingsClient) createOrUpdateHandleResponse(resp *http.Re // Delete - Delete IoT Defender settings // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// options - DefenderSettingsClientDeleteOptions contains the optional parameters for the DefenderSettingsClient.Delete method. +// - options - DefenderSettingsClientDeleteOptions contains the optional parameters for the DefenderSettingsClient.Delete method. func (client *DefenderSettingsClient) Delete(ctx context.Context, options *DefenderSettingsClientDeleteOptions) (DefenderSettingsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, options) if err != nil { return DefenderSettingsClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return DefenderSettingsClientDeleteResponse{}, err } @@ -128,7 +120,7 @@ func (client *DefenderSettingsClient) deleteCreateRequest(ctx context.Context, o 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.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -141,15 +133,16 @@ func (client *DefenderSettingsClient) deleteCreateRequest(ctx context.Context, o // DownloadManagerActivation - Download manager activation data defined for this subscription // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// options - DefenderSettingsClientDownloadManagerActivationOptions contains the optional parameters for the DefenderSettingsClient.DownloadManagerActivation -// method. +// - options - DefenderSettingsClientDownloadManagerActivationOptions contains the optional parameters for the DefenderSettingsClient.DownloadManagerActivation +// method. func (client *DefenderSettingsClient) DownloadManagerActivation(ctx context.Context, options *DefenderSettingsClientDownloadManagerActivationOptions) (DefenderSettingsClientDownloadManagerActivationResponse, error) { req, err := client.downloadManagerActivationCreateRequest(ctx, options) if err != nil { return DefenderSettingsClientDownloadManagerActivationResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return DefenderSettingsClientDownloadManagerActivationResponse{}, err } @@ -166,7 +159,7 @@ func (client *DefenderSettingsClient) downloadManagerActivationCreateRequest(ctx 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -180,14 +173,15 @@ func (client *DefenderSettingsClient) downloadManagerActivationCreateRequest(ctx // Get - Get IoT Defender Settings // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// options - DefenderSettingsClientGetOptions contains the optional parameters for the DefenderSettingsClient.Get method. +// - options - DefenderSettingsClientGetOptions contains the optional parameters for the DefenderSettingsClient.Get method. func (client *DefenderSettingsClient) Get(ctx context.Context, options *DefenderSettingsClientGetOptions) (DefenderSettingsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, options) if err != nil { return DefenderSettingsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return DefenderSettingsClientGetResponse{}, err } @@ -204,7 +198,7 @@ func (client *DefenderSettingsClient) getCreateRequest(ctx context.Context, opti 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -226,14 +220,15 @@ func (client *DefenderSettingsClient) getHandleResponse(resp *http.Response) (De // List - List IoT Defender Settings // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// options - DefenderSettingsClientListOptions contains the optional parameters for the DefenderSettingsClient.List method. +// - options - DefenderSettingsClientListOptions contains the optional parameters for the DefenderSettingsClient.List method. func (client *DefenderSettingsClient) List(ctx context.Context, options *DefenderSettingsClientListOptions) (DefenderSettingsClientListResponse, error) { req, err := client.listCreateRequest(ctx, options) if err != nil { return DefenderSettingsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return DefenderSettingsClientListResponse{}, err } @@ -250,7 +245,7 @@ func (client *DefenderSettingsClient) listCreateRequest(ctx context.Context, opt 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -272,15 +267,16 @@ func (client *DefenderSettingsClient) listHandleResponse(resp *http.Response) (D // PackageDownloads - Information about downloadable packages // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// options - DefenderSettingsClientPackageDownloadsOptions contains the optional parameters for the DefenderSettingsClient.PackageDownloads -// method. +// - options - DefenderSettingsClientPackageDownloadsOptions contains the optional parameters for the DefenderSettingsClient.PackageDownloads +// method. func (client *DefenderSettingsClient) PackageDownloads(ctx context.Context, options *DefenderSettingsClientPackageDownloadsOptions) (DefenderSettingsClientPackageDownloadsResponse, error) { req, err := client.packageDownloadsCreateRequest(ctx, options) if err != nil { return DefenderSettingsClientPackageDownloadsResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return DefenderSettingsClientPackageDownloadsResponse{}, err } @@ -297,7 +293,7 @@ func (client *DefenderSettingsClient) packageDownloadsCreateRequest(ctx context. 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/defendersettings_client_example_test.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/defendersettings_client_example_test.go new file mode 100644 index 000000000000..455ed4a9f37f --- /dev/null +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/defendersettings_client_example_test.go @@ -0,0 +1,333 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armiotsecurity_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/iotsecurity/armiotsecurity" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/DefenderSettings/List.json +func ExampleDefenderSettingsClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewDefenderSettingsClient().List(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.DefenderSettingsList = armiotsecurity.DefenderSettingsList{ + // Value: []*armiotsecurity.DefenderSettingsModel{ + // { + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.IoTSecurity/defenderSettings"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/providers/Microsoft.IoTSecurity/defenderSettings/default"), + // Properties: &armiotsecurity.DefenderSettingsProperties{ + // DeviceQuota: to.Ptr[int32](2000), + // MdeIntegration: &armiotsecurity.DefenderSettingsPropertiesMdeIntegration{ + // Status: to.Ptr(armiotsecurity.MdeIntegrationEnabled), + // }, + // OnboardingKind: to.Ptr(armiotsecurity.OnboardingKindDefault), + // SentinelWorkspaceResourceIDs: []*string{ + // to.Ptr("/subscriptions/c4930e90-cd72-4aa5-93e9-2d081d129569/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace1")}, + // }, + // }}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/DefenderSettings/Get.json +func ExampleDefenderSettingsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewDefenderSettingsClient().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.DefenderSettingsModel = armiotsecurity.DefenderSettingsModel{ + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.IoTSecurity/defenderSettings"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/providers/Microsoft.IoTSecurity/defenderSettings/default"), + // Properties: &armiotsecurity.DefenderSettingsProperties{ + // DeviceQuota: to.Ptr[int32](2000), + // EvaluationEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-29T00:00:00.0000000Z"); return t}()), + // MdeIntegration: &armiotsecurity.DefenderSettingsPropertiesMdeIntegration{ + // Status: to.Ptr(armiotsecurity.MdeIntegrationEnabled), + // }, + // OnboardingKind: to.Ptr(armiotsecurity.OnboardingKindEvaluation), + // SentinelWorkspaceResourceIDs: []*string{ + // to.Ptr("/subscriptions/c4930e90-cd72-4aa5-93e9-2d081d129569/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace1")}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/DefenderSettings/Put.json +func ExampleDefenderSettingsClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewDefenderSettingsClient().CreateOrUpdate(ctx, armiotsecurity.DefenderSettingsModel{ + Properties: &armiotsecurity.DefenderSettingsProperties{ + DeviceQuota: to.Ptr[int32](2000), + MdeIntegration: &armiotsecurity.DefenderSettingsPropertiesMdeIntegration{ + Status: to.Ptr(armiotsecurity.MdeIntegrationEnabled), + }, + OnboardingKind: to.Ptr(armiotsecurity.OnboardingKindDefault), + SentinelWorkspaceResourceIDs: []*string{ + to.Ptr("/subscriptions/c4930e90-cd72-4aa5-93e9-2d081d129569/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace1")}, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.DefenderSettingsModel = armiotsecurity.DefenderSettingsModel{ + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.IoTSecurity/defenderSettings"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/providers/Microsoft.IoTSecurity/defenderSettings/default"), + // Properties: &armiotsecurity.DefenderSettingsProperties{ + // DeviceQuota: to.Ptr[int32](2000), + // MdeIntegration: &armiotsecurity.DefenderSettingsPropertiesMdeIntegration{ + // Status: to.Ptr(armiotsecurity.MdeIntegrationEnabled), + // }, + // OnboardingKind: to.Ptr(armiotsecurity.OnboardingKindDefault), + // SentinelWorkspaceResourceIDs: []*string{ + // to.Ptr("/subscriptions/c4930e90-cd72-4aa5-93e9-2d081d129569/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace1")}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/DefenderSettings/Delete.json +func ExampleDefenderSettingsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewDefenderSettingsClient().Delete(ctx, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/DefenderSettings/PackageDownloads.json +func ExampleDefenderSettingsClient_PackageDownloads() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewDefenderSettingsClient().PackageDownloads(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.PackageDownloads = armiotsecurity.PackageDownloads{ + // AuthorizedDevicesImportTemplate: []*armiotsecurity.PackageDownloadInfo{ + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("2020.02.10"), + // }}, + // CentralManager: &armiotsecurity.PackageDownloadsCentralManager{ + // Full: &armiotsecurity.PackageDownloadsCentralManagerFull{ + // Iso: []*armiotsecurity.PackageDownloadInfo{ + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("3.1"), + // VersionKind: to.Ptr(armiotsecurity.VersionKindLatest), + // }, + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("2.8.11"), + // VersionKind: to.Ptr(armiotsecurity.VersionKindPrevious), + // }}, + // Ovf: &armiotsecurity.PackageDownloadsCentralManagerFullOvf{ + // Enterprise: []*armiotsecurity.PackageDownloadInfo{ + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("3.1"), + // VersionKind: to.Ptr(armiotsecurity.VersionKindLatest), + // }}, + // EnterpriseHighAvailability: []*armiotsecurity.PackageDownloadInfo{ + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("3.1"), + // VersionKind: to.Ptr(armiotsecurity.VersionKindLatest), + // }}, + // Medium: []*armiotsecurity.PackageDownloadInfo{ + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("3.1"), + // VersionKind: to.Ptr(armiotsecurity.VersionKindLatest), + // }}, + // MediumHighAvailability: []*armiotsecurity.PackageDownloadInfo{ + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("3.1"), + // VersionKind: to.Ptr(armiotsecurity.VersionKindLatest), + // }}, + // }, + // }, + // Upgrade: []*armiotsecurity.UpgradePackageDownloadInfo{ + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("2.8.2"), + // VersionKind: to.Ptr(armiotsecurity.VersionKindLatest), + // FromVersion: to.Ptr("2.8.0"), + // }, + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("2.8.10"), + // VersionKind: to.Ptr(armiotsecurity.VersionKindPrevious), + // FromVersion: to.Ptr("2.8.0"), + // }}, + // }, + // DeviceInformationUpdateImportTemplate: []*armiotsecurity.PackageDownloadInfo{ + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("2020.02.10"), + // }}, + // Sensor: &armiotsecurity.PackageDownloadsSensor{ + // Full: &armiotsecurity.PackageDownloadsSensorFull{ + // Iso: []*armiotsecurity.PackageDownloadInfo{ + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("3.1"), + // VersionKind: to.Ptr(armiotsecurity.VersionKindLatest), + // }, + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("2.8.11"), + // VersionKind: to.Ptr(armiotsecurity.VersionKindPrevious), + // }}, + // Ovf: &armiotsecurity.PackageDownloadsSensorFullOvf{ + // Enterprise: []*armiotsecurity.PackageDownloadInfo{ + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("3.1"), + // VersionKind: to.Ptr(armiotsecurity.VersionKindLatest), + // }, + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("2.8.11"), + // VersionKind: to.Ptr(armiotsecurity.VersionKindPrevious), + // }}, + // Line: []*armiotsecurity.PackageDownloadInfo{ + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("3.1"), + // VersionKind: to.Ptr(armiotsecurity.VersionKindLatest), + // }, + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("2.8.11"), + // VersionKind: to.Ptr(armiotsecurity.VersionKindPrevious), + // }}, + // Medium: []*armiotsecurity.PackageDownloadInfo{ + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("3.1"), + // VersionKind: to.Ptr(armiotsecurity.VersionKindLatest), + // }, + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("2.8.11"), + // VersionKind: to.Ptr(armiotsecurity.VersionKindPrevious), + // }}, + // }, + // }, + // Upgrade: []*armiotsecurity.UpgradePackageDownloadInfo{ + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("2.8.2"), + // VersionKind: to.Ptr(armiotsecurity.VersionKindLatest), + // FromVersion: to.Ptr("2.8.0"), + // }, + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("2.8.10"), + // VersionKind: to.Ptr(armiotsecurity.VersionKindPrevious), + // FromVersion: to.Ptr("2.8.0"), + // }}, + // }, + // Snmp: []*armiotsecurity.PackageDownloadInfo{ + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("2020.02.10"), + // }}, + // ThreatIntelligence: []*armiotsecurity.PackageDownloadInfo{ + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("2020.02.10"), + // }}, + // WmiTool: []*armiotsecurity.PackageDownloadInfo{ + // { + // Link: to.Ptr("http://microsoft.com/downloadLocation"), + // Version: to.Ptr("2020.02.10"), + // }}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/DefenderSettings/DownloadManagerActivation.json +func ExampleDefenderSettingsClient_DownloadManagerActivation() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewDefenderSettingsClient().DownloadManagerActivation(ctx, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_devicegroups_client.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/devicegroups_client.go similarity index 67% rename from sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_devicegroups_client.go rename to sdk/resourcemanager/iotsecurity/armiotsecurity/devicegroups_client.go index 7baaaacc6252..63c8b520ed85 100644 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_devicegroups_client.go +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/devicegroups_client.go @@ -5,6 +5,7 @@ // 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 armiotsecurity @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,51 +24,41 @@ import ( // DeviceGroupsClient contains the methods for the DeviceGroups group. // Don't use this type directly, use NewDeviceGroupsClient() instead. type DeviceGroupsClient struct { - host string - subscriptionID string - iotDefenderLocation string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewDeviceGroupsClient creates a new instance of DeviceGroupsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// iotDefenderLocation - Defender for IoT location -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewDeviceGroupsClient(subscriptionID string, iotDefenderLocation string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeviceGroupsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - 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 NewDeviceGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeviceGroupsClient, error) { + cl, err := arm.NewClient(moduleName+".DeviceGroupsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &DeviceGroupsClient{ - subscriptionID: subscriptionID, - iotDefenderLocation: iotDefenderLocation, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // CreateOrUpdate - Create or update device group // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// deviceGroupName - Device group name -// deviceGroupModel - Device group model -// options - DeviceGroupsClientCreateOrUpdateOptions contains the optional parameters for the DeviceGroupsClient.CreateOrUpdate -// method. -func (client *DeviceGroupsClient) CreateOrUpdate(ctx context.Context, deviceGroupName string, deviceGroupModel DeviceGroupModel, options *DeviceGroupsClientCreateOrUpdateOptions) (DeviceGroupsClientCreateOrUpdateResponse, error) { - req, err := client.createOrUpdateCreateRequest(ctx, deviceGroupName, deviceGroupModel, options) +// - iotDefenderLocation - Defender for IoT location +// - deviceGroupName - Device group name +// - deviceGroupModel - Device group model +// - options - DeviceGroupsClientCreateOrUpdateOptions contains the optional parameters for the DeviceGroupsClient.CreateOrUpdate +// method. +func (client *DeviceGroupsClient) CreateOrUpdate(ctx context.Context, iotDefenderLocation string, deviceGroupName string, deviceGroupModel DeviceGroupModel, options *DeviceGroupsClientCreateOrUpdateOptions) (DeviceGroupsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, iotDefenderLocation, deviceGroupName, deviceGroupModel, options) if err != nil { return DeviceGroupsClientCreateOrUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeviceGroupsClientCreateOrUpdateResponse{}, err } @@ -80,21 +69,21 @@ func (client *DeviceGroupsClient) CreateOrUpdate(ctx context.Context, deviceGrou } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DeviceGroupsClient) createOrUpdateCreateRequest(ctx context.Context, deviceGroupName string, deviceGroupModel DeviceGroupModel, options *DeviceGroupsClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *DeviceGroupsClient) createOrUpdateCreateRequest(ctx context.Context, iotDefenderLocation string, deviceGroupName string, deviceGroupModel DeviceGroupModel, options *DeviceGroupsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.IoTSecurity/locations/{iotDefenderLocation}/deviceGroups/{deviceGroupName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if client.iotDefenderLocation == "" { - return nil, errors.New("parameter client.iotDefenderLocation cannot be empty") + if iotDefenderLocation == "" { + return nil, errors.New("parameter iotDefenderLocation cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{iotDefenderLocation}", url.PathEscape(client.iotDefenderLocation)) + urlPath = strings.ReplaceAll(urlPath, "{iotDefenderLocation}", url.PathEscape(iotDefenderLocation)) if deviceGroupName == "" { return nil, errors.New("parameter deviceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deviceGroupName}", url.PathEscape(deviceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -116,15 +105,17 @@ func (client *DeviceGroupsClient) createOrUpdateHandleResponse(resp *http.Respon // Delete - Delete device group // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// deviceGroupName - Device group name -// options - DeviceGroupsClientDeleteOptions contains the optional parameters for the DeviceGroupsClient.Delete method. -func (client *DeviceGroupsClient) Delete(ctx context.Context, deviceGroupName string, options *DeviceGroupsClientDeleteOptions) (DeviceGroupsClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, deviceGroupName, options) +// - iotDefenderLocation - Defender for IoT location +// - deviceGroupName - Device group name +// - options - DeviceGroupsClientDeleteOptions contains the optional parameters for the DeviceGroupsClient.Delete method. +func (client *DeviceGroupsClient) Delete(ctx context.Context, iotDefenderLocation string, deviceGroupName string, options *DeviceGroupsClientDeleteOptions) (DeviceGroupsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, iotDefenderLocation, deviceGroupName, options) if err != nil { return DeviceGroupsClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeviceGroupsClientDeleteResponse{}, err } @@ -135,21 +126,21 @@ func (client *DeviceGroupsClient) Delete(ctx context.Context, deviceGroupName st } // deleteCreateRequest creates the Delete request. -func (client *DeviceGroupsClient) deleteCreateRequest(ctx context.Context, deviceGroupName string, options *DeviceGroupsClientDeleteOptions) (*policy.Request, error) { +func (client *DeviceGroupsClient) deleteCreateRequest(ctx context.Context, iotDefenderLocation string, deviceGroupName string, options *DeviceGroupsClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.IoTSecurity/locations/{iotDefenderLocation}/deviceGroups/{deviceGroupName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if client.iotDefenderLocation == "" { - return nil, errors.New("parameter client.iotDefenderLocation cannot be empty") + if iotDefenderLocation == "" { + return nil, errors.New("parameter iotDefenderLocation cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{iotDefenderLocation}", url.PathEscape(client.iotDefenderLocation)) + urlPath = strings.ReplaceAll(urlPath, "{iotDefenderLocation}", url.PathEscape(iotDefenderLocation)) if deviceGroupName == "" { return nil, errors.New("parameter deviceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deviceGroupName}", url.PathEscape(deviceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -162,15 +153,17 @@ func (client *DeviceGroupsClient) deleteCreateRequest(ctx context.Context, devic // Get - Get device group // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// deviceGroupName - Device group name -// options - DeviceGroupsClientGetOptions contains the optional parameters for the DeviceGroupsClient.Get method. -func (client *DeviceGroupsClient) Get(ctx context.Context, deviceGroupName string, options *DeviceGroupsClientGetOptions) (DeviceGroupsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, deviceGroupName, options) +// - iotDefenderLocation - Defender for IoT location +// - deviceGroupName - Device group name +// - options - DeviceGroupsClientGetOptions contains the optional parameters for the DeviceGroupsClient.Get method. +func (client *DeviceGroupsClient) Get(ctx context.Context, iotDefenderLocation string, deviceGroupName string, options *DeviceGroupsClientGetOptions) (DeviceGroupsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, iotDefenderLocation, deviceGroupName, options) if err != nil { return DeviceGroupsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeviceGroupsClientGetResponse{}, err } @@ -181,21 +174,21 @@ func (client *DeviceGroupsClient) Get(ctx context.Context, deviceGroupName strin } // getCreateRequest creates the Get request. -func (client *DeviceGroupsClient) getCreateRequest(ctx context.Context, deviceGroupName string, options *DeviceGroupsClientGetOptions) (*policy.Request, error) { +func (client *DeviceGroupsClient) getCreateRequest(ctx context.Context, iotDefenderLocation string, deviceGroupName string, options *DeviceGroupsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.IoTSecurity/locations/{iotDefenderLocation}/deviceGroups/{deviceGroupName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if client.iotDefenderLocation == "" { - return nil, errors.New("parameter client.iotDefenderLocation cannot be empty") + if iotDefenderLocation == "" { + return nil, errors.New("parameter iotDefenderLocation cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{iotDefenderLocation}", url.PathEscape(client.iotDefenderLocation)) + urlPath = strings.ReplaceAll(urlPath, "{iotDefenderLocation}", url.PathEscape(iotDefenderLocation)) if deviceGroupName == "" { return nil, errors.New("parameter deviceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deviceGroupName}", url.PathEscape(deviceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -216,10 +209,11 @@ func (client *DeviceGroupsClient) getHandleResponse(resp *http.Response) (Device } // NewListPager - List device groups -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// options - DeviceGroupsClientListOptions contains the optional parameters for the DeviceGroupsClient.List method. -func (client *DeviceGroupsClient) NewListPager(options *DeviceGroupsClientListOptions) *runtime.Pager[DeviceGroupsClientListResponse] { +// - iotDefenderLocation - Defender for IoT location +// - options - DeviceGroupsClientListOptions contains the optional parameters for the DeviceGroupsClient.NewListPager method. +func (client *DeviceGroupsClient) NewListPager(iotDefenderLocation string, options *DeviceGroupsClientListOptions) *runtime.Pager[DeviceGroupsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[DeviceGroupsClientListResponse]{ More: func(page DeviceGroupsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -228,14 +222,14 @@ func (client *DeviceGroupsClient) NewListPager(options *DeviceGroupsClientListOp var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, iotDefenderLocation, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return DeviceGroupsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return DeviceGroupsClientListResponse{}, err } @@ -248,17 +242,17 @@ func (client *DeviceGroupsClient) NewListPager(options *DeviceGroupsClientListOp } // listCreateRequest creates the List request. -func (client *DeviceGroupsClient) listCreateRequest(ctx context.Context, options *DeviceGroupsClientListOptions) (*policy.Request, error) { +func (client *DeviceGroupsClient) listCreateRequest(ctx context.Context, iotDefenderLocation string, options *DeviceGroupsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.IoTSecurity/locations/{iotDefenderLocation}/deviceGroups" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if client.iotDefenderLocation == "" { - return nil, errors.New("parameter client.iotDefenderLocation cannot be empty") + if iotDefenderLocation == "" { + return nil, errors.New("parameter iotDefenderLocation cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{iotDefenderLocation}", url.PathEscape(client.iotDefenderLocation)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + urlPath = strings.ReplaceAll(urlPath, "{iotDefenderLocation}", url.PathEscape(iotDefenderLocation)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/devicegroups_client_example_test.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/devicegroups_client_example_test.go new file mode 100644 index 000000000000..a65b22f6067b --- /dev/null +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/devicegroups_client_example_test.go @@ -0,0 +1,150 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armiotsecurity_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotsecurity/armiotsecurity" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/DeviceGroups/List.json +func ExampleDeviceGroupsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewDeviceGroupsClient().NewListPager("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.DeviceGroupList = armiotsecurity.DeviceGroupList{ + // Value: []*armiotsecurity.DeviceGroupModel{ + // { + // Name: to.Ptr("myGroup"), + // Type: to.Ptr("Microsoft.IoTSecurity/locations/deviceGroups"), + // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.IoTSecurity/locations/eastus/deviceGroups/myGroup"), + // Properties: map[string]any{ + // }, + // SystemData: &armiotsecurity.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/DeviceGroups/Get.json +func ExampleDeviceGroupsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewDeviceGroupsClient().Get(ctx, "eastus", "myGroup", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.DeviceGroupModel = armiotsecurity.DeviceGroupModel{ + // Name: to.Ptr("myGroup"), + // Type: to.Ptr("Microsoft.IoTSecurity/locations/deviceGroups"), + // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.IoTSecurity/locations/eastus/deviceGroups/myGroup"), + // Properties: map[string]any{ + // }, + // SystemData: &armiotsecurity.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/DeviceGroups/Put.json +func ExampleDeviceGroupsClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewDeviceGroupsClient().CreateOrUpdate(ctx, "eastus", "myGroup", armiotsecurity.DeviceGroupModel{ + 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.DeviceGroupModel = armiotsecurity.DeviceGroupModel{ + // Name: to.Ptr("myGroup"), + // Type: to.Ptr("Microsoft.IoTSecurity/locations/deviceGroups"), + // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.IoTSecurity/deviceGroups/myGroup"), + // Properties: map[string]any{ + // }, + // SystemData: &armiotsecurity.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/DeviceGroups/Delete.json +func ExampleDeviceGroupsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewDeviceGroupsClient().Delete(ctx, "eastus", "myGroup", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_devices_client.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/devices_client.go similarity index 66% rename from sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_devices_client.go rename to sdk/resourcemanager/iotsecurity/armiotsecurity/devices_client.go index 2e3f60ea0d92..f035d4f93d76 100644 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_devices_client.go +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/devices_client.go @@ -5,6 +5,7 @@ // 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 armiotsecurity @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,50 +24,40 @@ import ( // DevicesClient contains the methods for the Devices group. // Don't use this type directly, use NewDevicesClient() instead. type DevicesClient struct { - host string - subscriptionID string - iotDefenderLocation string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewDevicesClient creates a new instance of DevicesClient with the specified values. -// subscriptionID - The ID of the target subscription. -// iotDefenderLocation - Defender for IoT location -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewDevicesClient(subscriptionID string, iotDefenderLocation string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DevicesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - 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 NewDevicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DevicesClient, error) { + cl, err := arm.NewClient(moduleName+".DevicesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &DevicesClient{ - subscriptionID: subscriptionID, - iotDefenderLocation: iotDefenderLocation, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // Get - Get device // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// deviceGroupName - Device group name -// deviceID - Device Id -// options - DevicesClientGetOptions contains the optional parameters for the DevicesClient.Get method. -func (client *DevicesClient) Get(ctx context.Context, deviceGroupName string, deviceID string, options *DevicesClientGetOptions) (DevicesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, deviceGroupName, deviceID, options) +// - iotDefenderLocation - Defender for IoT location +// - deviceGroupName - Device group name +// - deviceID - Device Id +// - options - DevicesClientGetOptions contains the optional parameters for the DevicesClient.Get method. +func (client *DevicesClient) Get(ctx context.Context, iotDefenderLocation string, deviceGroupName string, deviceID string, options *DevicesClientGetOptions) (DevicesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, iotDefenderLocation, deviceGroupName, deviceID, options) if err != nil { return DevicesClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return DevicesClientGetResponse{}, err } @@ -79,16 +68,16 @@ func (client *DevicesClient) Get(ctx context.Context, deviceGroupName string, de } // getCreateRequest creates the Get request. -func (client *DevicesClient) getCreateRequest(ctx context.Context, deviceGroupName string, deviceID string, options *DevicesClientGetOptions) (*policy.Request, error) { +func (client *DevicesClient) getCreateRequest(ctx context.Context, iotDefenderLocation string, deviceGroupName string, deviceID string, options *DevicesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.IoTSecurity/locations/{iotDefenderLocation}/deviceGroups/{deviceGroupName}/devices/{deviceId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if client.iotDefenderLocation == "" { - return nil, errors.New("parameter client.iotDefenderLocation cannot be empty") + if iotDefenderLocation == "" { + return nil, errors.New("parameter iotDefenderLocation cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{iotDefenderLocation}", url.PathEscape(client.iotDefenderLocation)) + urlPath = strings.ReplaceAll(urlPath, "{iotDefenderLocation}", url.PathEscape(iotDefenderLocation)) if deviceGroupName == "" { return nil, errors.New("parameter deviceGroupName cannot be empty") } @@ -97,7 +86,7 @@ func (client *DevicesClient) getCreateRequest(ctx context.Context, deviceGroupNa return nil, errors.New("parameter deviceID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deviceId}", url.PathEscape(deviceID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -118,11 +107,12 @@ func (client *DevicesClient) getHandleResponse(resp *http.Response) (DevicesClie } // NewListPager - List devices -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// deviceGroupName - Device group name -// options - DevicesClientListOptions contains the optional parameters for the DevicesClient.List method. -func (client *DevicesClient) NewListPager(deviceGroupName string, options *DevicesClientListOptions) *runtime.Pager[DevicesClientListResponse] { +// - iotDefenderLocation - Defender for IoT location +// - deviceGroupName - Device group name +// - options - DevicesClientListOptions contains the optional parameters for the DevicesClient.NewListPager method. +func (client *DevicesClient) NewListPager(iotDefenderLocation string, deviceGroupName string, options *DevicesClientListOptions) *runtime.Pager[DevicesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[DevicesClientListResponse]{ More: func(page DevicesClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -131,14 +121,14 @@ func (client *DevicesClient) NewListPager(deviceGroupName string, options *Devic var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, deviceGroupName, options) + req, err = client.listCreateRequest(ctx, iotDefenderLocation, deviceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return DevicesClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return DevicesClientListResponse{}, err } @@ -151,21 +141,21 @@ func (client *DevicesClient) NewListPager(deviceGroupName string, options *Devic } // listCreateRequest creates the List request. -func (client *DevicesClient) listCreateRequest(ctx context.Context, deviceGroupName string, options *DevicesClientListOptions) (*policy.Request, error) { +func (client *DevicesClient) listCreateRequest(ctx context.Context, iotDefenderLocation string, deviceGroupName string, options *DevicesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.IoTSecurity/locations/{iotDefenderLocation}/deviceGroups/{deviceGroupName}/devices" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if client.iotDefenderLocation == "" { - return nil, errors.New("parameter client.iotDefenderLocation cannot be empty") + if iotDefenderLocation == "" { + return nil, errors.New("parameter iotDefenderLocation cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{iotDefenderLocation}", url.PathEscape(client.iotDefenderLocation)) + urlPath = strings.ReplaceAll(urlPath, "{iotDefenderLocation}", url.PathEscape(iotDefenderLocation)) if deviceGroupName == "" { return nil, errors.New("parameter deviceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{deviceGroupName}", url.PathEscape(deviceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/devices_client_example_test.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/devices_client_example_test.go new file mode 100644 index 000000000000..1cde3cb56417 --- /dev/null +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/devices_client_example_test.go @@ -0,0 +1,174 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armiotsecurity_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotsecurity/armiotsecurity" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Devices/List.json +func ExampleDevicesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewDevicesClient().NewListPager("eastus", "myGroup", &armiotsecurity.DevicesClientListOptions{SkipToken: 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.DeviceList = armiotsecurity.DeviceList{ + // Value: []*armiotsecurity.DeviceModel{ + // { + // Name: to.Ptr("fa30e727-16e1-4e81-84f1-d26b9153d1b2"), + // Type: to.Ptr("Microsoft.IoTSecurity/locations/deviceGroups/devices"), + // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.IoTSecurity/locations/eastus/deviceGroups/myGroup/devices/fa30e727-16e1-4e81-84f1-d26b9153d1b2"), + // Properties: &armiotsecurity.DeviceProperties{ + // AuthorizedState: to.Ptr(armiotsecurity.AuthorizedStateAuthorized), + // Criticality: to.Ptr(armiotsecurity.CriticalityNormal), + // DeviceCategoryDisplayName: to.Ptr("OT"), + // DeviceCategoryID: to.Ptr[int32](6), + // DeviceDataSource: to.Ptr(armiotsecurity.DeviceDataSourceOtSensor), + // DeviceName: to.Ptr("10.168.140.1"), + // DeviceStatus: to.Ptr(armiotsecurity.DeviceStatusActive), + // DeviceSubTypeDisplayName: to.Ptr("Historian"), + // DeviceSubTypeID: to.Ptr[int32](2), + // DeviceTypeDisplayName: to.Ptr("Industrial"), + // DeviceTypeID: to.Ptr[int32](17), + // FirstSeen: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-13T06:32:25Z"); return t}()), + // LastSeen: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-13T06:32:25Z"); return t}()), + // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-13T06:32:25Z"); return t}()), + // Nics: []*armiotsecurity.Nic{ + // { + // IPv4Address: to.Ptr("10.168.140.1"), + // LastSeen: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-13T06:32:25Z"); return t}()), + // MacAddress: to.Ptr("34-E1-2D-77-80-D0"), + // MacCertainty: to.Ptr(armiotsecurity.MacCertaintyCertain), + // Vlans: []*string{ + // to.Ptr("name(1)->2"), + // to.Ptr("3"), + // to.Ptr("another_name(4)")}, + // }}, + // OnboardingStatus: to.Ptr(armiotsecurity.OnboardingStatusInsufficientInfo), + // OperatingSystem: &armiotsecurity.OperatingSystem{ + // Platform: to.Ptr("Windows"), + // Version: to.Ptr("10\\1604"), + // }, + // ProgrammingState: to.Ptr(armiotsecurity.ProgrammingStateNotProgrammingDevice), + // PurdueLevel: to.Ptr(armiotsecurity.PurdueLevelProcessControl), + // RiskScore: to.Ptr[int32](90), + // SchemaVersion: to.Ptr("1"), + // Sensor: &armiotsecurity.Sensor{ + // Name: to.Ptr("mySensor"), + // Site: to.Ptr("mySite"), + // Zone: to.Ptr("myZone"), + // }, + // }, + // SystemData: &armiotsecurity.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Devices/Get.json +func ExampleDevicesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewDevicesClient().Get(ctx, "eastus", "myGroup", "fa30e727-16e1-4e81-84f1-d26b9153d1b2", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.DeviceModel = armiotsecurity.DeviceModel{ + // Name: to.Ptr("fa30e727-16e1-4e81-84f1-d26b9153d1b2"), + // Type: to.Ptr("Microsoft.IoTSecurity/locations/deviceGroups/devices"), + // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.IoTSecurity/locations/eastus/deviceGroups/myGroup/devices/fa30e727-16e1-4e81-84f1-d26b9153d1b2"), + // Properties: &armiotsecurity.DeviceProperties{ + // AuthorizedState: to.Ptr(armiotsecurity.AuthorizedStateAuthorized), + // Criticality: to.Ptr(armiotsecurity.CriticalityNormal), + // DeviceCategoryDisplayName: to.Ptr("OT"), + // DeviceCategoryID: to.Ptr[int32](6), + // DeviceDataSource: to.Ptr(armiotsecurity.DeviceDataSourceOtSensor), + // DeviceName: to.Ptr("10.168.140.1"), + // DeviceStatus: to.Ptr(armiotsecurity.DeviceStatusActive), + // DeviceSubTypeDisplayName: to.Ptr("Historian"), + // DeviceSubTypeID: to.Ptr[int32](2), + // DeviceTypeDisplayName: to.Ptr("Industrial"), + // DeviceTypeID: to.Ptr[int32](17), + // FirstSeen: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-13T06:32:25Z"); return t}()), + // LastSeen: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-13T06:32:25Z"); return t}()), + // LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-13T06:32:25Z"); return t}()), + // Nics: []*armiotsecurity.Nic{ + // { + // IPv4Address: to.Ptr("10.168.140.1"), + // LastSeen: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-13T06:32:25Z"); return t}()), + // MacAddress: to.Ptr("34-E1-2D-77-80-D0"), + // MacCertainty: to.Ptr(armiotsecurity.MacCertaintyCertain), + // Vlans: []*string{ + // to.Ptr("name(1)->2"), + // to.Ptr("3"), + // to.Ptr("another_name(4)")}, + // }}, + // OnboardingStatus: to.Ptr(armiotsecurity.OnboardingStatusInsufficientInfo), + // OperatingSystem: &armiotsecurity.OperatingSystem{ + // Platform: to.Ptr("Windows"), + // Version: to.Ptr("10\\1604"), + // }, + // ProgrammingState: to.Ptr(armiotsecurity.ProgrammingStateNotProgrammingDevice), + // PurdueLevel: to.Ptr(armiotsecurity.PurdueLevelProcessControl), + // RiskScore: to.Ptr[int32](90), + // SchemaVersion: to.Ptr("1"), + // Sensor: &armiotsecurity.Sensor{ + // Name: to.Ptr("mySensor"), + // Site: to.Ptr("mySite"), + // Zone: to.Ptr("myZone"), + // }, + // }, + // SystemData: &armiotsecurity.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // }, + // } +} diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/go.mod b/sdk/resourcemanager/iotsecurity/armiotsecurity/go.mod index cb64ea65525e..8ace17f4bfaa 100644 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/go.mod +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/go.mod @@ -3,19 +3,19 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotsecurity/armiots go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect + github.com/golang-jwt/jwt/v4 v4.5.0 // indirect + github.com/google/uuid v1.3.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect - golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect - golang.org/x/text v0.3.7 // indirect + github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect + golang.org/x/crypto v0.6.0 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect ) diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/go.sum b/sdk/resourcemanager/iotsecurity/armiotsecurity/go.sum index ed5b814680ee..8ba445a8c4da 100644 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/go.sum +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/go.sum @@ -1,33 +1,31 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= +github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.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/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= +golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_locations_client.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/locations_client.go similarity index 71% rename from sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_locations_client.go rename to sdk/resourcemanager/iotsecurity/armiotsecurity/locations_client.go index 324f6910fe90..059881151bf4 100644 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_locations_client.go +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/locations_client.go @@ -5,6 +5,7 @@ // 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 armiotsecurity @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,48 +24,38 @@ import ( // LocationsClient contains the methods for the Locations group. // Don't use this type directly, use NewLocationsClient() instead. type LocationsClient struct { - host string - subscriptionID string - iotDefenderLocation string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewLocationsClient creates a new instance of LocationsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// iotDefenderLocation - Defender for IoT location -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewLocationsClient(subscriptionID string, iotDefenderLocation string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocationsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - 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 NewLocationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocationsClient, error) { + cl, err := arm.NewClient(moduleName+".LocationsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &LocationsClient{ - subscriptionID: subscriptionID, - iotDefenderLocation: iotDefenderLocation, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // Get - Get a Defender for IoT location associated with the given subscription. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// options - LocationsClientGetOptions contains the optional parameters for the LocationsClient.Get method. -func (client *LocationsClient) Get(ctx context.Context, options *LocationsClientGetOptions) (LocationsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, options) +// - iotDefenderLocation - Defender for IoT location +// - options - LocationsClientGetOptions contains the optional parameters for the LocationsClient.Get method. +func (client *LocationsClient) Get(ctx context.Context, iotDefenderLocation string, options *LocationsClientGetOptions) (LocationsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, iotDefenderLocation, options) if err != nil { return LocationsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return LocationsClientGetResponse{}, err } @@ -77,17 +66,17 @@ func (client *LocationsClient) Get(ctx context.Context, options *LocationsClient } // getCreateRequest creates the Get request. -func (client *LocationsClient) getCreateRequest(ctx context.Context, options *LocationsClientGetOptions) (*policy.Request, error) { +func (client *LocationsClient) getCreateRequest(ctx context.Context, iotDefenderLocation string, options *LocationsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.IoTSecurity/locations/{iotDefenderLocation}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if client.iotDefenderLocation == "" { - return nil, errors.New("parameter client.iotDefenderLocation cannot be empty") + if iotDefenderLocation == "" { + return nil, errors.New("parameter iotDefenderLocation cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{iotDefenderLocation}", url.PathEscape(client.iotDefenderLocation)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + urlPath = strings.ReplaceAll(urlPath, "{iotDefenderLocation}", url.PathEscape(iotDefenderLocation)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -108,9 +97,9 @@ func (client *LocationsClient) getHandleResponse(resp *http.Response) (Locations } // NewListPager - Lists Defender for IoT locations associated with the given subscription. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// options - LocationsClientListOptions contains the optional parameters for the LocationsClient.List method. +// - options - LocationsClientListOptions contains the optional parameters for the LocationsClient.NewListPager method. func (client *LocationsClient) NewListPager(options *LocationsClientListOptions) *runtime.Pager[LocationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[LocationsClientListResponse]{ More: func(page LocationsClientListResponse) bool { @@ -127,7 +116,7 @@ func (client *LocationsClient) NewListPager(options *LocationsClientListOptions) if err != nil { return LocationsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return LocationsClientListResponse{}, err } @@ -146,7 +135,7 @@ func (client *LocationsClient) listCreateRequest(ctx context.Context, options *L 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/locations_client_example_test.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/locations_client_example_test.go new file mode 100644 index 000000000000..47df3b1c37c0 --- /dev/null +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/locations_client_example_test.go @@ -0,0 +1,96 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armiotsecurity_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotsecurity/armiotsecurity" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Locations/List.json +func ExampleLocationsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewLocationsClient().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.LocationList = armiotsecurity.LocationList{ + // Value: []*armiotsecurity.LocationModel{ + // { + // Name: to.Ptr("eastus"), + // Type: to.Ptr("Microsoft.IoTSecurity/locations"), + // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.IoTSecurity/locations/eastus"), + // Properties: map[string]any{ + // }, + // SystemData: &armiotsecurity.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Locations/Get.json +func ExampleLocationsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocationsClient().Get(ctx, "eastus", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.LocationModel = armiotsecurity.LocationModel{ + // Name: to.Ptr("eastus"), + // Type: to.Ptr("Microsoft.IoTSecurity/locations"), + // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.IoTSecurity/locations/eastus"), + // Properties: map[string]any{ + // }, + // SystemData: &armiotsecurity.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // }, + // } +} diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_models.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/models.go similarity index 98% rename from sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_models.go rename to sdk/resourcemanager/iotsecurity/armiotsecurity/models.go index cfd0c58a8581..a65dc76c97fa 100644 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_models.go +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/models.go @@ -5,6 +5,7 @@ // 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 armiotsecurity @@ -100,7 +101,7 @@ type DeviceGroupList struct { // DeviceGroupModel - Device group type DeviceGroupModel struct { // Device group properties - Properties interface{} `json:"properties,omitempty"` + Properties any `json:"properties,omitempty"` // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string `json:"id,omitempty" azure:"ro"` @@ -130,7 +131,7 @@ type DeviceGroupsClientGetOptions struct { // placeholder for future optional parameters } -// DeviceGroupsClientListOptions contains the optional parameters for the DeviceGroupsClient.List method. +// DeviceGroupsClientListOptions contains the optional parameters for the DeviceGroupsClient.NewListPager method. type DeviceGroupsClientListOptions struct { // placeholder for future optional parameters } @@ -165,7 +166,7 @@ type DeviceModel struct { // DeviceProperties - Device properties type DeviceProperties struct { // A bag of fields which extends the device information. - AdditionalFields interface{} `json:"additionalFields,omitempty"` + AdditionalFields any `json:"additionalFields,omitempty"` // Authorized state of the device. AuthorizedState *AuthorizedState `json:"authorizedState,omitempty"` @@ -281,7 +282,7 @@ type DevicesClientGetOptions struct { // placeholder for future optional parameters } -// DevicesClientListOptions contains the optional parameters for the DevicesClient.List method. +// DevicesClientListOptions contains the optional parameters for the DevicesClient.NewListPager method. type DevicesClientListOptions struct { // Skip token used for pagination SkipToken *string @@ -302,7 +303,7 @@ type DimensionProperties struct { // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty" azure:"ro"` + Info any `json:"info,omitempty" azure:"ro"` // READ-ONLY; The additional info type. Type *string `json:"type,omitempty" azure:"ro"` @@ -372,7 +373,7 @@ type ErrorResponseModelError struct { // Firmware - Device firmware data type Firmware struct { // A bag of fields which extends the firmware information. - AdditionalFields interface{} `json:"additionalFields,omitempty"` + AdditionalFields any `json:"additionalFields,omitempty"` // Firmware module address. ModuleAddress *string `json:"moduleAddress,omitempty"` @@ -414,7 +415,7 @@ type LocationList struct { // LocationModel - IoT Defender location type LocationModel struct { // IoT Defender location properties - Properties interface{} `json:"properties,omitempty"` + Properties any `json:"properties,omitempty"` // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string `json:"id,omitempty" azure:"ro"` @@ -434,7 +435,7 @@ type LocationsClientGetOptions struct { // placeholder for future optional parameters } -// LocationsClientListOptions contains the optional parameters for the LocationsClient.List method. +// LocationsClientListOptions contains the optional parameters for the LocationsClient.NewListPager method. type LocationsClientListOptions struct { // placeholder for future optional parameters } @@ -478,7 +479,7 @@ type Nic struct { // OnPremiseSensor - On-premise IoT sensor type OnPremiseSensor struct { // On-premise IoT sensor properties - Properties interface{} `json:"properties,omitempty"` + Properties any `json:"properties,omitempty"` // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string `json:"id,omitempty" azure:"ro"` @@ -662,7 +663,7 @@ type OperationProperties struct { ServiceSpecification *OperationMetaServiceSpecification `json:"serviceSpecification,omitempty"` } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters } @@ -971,7 +972,7 @@ type SitesList struct { // Slot data in PLC backplane type Slot struct { // A bag of fields which extends the slot information. - AdditionalData interface{} `json:"additionalData,omitempty"` + AdditionalData any `json:"additionalData,omitempty"` // Firmware revision of the slot. FirmwareVersion *string `json:"firmwareVersion,omitempty"` diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/models_serde.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/models_serde.go new file mode 100644 index 000000000000..7a2e0af36b58 --- /dev/null +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/models_serde.go @@ -0,0 +1,2211 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armiotsecurity + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type DefenderSettingsList. +func (d DefenderSettingsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderSettingsList. +func (d *DefenderSettingsList) UnmarshalJSON(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 "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 DefenderSettingsModel. +func (d DefenderSettingsModel) 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, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderSettingsModel. +func (d *DefenderSettingsModel) UnmarshalJSON(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 "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 DefenderSettingsProperties. +func (d DefenderSettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "deviceQuota", d.DeviceQuota) + populateTimeRFC3339(objectMap, "evaluationEndTime", d.EvaluationEndTime) + populate(objectMap, "mdeIntegration", d.MdeIntegration) + populate(objectMap, "onboardingKind", d.OnboardingKind) + populate(objectMap, "sentinelWorkspaceResourceIds", d.SentinelWorkspaceResourceIDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderSettingsProperties. +func (d *DefenderSettingsProperties) UnmarshalJSON(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 "deviceQuota": + err = unpopulate(val, "DeviceQuota", &d.DeviceQuota) + delete(rawMsg, key) + case "evaluationEndTime": + err = unpopulateTimeRFC3339(val, "EvaluationEndTime", &d.EvaluationEndTime) + delete(rawMsg, key) + case "mdeIntegration": + err = unpopulate(val, "MdeIntegration", &d.MdeIntegration) + delete(rawMsg, key) + case "onboardingKind": + err = unpopulate(val, "OnboardingKind", &d.OnboardingKind) + delete(rawMsg, key) + case "sentinelWorkspaceResourceIds": + err = unpopulate(val, "SentinelWorkspaceResourceIDs", &d.SentinelWorkspaceResourceIDs) + 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 DefenderSettingsPropertiesMdeIntegration. +func (d DefenderSettingsPropertiesMdeIntegration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "status", d.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderSettingsPropertiesMdeIntegration. +func (d *DefenderSettingsPropertiesMdeIntegration) UnmarshalJSON(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 "status": + err = unpopulate(val, "Status", &d.Status) + 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 DeviceGroupList. +func (d DeviceGroupList) 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 DeviceGroupList. +func (d *DeviceGroupList) UnmarshalJSON(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 DeviceGroupModel. +func (d DeviceGroupModel) 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 DeviceGroupModel. +func (d *DeviceGroupModel) UnmarshalJSON(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 DeviceList. +func (d DeviceList) 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 DeviceList. +func (d *DeviceList) UnmarshalJSON(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 DeviceModel. +func (d DeviceModel) 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 DeviceModel. +func (d *DeviceModel) UnmarshalJSON(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 DeviceProperties. +func (d DeviceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalFields", &d.AdditionalFields) + populate(objectMap, "authorizedState", d.AuthorizedState) + populate(objectMap, "businessFunction", d.BusinessFunction) + populate(objectMap, "cpes", d.Cpes) + populate(objectMap, "criticality", d.Criticality) + populate(objectMap, "deviceCategoryDisplayName", d.DeviceCategoryDisplayName) + populate(objectMap, "deviceCategoryId", d.DeviceCategoryID) + populate(objectMap, "deviceDataSource", d.DeviceDataSource) + populate(objectMap, "deviceName", d.DeviceName) + populate(objectMap, "deviceStatus", d.DeviceStatus) + populate(objectMap, "deviceSubTypeDisplayName", d.DeviceSubTypeDisplayName) + populate(objectMap, "deviceSubTypeId", d.DeviceSubTypeID) + populate(objectMap, "deviceTags", d.DeviceTags) + populate(objectMap, "deviceTypeDisplayName", d.DeviceTypeDisplayName) + populate(objectMap, "deviceTypeId", d.DeviceTypeID) + populate(objectMap, "firmwares", d.Firmwares) + populateTimeRFC3339(objectMap, "firstSeen", d.FirstSeen) + populate(objectMap, "hardware", d.Hardware) + populateTimeRFC3339(objectMap, "lastProgrammingTime", d.LastProgrammingTime) + populateTimeRFC3339(objectMap, "lastSeen", d.LastSeen) + populateTimeRFC3339(objectMap, "lastUpdated", d.LastUpdated) + populate(objectMap, "mergedDevices", d.MergedDevices) + populate(objectMap, "mergedToDeviceId", d.MergedToDeviceID) + populate(objectMap, "nics", d.Nics) + populate(objectMap, "onboardingStatus", d.OnboardingStatus) + populate(objectMap, "operatingSystem", d.OperatingSystem) + populate(objectMap, "packages", d.Packages) + populate(objectMap, "parentDeviceId", d.ParentDeviceID) + populate(objectMap, "parentRackNumber", d.ParentRackNumber) + populate(objectMap, "parentSlotNumber", d.ParentSlotNumber) + populate(objectMap, "profilingConfidence", d.ProfilingConfidence) + populate(objectMap, "programmingState", d.ProgrammingState) + populate(objectMap, "purdueLevel", d.PurdueLevel) + populate(objectMap, "riskScore", d.RiskScore) + populate(objectMap, "schemaVersion", d.SchemaVersion) + populate(objectMap, "sensor", d.Sensor) + populate(objectMap, "slots", d.Slots) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceProperties. +func (d *DeviceProperties) UnmarshalJSON(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 "additionalFields": + err = unpopulate(val, "AdditionalFields", &d.AdditionalFields) + delete(rawMsg, key) + case "authorizedState": + err = unpopulate(val, "AuthorizedState", &d.AuthorizedState) + delete(rawMsg, key) + case "businessFunction": + err = unpopulate(val, "BusinessFunction", &d.BusinessFunction) + delete(rawMsg, key) + case "cpes": + err = unpopulate(val, "Cpes", &d.Cpes) + delete(rawMsg, key) + case "criticality": + err = unpopulate(val, "Criticality", &d.Criticality) + delete(rawMsg, key) + case "deviceCategoryDisplayName": + err = unpopulate(val, "DeviceCategoryDisplayName", &d.DeviceCategoryDisplayName) + delete(rawMsg, key) + case "deviceCategoryId": + err = unpopulate(val, "DeviceCategoryID", &d.DeviceCategoryID) + delete(rawMsg, key) + case "deviceDataSource": + err = unpopulate(val, "DeviceDataSource", &d.DeviceDataSource) + delete(rawMsg, key) + case "deviceName": + err = unpopulate(val, "DeviceName", &d.DeviceName) + delete(rawMsg, key) + case "deviceStatus": + err = unpopulate(val, "DeviceStatus", &d.DeviceStatus) + delete(rawMsg, key) + case "deviceSubTypeDisplayName": + err = unpopulate(val, "DeviceSubTypeDisplayName", &d.DeviceSubTypeDisplayName) + delete(rawMsg, key) + case "deviceSubTypeId": + err = unpopulate(val, "DeviceSubTypeID", &d.DeviceSubTypeID) + delete(rawMsg, key) + case "deviceTags": + err = unpopulate(val, "DeviceTags", &d.DeviceTags) + delete(rawMsg, key) + case "deviceTypeDisplayName": + err = unpopulate(val, "DeviceTypeDisplayName", &d.DeviceTypeDisplayName) + delete(rawMsg, key) + case "deviceTypeId": + err = unpopulate(val, "DeviceTypeID", &d.DeviceTypeID) + delete(rawMsg, key) + case "firmwares": + err = unpopulate(val, "Firmwares", &d.Firmwares) + delete(rawMsg, key) + case "firstSeen": + err = unpopulateTimeRFC3339(val, "FirstSeen", &d.FirstSeen) + delete(rawMsg, key) + case "hardware": + err = unpopulate(val, "Hardware", &d.Hardware) + delete(rawMsg, key) + case "lastProgrammingTime": + err = unpopulateTimeRFC3339(val, "LastProgrammingTime", &d.LastProgrammingTime) + delete(rawMsg, key) + case "lastSeen": + err = unpopulateTimeRFC3339(val, "LastSeen", &d.LastSeen) + delete(rawMsg, key) + case "lastUpdated": + err = unpopulateTimeRFC3339(val, "LastUpdated", &d.LastUpdated) + delete(rawMsg, key) + case "mergedDevices": + err = unpopulate(val, "MergedDevices", &d.MergedDevices) + delete(rawMsg, key) + case "mergedToDeviceId": + err = unpopulate(val, "MergedToDeviceID", &d.MergedToDeviceID) + delete(rawMsg, key) + case "nics": + err = unpopulate(val, "Nics", &d.Nics) + delete(rawMsg, key) + case "onboardingStatus": + err = unpopulate(val, "OnboardingStatus", &d.OnboardingStatus) + delete(rawMsg, key) + case "operatingSystem": + err = unpopulate(val, "OperatingSystem", &d.OperatingSystem) + delete(rawMsg, key) + case "packages": + err = unpopulate(val, "Packages", &d.Packages) + delete(rawMsg, key) + case "parentDeviceId": + err = unpopulate(val, "ParentDeviceID", &d.ParentDeviceID) + delete(rawMsg, key) + case "parentRackNumber": + err = unpopulate(val, "ParentRackNumber", &d.ParentRackNumber) + delete(rawMsg, key) + case "parentSlotNumber": + err = unpopulate(val, "ParentSlotNumber", &d.ParentSlotNumber) + delete(rawMsg, key) + case "profilingConfidence": + err = unpopulate(val, "ProfilingConfidence", &d.ProfilingConfidence) + delete(rawMsg, key) + case "programmingState": + err = unpopulate(val, "ProgrammingState", &d.ProgrammingState) + delete(rawMsg, key) + case "purdueLevel": + err = unpopulate(val, "PurdueLevel", &d.PurdueLevel) + delete(rawMsg, key) + case "riskScore": + err = unpopulate(val, "RiskScore", &d.RiskScore) + delete(rawMsg, key) + case "schemaVersion": + err = unpopulate(val, "SchemaVersion", &d.SchemaVersion) + delete(rawMsg, key) + case "sensor": + err = unpopulate(val, "Sensor", &d.Sensor) + delete(rawMsg, key) + case "slots": + err = unpopulate(val, "Slots", &d.Slots) + 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 DimensionProperties. +func (d DimensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", d.DisplayName) + populate(objectMap, "name", d.Name) + populate(objectMap, "toBeExportedForCustomer", d.ToBeExportedForCustomer) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DimensionProperties. +func (d *DimensionProperties) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "toBeExportedForCustomer": + err = unpopulate(val, "ToBeExportedForCustomer", &d.ToBeExportedForCustomer) + 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 ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "info", &e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorModel. +func (e ErrorModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorModel. +func (e *ErrorModel) UnmarshalJSON(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 "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 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 ErrorResponseModel. +func (e ErrorResponseModel) 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 ErrorResponseModel. +func (e *ErrorResponseModel) UnmarshalJSON(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 ErrorResponseModelError. +func (e ErrorResponseModelError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseModelError. +func (e *ErrorResponseModelError) UnmarshalJSON(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 "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 Firmware. +func (f Firmware) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalFields", &f.AdditionalFields) + populate(objectMap, "moduleAddress", f.ModuleAddress) + populate(objectMap, "name", f.Name) + populate(objectMap, "serial", f.Serial) + populate(objectMap, "vendor", f.Vendor) + populate(objectMap, "version", f.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Firmware. +func (f *Firmware) UnmarshalJSON(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 "additionalFields": + err = unpopulate(val, "AdditionalFields", &f.AdditionalFields) + delete(rawMsg, key) + case "moduleAddress": + err = unpopulate(val, "ModuleAddress", &f.ModuleAddress) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "serial": + err = unpopulate(val, "Serial", &f.Serial) + delete(rawMsg, key) + case "vendor": + err = unpopulate(val, "Vendor", &f.Vendor) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &f.Version) + 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 Hardware. +func (h Hardware) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "model", h.Model) + populate(objectMap, "serialNumber", h.SerialNumber) + populate(objectMap, "vendor", h.Vendor) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Hardware. +func (h *Hardware) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "model": + err = unpopulate(val, "Model", &h.Model) + delete(rawMsg, key) + case "serialNumber": + err = unpopulate(val, "SerialNumber", &h.SerialNumber) + delete(rawMsg, key) + case "vendor": + err = unpopulate(val, "Vendor", &h.Vendor) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LocationList. +func (l LocationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocationList. +func (l *LocationList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LocationModel. +func (l LocationModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", l.ID) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", &l.Properties) + populate(objectMap, "systemData", l.SystemData) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocationModel. +func (l *LocationModel) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &l.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MergedDevice. +func (m MergedDevice) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "deviceDataSource", m.DeviceDataSource) + populate(objectMap, "id", m.ID) + populate(objectMap, "sensor", m.Sensor) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MergedDevice. +func (m *MergedDevice) UnmarshalJSON(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 "deviceDataSource": + err = unpopulate(val, "DeviceDataSource", &m.DeviceDataSource) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "sensor": + err = unpopulate(val, "Sensor", &m.Sensor) + 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 Nic. +func (n Nic) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ipv4Address", n.IPv4Address) + populate(objectMap, "ipv6Address", n.IPv6Address) + populateTimeRFC3339(objectMap, "lastSeen", n.LastSeen) + populate(objectMap, "macAddress", n.MacAddress) + populate(objectMap, "macCertainty", n.MacCertainty) + populate(objectMap, "networkAdapterVendor", n.NetworkAdapterVendor) + populate(objectMap, "vlans", n.Vlans) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Nic. +func (n *Nic) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ipv4Address": + err = unpopulate(val, "IPv4Address", &n.IPv4Address) + delete(rawMsg, key) + case "ipv6Address": + err = unpopulate(val, "IPv6Address", &n.IPv6Address) + delete(rawMsg, key) + case "lastSeen": + err = unpopulateTimeRFC3339(val, "LastSeen", &n.LastSeen) + delete(rawMsg, key) + case "macAddress": + err = unpopulate(val, "MacAddress", &n.MacAddress) + delete(rawMsg, key) + case "macCertainty": + err = unpopulate(val, "MacCertainty", &n.MacCertainty) + delete(rawMsg, key) + case "networkAdapterVendor": + err = unpopulate(val, "NetworkAdapterVendor", &n.NetworkAdapterVendor) + delete(rawMsg, key) + case "vlans": + err = unpopulate(val, "Vlans", &n.Vlans) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OnPremiseSensor. +func (o OnPremiseSensor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", &o.Properties) + populate(objectMap, "systemData", o.SystemData) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OnPremiseSensor. +func (o *OnPremiseSensor) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &o.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OnPremiseSensorsList. +func (o OnPremiseSensorsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OnPremiseSensorsList. +func (o *OnPremiseSensorsList) UnmarshalJSON(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 "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 OperatingSystem. +func (o OperatingSystem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "architecture", o.Architecture) + populate(objectMap, "build", o.Build) + populate(objectMap, "distribution", o.Distribution) + populate(objectMap, "platform", o.Platform) + populate(objectMap, "version", o.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperatingSystem. +func (o *OperatingSystem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "architecture": + err = unpopulate(val, "Architecture", &o.Architecture) + delete(rawMsg, key) + case "build": + err = unpopulate(val, "Build", &o.Build) + delete(rawMsg, key) + case "distribution": + err = unpopulate(val, "Distribution", &o.Distribution) + delete(rawMsg, key) + case "platform": + err = unpopulate(val, "Platform", &o.Platform) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &o.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + populate(objectMap, "properties", o.Properties) + 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 "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) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + 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 OperationList. +func (o OperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", o.Count) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationList. +func (o *OperationList) UnmarshalJSON(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 "count": + err = unpopulate(val, "Count", &o.Count) + delete(rawMsg, 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 OperationMetaLogSpecification. +func (o OperationMetaLogSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blobDuration", o.BlobDuration) + populate(objectMap, "displayName", o.DisplayName) + populate(objectMap, "name", o.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationMetaLogSpecification. +func (o *OperationMetaLogSpecification) UnmarshalJSON(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 "blobDuration": + err = unpopulate(val, "BlobDuration", &o.BlobDuration) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &o.DisplayName) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + 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 OperationMetaMetricSpecification. +func (o OperationMetaMetricSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "aggregationType", o.AggregationType) + populate(objectMap, "dimensions", o.Dimensions) + populate(objectMap, "displayDescription", o.DisplayDescription) + populate(objectMap, "displayName", o.DisplayName) + populate(objectMap, "enableRegionalMdmAccount", o.EnableRegionalMdmAccount) + populate(objectMap, "internalMetricName", o.InternalMetricName) + populate(objectMap, "name", o.Name) + populate(objectMap, "resourceIdDimensionNameOverride", o.ResourceIDDimensionNameOverride) + populate(objectMap, "sourceMdmNamespace", o.SourceMdmNamespace) + populate(objectMap, "supportedAggregationTypes", o.SupportedAggregationTypes) + populate(objectMap, "supportedTimeGrainTypes", o.SupportedTimeGrainTypes) + populate(objectMap, "unit", o.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationMetaMetricSpecification. +func (o *OperationMetaMetricSpecification) UnmarshalJSON(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 "aggregationType": + err = unpopulate(val, "AggregationType", &o.AggregationType) + delete(rawMsg, key) + case "dimensions": + err = unpopulate(val, "Dimensions", &o.Dimensions) + delete(rawMsg, key) + case "displayDescription": + err = unpopulate(val, "DisplayDescription", &o.DisplayDescription) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &o.DisplayName) + delete(rawMsg, key) + case "enableRegionalMdmAccount": + err = unpopulate(val, "EnableRegionalMdmAccount", &o.EnableRegionalMdmAccount) + delete(rawMsg, key) + case "internalMetricName": + err = unpopulate(val, "InternalMetricName", &o.InternalMetricName) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "resourceIdDimensionNameOverride": + err = unpopulate(val, "ResourceIDDimensionNameOverride", &o.ResourceIDDimensionNameOverride) + delete(rawMsg, key) + case "sourceMdmNamespace": + err = unpopulate(val, "SourceMdmNamespace", &o.SourceMdmNamespace) + delete(rawMsg, key) + case "supportedAggregationTypes": + err = unpopulate(val, "SupportedAggregationTypes", &o.SupportedAggregationTypes) + delete(rawMsg, key) + case "supportedTimeGrainTypes": + err = unpopulate(val, "SupportedTimeGrainTypes", &o.SupportedTimeGrainTypes) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &o.Unit) + 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 OperationMetaServiceSpecification. +func (o OperationMetaServiceSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "logSpecifications", o.LogSpecifications) + populate(objectMap, "metricSpecifications", o.MetricSpecifications) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationMetaServiceSpecification. +func (o *OperationMetaServiceSpecification) UnmarshalJSON(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 "logSpecifications": + err = unpopulate(val, "LogSpecifications", &o.LogSpecifications) + delete(rawMsg, key) + case "metricSpecifications": + err = unpopulate(val, "MetricSpecifications", &o.MetricSpecifications) + 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 OperationProperties. +func (o OperationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "serviceSpecification", o.ServiceSpecification) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationProperties. +func (o *OperationProperties) UnmarshalJSON(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 "serviceSpecification": + err = unpopulate(val, "ServiceSpecification", &o.ServiceSpecification) + 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 Package. +func (p Package) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", p.Name) + populate(objectMap, "version", p.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Package. +func (p *Package) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &p.Version) + 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 PackageDownloadInfo. +func (p PackageDownloadInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "link", p.Link) + populate(objectMap, "version", p.Version) + populate(objectMap, "versionKind", p.VersionKind) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PackageDownloadInfo. +func (p *PackageDownloadInfo) UnmarshalJSON(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 "link": + err = unpopulate(val, "Link", &p.Link) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &p.Version) + delete(rawMsg, key) + case "versionKind": + err = unpopulate(val, "VersionKind", &p.VersionKind) + 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 PackageDownloads. +func (p PackageDownloads) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authorizedDevicesImportTemplate", p.AuthorizedDevicesImportTemplate) + populate(objectMap, "centralManager", p.CentralManager) + populate(objectMap, "deviceInformationUpdateImportTemplate", p.DeviceInformationUpdateImportTemplate) + populate(objectMap, "sensor", p.Sensor) + populate(objectMap, "snmp", p.Snmp) + populate(objectMap, "threatIntelligence", p.ThreatIntelligence) + populate(objectMap, "wmiTool", p.WmiTool) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PackageDownloads. +func (p *PackageDownloads) UnmarshalJSON(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 "authorizedDevicesImportTemplate": + err = unpopulate(val, "AuthorizedDevicesImportTemplate", &p.AuthorizedDevicesImportTemplate) + delete(rawMsg, key) + case "centralManager": + err = unpopulate(val, "CentralManager", &p.CentralManager) + delete(rawMsg, key) + case "deviceInformationUpdateImportTemplate": + err = unpopulate(val, "DeviceInformationUpdateImportTemplate", &p.DeviceInformationUpdateImportTemplate) + delete(rawMsg, key) + case "sensor": + err = unpopulate(val, "Sensor", &p.Sensor) + delete(rawMsg, key) + case "snmp": + err = unpopulate(val, "Snmp", &p.Snmp) + delete(rawMsg, key) + case "threatIntelligence": + err = unpopulate(val, "ThreatIntelligence", &p.ThreatIntelligence) + delete(rawMsg, key) + case "wmiTool": + err = unpopulate(val, "WmiTool", &p.WmiTool) + 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 PackageDownloadsCentralManager. +func (p PackageDownloadsCentralManager) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "full", p.Full) + populate(objectMap, "upgrade", p.Upgrade) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PackageDownloadsCentralManager. +func (p *PackageDownloadsCentralManager) UnmarshalJSON(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 "full": + err = unpopulate(val, "Full", &p.Full) + delete(rawMsg, key) + case "upgrade": + err = unpopulate(val, "Upgrade", &p.Upgrade) + 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 PackageDownloadsCentralManagerFull. +func (p PackageDownloadsCentralManagerFull) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "iso", p.Iso) + populate(objectMap, "ovf", p.Ovf) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PackageDownloadsCentralManagerFull. +func (p *PackageDownloadsCentralManagerFull) UnmarshalJSON(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 "iso": + err = unpopulate(val, "Iso", &p.Iso) + delete(rawMsg, key) + case "ovf": + err = unpopulate(val, "Ovf", &p.Ovf) + 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 PackageDownloadsCentralManagerFullOvf. +func (p PackageDownloadsCentralManagerFullOvf) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enterprise", p.Enterprise) + populate(objectMap, "enterpriseHighAvailability", p.EnterpriseHighAvailability) + populate(objectMap, "medium", p.Medium) + populate(objectMap, "mediumHighAvailability", p.MediumHighAvailability) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PackageDownloadsCentralManagerFullOvf. +func (p *PackageDownloadsCentralManagerFullOvf) UnmarshalJSON(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 "enterprise": + err = unpopulate(val, "Enterprise", &p.Enterprise) + delete(rawMsg, key) + case "enterpriseHighAvailability": + err = unpopulate(val, "EnterpriseHighAvailability", &p.EnterpriseHighAvailability) + delete(rawMsg, key) + case "medium": + err = unpopulate(val, "Medium", &p.Medium) + delete(rawMsg, key) + case "mediumHighAvailability": + err = unpopulate(val, "MediumHighAvailability", &p.MediumHighAvailability) + 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 PackageDownloadsSensor. +func (p PackageDownloadsSensor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "full", p.Full) + populate(objectMap, "upgrade", p.Upgrade) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PackageDownloadsSensor. +func (p *PackageDownloadsSensor) UnmarshalJSON(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 "full": + err = unpopulate(val, "Full", &p.Full) + delete(rawMsg, key) + case "upgrade": + err = unpopulate(val, "Upgrade", &p.Upgrade) + 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 PackageDownloadsSensorFull. +func (p PackageDownloadsSensorFull) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "iso", p.Iso) + populate(objectMap, "ovf", p.Ovf) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PackageDownloadsSensorFull. +func (p *PackageDownloadsSensorFull) UnmarshalJSON(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 "iso": + err = unpopulate(val, "Iso", &p.Iso) + delete(rawMsg, key) + case "ovf": + err = unpopulate(val, "Ovf", &p.Ovf) + 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 PackageDownloadsSensorFullOvf. +func (p PackageDownloadsSensorFullOvf) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enterprise", p.Enterprise) + populate(objectMap, "line", p.Line) + populate(objectMap, "medium", p.Medium) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PackageDownloadsSensorFullOvf. +func (p *PackageDownloadsSensorFullOvf) UnmarshalJSON(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 "enterprise": + err = unpopulate(val, "Enterprise", &p.Enterprise) + delete(rawMsg, key) + case "line": + err = unpopulate(val, "Line", &p.Line) + delete(rawMsg, key) + case "medium": + err = unpopulate(val, "Medium", &p.Medium) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "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 ResetPasswordInput. +func (r ResetPasswordInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applianceId", r.ApplianceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResetPasswordInput. +func (r *ResetPasswordInput) UnmarshalJSON(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 "applianceId": + err = unpopulate(val, "ApplianceID", &r.ApplianceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "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 Sensor. +func (s Sensor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", s.Name) + populate(objectMap, "site", s.Site) + populate(objectMap, "type", s.Type) + populate(objectMap, "zone", s.Zone) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Sensor. +func (s *Sensor) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "site": + err = unpopulate(val, "Site", &s.Site) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + case "zone": + err = unpopulate(val, "Zone", &s.Zone) + 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 SensorModel. +func (s SensorModel) 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 SensorModel. +func (s *SensorModel) UnmarshalJSON(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 SensorProperties. +func (s SensorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "connectivityTime", s.ConnectivityTime) + populate(objectMap, "dynamicLearning", s.DynamicLearning) + populate(objectMap, "learningMode", s.LearningMode) + populate(objectMap, "sensorStatus", s.SensorStatus) + populate(objectMap, "sensorType", s.SensorType) + populate(objectMap, "sensorVersion", s.SensorVersion) + populate(objectMap, "tiAutomaticUpdates", s.TiAutomaticUpdates) + populate(objectMap, "tiStatus", s.TiStatus) + populate(objectMap, "tiVersion", s.TiVersion) + populate(objectMap, "zone", s.Zone) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SensorProperties. +func (s *SensorProperties) UnmarshalJSON(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 "connectivityTime": + err = unpopulate(val, "ConnectivityTime", &s.ConnectivityTime) + delete(rawMsg, key) + case "dynamicLearning": + err = unpopulate(val, "DynamicLearning", &s.DynamicLearning) + delete(rawMsg, key) + case "learningMode": + err = unpopulate(val, "LearningMode", &s.LearningMode) + delete(rawMsg, key) + case "sensorStatus": + err = unpopulate(val, "SensorStatus", &s.SensorStatus) + delete(rawMsg, key) + case "sensorType": + err = unpopulate(val, "SensorType", &s.SensorType) + delete(rawMsg, key) + case "sensorVersion": + err = unpopulate(val, "SensorVersion", &s.SensorVersion) + delete(rawMsg, key) + case "tiAutomaticUpdates": + err = unpopulate(val, "TiAutomaticUpdates", &s.TiAutomaticUpdates) + delete(rawMsg, key) + case "tiStatus": + err = unpopulate(val, "TiStatus", &s.TiStatus) + delete(rawMsg, key) + case "tiVersion": + err = unpopulate(val, "TiVersion", &s.TiVersion) + delete(rawMsg, key) + case "zone": + err = unpopulate(val, "Zone", &s.Zone) + 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 SensorsList. +func (s SensorsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SensorsList. +func (s *SensorsList) UnmarshalJSON(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 "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 SiteModel. +func (s SiteModel) 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 SiteModel. +func (s *SiteModel) UnmarshalJSON(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 SiteProperties. +func (s SiteProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SiteProperties. +func (s *SiteProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SitesList. +func (s SitesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SitesList. +func (s *SitesList) UnmarshalJSON(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 "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 Slot. +func (s Slot) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalData", &s.AdditionalData) + populate(objectMap, "cpes", s.Cpes) + populate(objectMap, "firmwareVersion", s.FirmwareVersion) + populate(objectMap, "hardwareRevision", s.HardwareRevision) + populate(objectMap, "hardwareVendor", s.HardwareVendor) + populate(objectMap, "model", s.Model) + populate(objectMap, "moduleVersion", s.ModuleVersion) + populate(objectMap, "productCode", s.ProductCode) + populate(objectMap, "rackNumber", s.RackNumber) + populate(objectMap, "serialNumber", s.SerialNumber) + populate(objectMap, "slotNumber", s.SlotNumber) + populate(objectMap, "slotType", s.SlotType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Slot. +func (s *Slot) UnmarshalJSON(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 "additionalData": + err = unpopulate(val, "AdditionalData", &s.AdditionalData) + delete(rawMsg, key) + case "cpes": + err = unpopulate(val, "Cpes", &s.Cpes) + delete(rawMsg, key) + case "firmwareVersion": + err = unpopulate(val, "FirmwareVersion", &s.FirmwareVersion) + delete(rawMsg, key) + case "hardwareRevision": + err = unpopulate(val, "HardwareRevision", &s.HardwareRevision) + delete(rawMsg, key) + case "hardwareVendor": + err = unpopulate(val, "HardwareVendor", &s.HardwareVendor) + delete(rawMsg, key) + case "model": + err = unpopulate(val, "Model", &s.Model) + delete(rawMsg, key) + case "moduleVersion": + err = unpopulate(val, "ModuleVersion", &s.ModuleVersion) + delete(rawMsg, key) + case "productCode": + err = unpopulate(val, "ProductCode", &s.ProductCode) + delete(rawMsg, key) + case "rackNumber": + err = unpopulate(val, "RackNumber", &s.RackNumber) + delete(rawMsg, key) + case "serialNumber": + err = unpopulate(val, "SerialNumber", &s.SerialNumber) + delete(rawMsg, key) + case "slotNumber": + err = unpopulate(val, "SlotNumber", &s.SlotNumber) + delete(rawMsg, key) + case "slotType": + err = unpopulate(val, "SlotType", &s.SlotType) + 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) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(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 = unpopulateTimeRFC3339(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 = unpopulateTimeRFC3339(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 UpgradePackageDownloadInfo. +func (u UpgradePackageDownloadInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "fromVersion", u.FromVersion) + populate(objectMap, "link", u.Link) + populate(objectMap, "version", u.Version) + populate(objectMap, "versionKind", u.VersionKind) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpgradePackageDownloadInfo. +func (u *UpgradePackageDownloadInfo) UnmarshalJSON(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 "fromVersion": + err = unpopulate(val, "FromVersion", &u.FromVersion) + delete(rawMsg, key) + case "link": + err = unpopulate(val, "Link", &u.Link) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &u.Version) + delete(rawMsg, key) + case "versionKind": + err = unpopulate(val, "VersionKind", &u.VersionKind) + 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 { + 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/iotsecurity/armiotsecurity/zz_generated_onpremisesensors_client.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/onpremisesensors_client.go similarity index 85% rename from sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_onpremisesensors_client.go rename to sdk/resourcemanager/iotsecurity/armiotsecurity/onpremisesensors_client.go index 88e56878f6e5..021acc5f4bea 100644 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_onpremisesensors_client.go +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/onpremisesensors_client.go @@ -5,6 +5,7 @@ // 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 armiotsecurity @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,47 +24,39 @@ import ( // OnPremiseSensorsClient contains the methods for the OnPremiseSensors group. // Don't use this type directly, use NewOnPremiseSensorsClient() instead. type OnPremiseSensorsClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewOnPremiseSensorsClient creates a new instance of OnPremiseSensorsClient 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. +// - 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 NewOnPremiseSensorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OnPremiseSensorsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".OnPremiseSensorsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &OnPremiseSensorsClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // CreateOrUpdate - Create or update on-premise IoT sensor // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// onPremiseSensorName - Name of the on-premise IoT sensor -// options - OnPremiseSensorsClientCreateOrUpdateOptions contains the optional parameters for the OnPremiseSensorsClient.CreateOrUpdate -// method. +// - onPremiseSensorName - Name of the on-premise IoT sensor +// - options - OnPremiseSensorsClientCreateOrUpdateOptions contains the optional parameters for the OnPremiseSensorsClient.CreateOrUpdate +// method. func (client *OnPremiseSensorsClient) CreateOrUpdate(ctx context.Context, onPremiseSensorName string, options *OnPremiseSensorsClientCreateOrUpdateOptions) (OnPremiseSensorsClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, onPremiseSensorName, options) if err != nil { return OnPremiseSensorsClientCreateOrUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return OnPremiseSensorsClientCreateOrUpdateResponse{}, err } @@ -86,7 +77,7 @@ func (client *OnPremiseSensorsClient) createOrUpdateCreateRequest(ctx context.Co return nil, errors.New("parameter onPremiseSensorName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{onPremiseSensorName}", url.PathEscape(onPremiseSensorName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -108,15 +99,16 @@ func (client *OnPremiseSensorsClient) createOrUpdateHandleResponse(resp *http.Re // Delete - Delete on-premise IoT sensor // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// onPremiseSensorName - Name of the on-premise IoT sensor -// options - OnPremiseSensorsClientDeleteOptions contains the optional parameters for the OnPremiseSensorsClient.Delete method. +// - onPremiseSensorName - Name of the on-premise IoT sensor +// - options - OnPremiseSensorsClientDeleteOptions contains the optional parameters for the OnPremiseSensorsClient.Delete method. func (client *OnPremiseSensorsClient) Delete(ctx context.Context, onPremiseSensorName string, options *OnPremiseSensorsClientDeleteOptions) (OnPremiseSensorsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, onPremiseSensorName, options) if err != nil { return OnPremiseSensorsClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return OnPremiseSensorsClientDeleteResponse{}, err } @@ -137,7 +129,7 @@ func (client *OnPremiseSensorsClient) deleteCreateRequest(ctx context.Context, o return nil, errors.New("parameter onPremiseSensorName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{onPremiseSensorName}", url.PathEscape(onPremiseSensorName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -150,16 +142,17 @@ func (client *OnPremiseSensorsClient) deleteCreateRequest(ctx context.Context, o // DownloadActivation - Download sensor activation file // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// onPremiseSensorName - Name of the on-premise IoT sensor -// options - OnPremiseSensorsClientDownloadActivationOptions contains the optional parameters for the OnPremiseSensorsClient.DownloadActivation -// method. +// - onPremiseSensorName - Name of the on-premise IoT sensor +// - options - OnPremiseSensorsClientDownloadActivationOptions contains the optional parameters for the OnPremiseSensorsClient.DownloadActivation +// method. func (client *OnPremiseSensorsClient) DownloadActivation(ctx context.Context, onPremiseSensorName string, options *OnPremiseSensorsClientDownloadActivationOptions) (OnPremiseSensorsClientDownloadActivationResponse, error) { req, err := client.downloadActivationCreateRequest(ctx, onPremiseSensorName, options) if err != nil { return OnPremiseSensorsClientDownloadActivationResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return OnPremiseSensorsClientDownloadActivationResponse{}, err } @@ -180,7 +173,7 @@ func (client *OnPremiseSensorsClient) downloadActivationCreateRequest(ctx contex return nil, errors.New("parameter onPremiseSensorName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{onPremiseSensorName}", url.PathEscape(onPremiseSensorName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -194,17 +187,18 @@ func (client *OnPremiseSensorsClient) downloadActivationCreateRequest(ctx contex // DownloadResetPassword - Download file for reset password of the sensor // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// onPremiseSensorName - Name of the on-premise IoT sensor -// body - Input for reset password. -// options - OnPremiseSensorsClientDownloadResetPasswordOptions contains the optional parameters for the OnPremiseSensorsClient.DownloadResetPassword -// method. +// - onPremiseSensorName - Name of the on-premise IoT sensor +// - body - Input for reset password. +// - options - OnPremiseSensorsClientDownloadResetPasswordOptions contains the optional parameters for the OnPremiseSensorsClient.DownloadResetPassword +// method. func (client *OnPremiseSensorsClient) DownloadResetPassword(ctx context.Context, onPremiseSensorName string, body ResetPasswordInput, options *OnPremiseSensorsClientDownloadResetPasswordOptions) (OnPremiseSensorsClientDownloadResetPasswordResponse, error) { req, err := client.downloadResetPasswordCreateRequest(ctx, onPremiseSensorName, body, options) if err != nil { return OnPremiseSensorsClientDownloadResetPasswordResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return OnPremiseSensorsClientDownloadResetPasswordResponse{}, err } @@ -225,7 +219,7 @@ func (client *OnPremiseSensorsClient) downloadResetPasswordCreateRequest(ctx con return nil, errors.New("parameter onPremiseSensorName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{onPremiseSensorName}", url.PathEscape(onPremiseSensorName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -239,15 +233,16 @@ func (client *OnPremiseSensorsClient) downloadResetPasswordCreateRequest(ctx con // Get - Get on-premise IoT sensor // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// onPremiseSensorName - Name of the on-premise IoT sensor -// options - OnPremiseSensorsClientGetOptions contains the optional parameters for the OnPremiseSensorsClient.Get method. +// - onPremiseSensorName - Name of the on-premise IoT sensor +// - options - OnPremiseSensorsClientGetOptions contains the optional parameters for the OnPremiseSensorsClient.Get method. func (client *OnPremiseSensorsClient) Get(ctx context.Context, onPremiseSensorName string, options *OnPremiseSensorsClientGetOptions) (OnPremiseSensorsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, onPremiseSensorName, options) if err != nil { return OnPremiseSensorsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return OnPremiseSensorsClientGetResponse{}, err } @@ -268,7 +263,7 @@ func (client *OnPremiseSensorsClient) getCreateRequest(ctx context.Context, onPr return nil, errors.New("parameter onPremiseSensorName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{onPremiseSensorName}", url.PathEscape(onPremiseSensorName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -290,14 +285,15 @@ func (client *OnPremiseSensorsClient) getHandleResponse(resp *http.Response) (On // List - List on-premise IoT sensors // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// options - OnPremiseSensorsClientListOptions contains the optional parameters for the OnPremiseSensorsClient.List method. +// - options - OnPremiseSensorsClientListOptions contains the optional parameters for the OnPremiseSensorsClient.List method. func (client *OnPremiseSensorsClient) List(ctx context.Context, options *OnPremiseSensorsClientListOptions) (OnPremiseSensorsClientListResponse, error) { req, err := client.listCreateRequest(ctx, options) if err != nil { return OnPremiseSensorsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return OnPremiseSensorsClientListResponse{}, err } @@ -314,7 +310,7 @@ func (client *OnPremiseSensorsClient) listCreateRequest(ctx context.Context, opt 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/onpremisesensors_client_example_test.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/onpremisesensors_client_example_test.go new file mode 100644 index 000000000000..95a63480bd23 --- /dev/null +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/onpremisesensors_client_example_test.go @@ -0,0 +1,195 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armiotsecurity_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/iotsecurity/armiotsecurity" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/OnPremiseSensors/List.json +func ExampleOnPremiseSensorsClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewOnPremiseSensorsClient().List(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.OnPremiseSensorsList = armiotsecurity.OnPremiseSensorsList{ + // Value: []*armiotsecurity.OnPremiseSensor{ + // { + // Name: to.Ptr("mySensor"), + // Type: to.Ptr("Microsoft.IoTSecurity/onPremiseSensors"), + // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.IoTSecurity/sensors/mySensor"), + // Properties: map[string]any{ + // }, + // SystemData: &armiotsecurity.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // }, + // }, + // { + // Name: to.Ptr("otherSensor"), + // Type: to.Ptr("Microsoft.IoTSecurity/onPremiseSensors"), + // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.IoTSecurity/sensors/otherSensor"), + // Properties: map[string]any{ + // }, + // SystemData: &armiotsecurity.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // }, + // }}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/OnPremiseSensors/Get.json +func ExampleOnPremiseSensorsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewOnPremiseSensorsClient().Get(ctx, "mySensor", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.OnPremiseSensor = armiotsecurity.OnPremiseSensor{ + // Name: to.Ptr("mySensor"), + // Type: to.Ptr("Microsoft.IoTSecurity/onPremiseSensors"), + // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.IoTSecurity/onPremiseSensors/mySensor"), + // Properties: map[string]any{ + // }, + // SystemData: &armiotsecurity.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/OnPremiseSensors/Put.json +func ExampleOnPremiseSensorsClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewOnPremiseSensorsClient().CreateOrUpdate(ctx, "mySensor", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.OnPremiseSensor = armiotsecurity.OnPremiseSensor{ + // Name: to.Ptr("mySensor"), + // Type: to.Ptr("Microsoft.IoTSecurity/onPremiseSensors"), + // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.IoTSecurity/sensors/mySensor"), + // Properties: map[string]any{ + // }, + // SystemData: &armiotsecurity.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/OnPremiseSensors/Delete.json +func ExampleOnPremiseSensorsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewOnPremiseSensorsClient().Delete(ctx, "mySensor", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/OnPremiseSensors/DownloadActivation.json +func ExampleOnPremiseSensorsClient_DownloadActivation() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewOnPremiseSensorsClient().DownloadActivation(ctx, "mySensor", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/OnPremiseSensors/DownloadResetPassword.json +func ExampleOnPremiseSensorsClient_DownloadResetPassword() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewOnPremiseSensorsClient().DownloadResetPassword(ctx, "mySensor", armiotsecurity.ResetPasswordInput{ + ApplianceID: to.Ptr("3214-528AV23-D121-D3-E1"), + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_operations_client.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/operations_client.go similarity index 77% rename from sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_operations_client.go rename to sdk/resourcemanager/iotsecurity/armiotsecurity/operations_client.go index 55f8ce03c085..4aafa53308a2 100644 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_operations_client.go +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/operations_client.go @@ -5,6 +5,7 @@ // 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 armiotsecurity @@ -12,8 +13,6 @@ import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -22,36 +21,27 @@ import ( // OperationsClient contains the methods for the Operations group. // Don't use this type directly, use NewOperationsClient() instead. type OperationsClient struct { - host string - pl runtime.Pipeline + 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. +// - 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) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &OperationsClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // NewListPager - List of available operations -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// - 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 { @@ -68,7 +58,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption if err != nil { return OperationsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return OperationsClientListResponse{}, err } @@ -83,7 +73,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption // listCreateRequest creates the List request. func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.IoTSecurity/operations" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/operations_client_example_test.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/operations_client_example_test.go new file mode 100644 index 000000000000..20d65150ec1b --- /dev/null +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/operations_client_example_test.go @@ -0,0 +1,116 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armiotsecurity_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotsecurity/armiotsecurity" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Operations/List.json +func ExampleOperationsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.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.OperationList = armiotsecurity.OperationList{ + // Value: []*armiotsecurity.Operation{ + // { + // Name: to.Ptr("Microsoft.IoTSecurity/unregister/action"), + // Display: &armiotsecurity.OperationDisplay{ + // Description: to.Ptr("Unregisters the subscription for Azure Defender for IoT"), + // Operation: to.Ptr("Unregister Subscription"), + // Provider: to.Ptr("Microsoft IoT Security"), + // Resource: to.Ptr("Subscription"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.IoTSecurity/register/action"), + // Display: &armiotsecurity.OperationDisplay{ + // Description: to.Ptr("Registers the subscription for Azure Defender for IoT"), + // Operation: to.Ptr("Register Subscription"), + // Provider: to.Ptr("Microsoft IoT Security"), + // Resource: to.Ptr("Subscription"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.IoTSecurity/defenderSettings/read"), + // Display: &armiotsecurity.OperationDisplay{ + // Description: to.Ptr("Gets IoT Defender Settings"), + // Operation: to.Ptr("Get IoT Defender Settings"), + // Provider: to.Ptr("Microsoft IoT Security"), + // Resource: to.Ptr("IoT Defender Settings"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.IoTSecurity/defenderSettings/write"), + // Display: &armiotsecurity.OperationDisplay{ + // Description: to.Ptr("Creates or updates IoT Defender Settings"), + // Operation: to.Ptr("Create or update IoT Defender Settings"), + // Provider: to.Ptr("Microsoft IoT Security"), + // Resource: to.Ptr("IoT Defender Settings"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.IoTSecurity/defenderSettings/delete"), + // Display: &armiotsecurity.OperationDisplay{ + // Description: to.Ptr("Deletes IoT Defender Settings"), + // Operation: to.Ptr("Delete IoT Defender Settings"), + // Provider: to.Ptr("Microsoft IoT Security"), + // Resource: to.Ptr("IoT Defender Settings"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.IoTSecurity/defenderSettings/packageDownloads/action"), + // Display: &armiotsecurity.OperationDisplay{ + // Description: to.Ptr("Gets downloadable IoT Defender packages information"), + // Operation: to.Ptr("Get downloadable IoT Defender packages information"), + // Provider: to.Ptr("Microsoft IoT Security"), + // Resource: to.Ptr("IoT Defender Settings"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.IoTSecurity/defenderSettings/downloadManagerActivation/action"), + // Display: &armiotsecurity.OperationDisplay{ + // Description: to.Ptr("Download manager activation file"), + // Operation: to.Ptr("Download manager activation file"), + // Provider: to.Ptr("Microsoft IoT Security"), + // Resource: to.Ptr("IoT Defender Settings"), + // }, + // Origin: to.Ptr("user"), + // }}, + // } + } +} diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_response_types.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/response_types.go similarity index 97% rename from sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_response_types.go rename to sdk/resourcemanager/iotsecurity/armiotsecurity/response_types.go index 0929104d8d42..8460c1340793 100644 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_response_types.go +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/response_types.go @@ -5,6 +5,7 @@ // 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 armiotsecurity @@ -56,7 +57,7 @@ type DeviceGroupsClientGetResponse struct { DeviceGroupModel } -// DeviceGroupsClientListResponse contains the response from method DeviceGroupsClient.List. +// DeviceGroupsClientListResponse contains the response from method DeviceGroupsClient.NewListPager. type DeviceGroupsClientListResponse struct { DeviceGroupList } @@ -66,7 +67,7 @@ type DevicesClientGetResponse struct { DeviceModel } -// DevicesClientListResponse contains the response from method DevicesClient.List. +// DevicesClientListResponse contains the response from method DevicesClient.NewListPager. type DevicesClientListResponse struct { DeviceList } @@ -76,7 +77,7 @@ type LocationsClientGetResponse struct { LocationModel } -// LocationsClientListResponse contains the response from method LocationsClient.List. +// LocationsClientListResponse contains the response from method LocationsClient.NewListPager. type LocationsClientListResponse struct { LocationList } @@ -113,7 +114,7 @@ type OnPremiseSensorsClientListResponse struct { OnPremiseSensorsList } -// OperationsClientListResponse contains the response from method OperationsClient.List. +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { OperationList } diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_sensors_client.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/sensors_client.go similarity index 82% rename from sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_sensors_client.go rename to sdk/resourcemanager/iotsecurity/armiotsecurity/sensors_client.go index bd331f4ce22e..484236f88b8d 100644 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_sensors_client.go +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/sensors_client.go @@ -5,6 +5,7 @@ // 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 armiotsecurity @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,45 +24,37 @@ import ( // SensorsClient contains the methods for the Sensors group. // Don't use this type directly, use NewSensorsClient() instead. type SensorsClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewSensorsClient creates a new instance of SensorsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewSensorsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SensorsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".SensorsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &SensorsClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // CreateOrUpdate - Create or update IoT sensor // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// scope - Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) -// sensorName - Name of the IoT sensor -// sensorModel - The IoT sensor model -// options - SensorsClientCreateOrUpdateOptions contains the optional parameters for the SensorsClient.CreateOrUpdate method. +// - scope - Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) +// - sensorName - Name of the IoT sensor +// - sensorModel - The IoT sensor model +// - options - SensorsClientCreateOrUpdateOptions contains the optional parameters for the SensorsClient.CreateOrUpdate method. func (client *SensorsClient) CreateOrUpdate(ctx context.Context, scope string, sensorName string, sensorModel SensorModel, options *SensorsClientCreateOrUpdateOptions) (SensorsClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, scope, sensorName, sensorModel, options) if err != nil { return SensorsClientCreateOrUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SensorsClientCreateOrUpdateResponse{}, err } @@ -81,7 +72,7 @@ func (client *SensorsClient) createOrUpdateCreateRequest(ctx context.Context, sc return nil, errors.New("parameter sensorName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{sensorName}", url.PathEscape(sensorName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -103,16 +94,17 @@ func (client *SensorsClient) createOrUpdateHandleResponse(resp *http.Response) ( // Delete - Delete IoT sensor // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// scope - Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) -// sensorName - Name of the IoT sensor -// options - SensorsClientDeleteOptions contains the optional parameters for the SensorsClient.Delete method. +// - scope - Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) +// - sensorName - Name of the IoT sensor +// - options - SensorsClientDeleteOptions contains the optional parameters for the SensorsClient.Delete method. func (client *SensorsClient) Delete(ctx context.Context, scope string, sensorName string, options *SensorsClientDeleteOptions) (SensorsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, scope, sensorName, options) if err != nil { return SensorsClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SensorsClientDeleteResponse{}, err } @@ -130,7 +122,7 @@ func (client *SensorsClient) deleteCreateRequest(ctx context.Context, scope stri return nil, errors.New("parameter sensorName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{sensorName}", url.PathEscape(sensorName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -143,17 +135,18 @@ func (client *SensorsClient) deleteCreateRequest(ctx context.Context, scope stri // DownloadActivation - Download sensor activation file // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// scope - Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) -// sensorName - Name of the IoT sensor -// options - SensorsClientDownloadActivationOptions contains the optional parameters for the SensorsClient.DownloadActivation -// method. +// - scope - Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) +// - sensorName - Name of the IoT sensor +// - options - SensorsClientDownloadActivationOptions contains the optional parameters for the SensorsClient.DownloadActivation +// method. func (client *SensorsClient) DownloadActivation(ctx context.Context, scope string, sensorName string, options *SensorsClientDownloadActivationOptions) (SensorsClientDownloadActivationResponse, error) { req, err := client.downloadActivationCreateRequest(ctx, scope, sensorName, options) if err != nil { return SensorsClientDownloadActivationResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SensorsClientDownloadActivationResponse{}, err } @@ -171,7 +164,7 @@ func (client *SensorsClient) downloadActivationCreateRequest(ctx context.Context return nil, errors.New("parameter sensorName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{sensorName}", url.PathEscape(sensorName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -185,18 +178,19 @@ func (client *SensorsClient) downloadActivationCreateRequest(ctx context.Context // DownloadResetPassword - Download file for reset password of the sensor // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// scope - Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) -// sensorName - Name of the IoT sensor -// body - The reset password input. -// options - SensorsClientDownloadResetPasswordOptions contains the optional parameters for the SensorsClient.DownloadResetPassword -// method. +// - scope - Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) +// - sensorName - Name of the IoT sensor +// - body - The reset password input. +// - options - SensorsClientDownloadResetPasswordOptions contains the optional parameters for the SensorsClient.DownloadResetPassword +// method. func (client *SensorsClient) DownloadResetPassword(ctx context.Context, scope string, sensorName string, body ResetPasswordInput, options *SensorsClientDownloadResetPasswordOptions) (SensorsClientDownloadResetPasswordResponse, error) { req, err := client.downloadResetPasswordCreateRequest(ctx, scope, sensorName, body, options) if err != nil { return SensorsClientDownloadResetPasswordResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SensorsClientDownloadResetPasswordResponse{}, err } @@ -214,7 +208,7 @@ func (client *SensorsClient) downloadResetPasswordCreateRequest(ctx context.Cont return nil, errors.New("parameter sensorName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{sensorName}", url.PathEscape(sensorName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -228,16 +222,17 @@ func (client *SensorsClient) downloadResetPasswordCreateRequest(ctx context.Cont // Get - Get IoT sensor // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// scope - Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) -// sensorName - Name of the IoT sensor -// options - SensorsClientGetOptions contains the optional parameters for the SensorsClient.Get method. +// - scope - Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) +// - sensorName - Name of the IoT sensor +// - options - SensorsClientGetOptions contains the optional parameters for the SensorsClient.Get method. func (client *SensorsClient) Get(ctx context.Context, scope string, sensorName string, options *SensorsClientGetOptions) (SensorsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, scope, sensorName, options) if err != nil { return SensorsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SensorsClientGetResponse{}, err } @@ -255,7 +250,7 @@ func (client *SensorsClient) getCreateRequest(ctx context.Context, scope string, return nil, errors.New("parameter sensorName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{sensorName}", url.PathEscape(sensorName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -277,15 +272,16 @@ func (client *SensorsClient) getHandleResponse(resp *http.Response) (SensorsClie // List - List IoT sensors // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// scope - Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) -// options - SensorsClientListOptions contains the optional parameters for the SensorsClient.List method. +// - scope - Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) +// - options - SensorsClientListOptions contains the optional parameters for the SensorsClient.List method. func (client *SensorsClient) List(ctx context.Context, scope string, options *SensorsClientListOptions) (SensorsClientListResponse, error) { req, err := client.listCreateRequest(ctx, scope, options) if err != nil { return SensorsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SensorsClientListResponse{}, err } @@ -299,7 +295,7 @@ func (client *SensorsClient) List(ctx context.Context, scope string, options *Se func (client *SensorsClient) listCreateRequest(ctx context.Context, scope string, options *SensorsClientListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.IoTSecurity/sensors" urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -321,17 +317,18 @@ func (client *SensorsClient) listHandleResponse(resp *http.Response) (SensorsCli // TriggerTiPackageUpdate - Trigger threat intelligence package update // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// scope - Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) -// sensorName - Name of the IoT sensor -// options - SensorsClientTriggerTiPackageUpdateOptions contains the optional parameters for the SensorsClient.TriggerTiPackageUpdate -// method. +// - scope - Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) +// - sensorName - Name of the IoT sensor +// - options - SensorsClientTriggerTiPackageUpdateOptions contains the optional parameters for the SensorsClient.TriggerTiPackageUpdate +// method. func (client *SensorsClient) TriggerTiPackageUpdate(ctx context.Context, scope string, sensorName string, options *SensorsClientTriggerTiPackageUpdateOptions) (SensorsClientTriggerTiPackageUpdateResponse, error) { req, err := client.triggerTiPackageUpdateCreateRequest(ctx, scope, sensorName, options) if err != nil { return SensorsClientTriggerTiPackageUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SensorsClientTriggerTiPackageUpdateResponse{}, err } @@ -349,7 +346,7 @@ func (client *SensorsClient) triggerTiPackageUpdateCreateRequest(ctx context.Con return nil, errors.New("parameter sensorName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{sensorName}", url.PathEscape(sensorName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/sensors_client_example_test.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/sensors_client_example_test.go new file mode 100644 index 000000000000..1a909b5f6648 --- /dev/null +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/sensors_client_example_test.go @@ -0,0 +1,250 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armiotsecurity_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/iotsecurity/armiotsecurity" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Sensors/List.json +func ExampleSensorsClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSensorsClient().List(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SensorsList = armiotsecurity.SensorsList{ + // Value: []*armiotsecurity.SensorModel{ + // { + // Name: to.Ptr("mySensor"), + // Type: to.Ptr("Microsoft.IoTSecurity/sensors"), + // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub/providers/Microsoft.IoTSecurity/sensors/mySensor"), + // Properties: &armiotsecurity.SensorProperties{ + // ConnectivityTime: to.Ptr("2020-11-17T12:31:25Z"), + // DynamicLearning: to.Ptr(true), + // LearningMode: to.Ptr(true), + // SensorStatus: to.Ptr(armiotsecurity.SensorStatusOk), + // SensorType: to.Ptr(armiotsecurity.SensorTypeOt), + // SensorVersion: to.Ptr("2020.11.01.1643"), + // TiAutomaticUpdates: to.Ptr(true), + // TiStatus: to.Ptr(armiotsecurity.TiStatusOk), + // TiVersion: to.Ptr("2020-11-17T12:31:25Z"), + // Zone: to.Ptr("Zone Name"), + // }, + // SystemData: &armiotsecurity.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // }, + // }, + // { + // Name: to.Ptr("otherSensor"), + // Type: to.Ptr("Microsoft.IoTSecurity/sensors"), + // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub/providers/Microsoft.IoTSecurity/sensors/otherSensor"), + // Properties: &armiotsecurity.SensorProperties{ + // ConnectivityTime: to.Ptr("2020-11-17T12:31:25Z"), + // DynamicLearning: to.Ptr(false), + // LearningMode: to.Ptr(false), + // SensorStatus: to.Ptr(armiotsecurity.SensorStatusDisconnected), + // SensorType: to.Ptr(armiotsecurity.SensorTypeOt), + // SensorVersion: to.Ptr("2020.11.01.1643"), + // TiAutomaticUpdates: to.Ptr(true), + // TiStatus: to.Ptr(armiotsecurity.TiStatusOk), + // TiVersion: to.Ptr("2020-11-17T12:31:25Z"), + // Zone: to.Ptr("Zone Name"), + // }, + // SystemData: &armiotsecurity.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // }, + // }}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Sensors/Get.json +func ExampleSensorsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSensorsClient().Get(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", "mySensor", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SensorModel = armiotsecurity.SensorModel{ + // Name: to.Ptr("mySensor"), + // Type: to.Ptr("Microsoft.IoTSecurity/sensors"), + // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub/providers/Microsoft.IoTSecurity/sensors/mySensor"), + // Properties: &armiotsecurity.SensorProperties{ + // ConnectivityTime: to.Ptr("2020-11-17T12:31:25Z"), + // DynamicLearning: to.Ptr(true), + // LearningMode: to.Ptr(true), + // SensorStatus: to.Ptr(armiotsecurity.SensorStatusOk), + // SensorType: to.Ptr(armiotsecurity.SensorTypeOt), + // SensorVersion: to.Ptr("2020.11.01.1643"), + // TiAutomaticUpdates: to.Ptr(true), + // TiStatus: to.Ptr(armiotsecurity.TiStatusOk), + // TiVersion: to.Ptr("2020-11-17T12:31:25Z"), + // Zone: to.Ptr("Zone Name"), + // }, + // SystemData: &armiotsecurity.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Sensors/Put.json +func ExampleSensorsClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSensorsClient().CreateOrUpdate(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", "mySensor", armiotsecurity.SensorModel{ + Properties: &armiotsecurity.SensorProperties{ + SensorType: to.Ptr(armiotsecurity.SensorTypeOt), + TiAutomaticUpdates: to.Ptr(true), + Zone: to.Ptr("Zone 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.SensorModel = armiotsecurity.SensorModel{ + // Name: to.Ptr("mySensor"), + // Type: to.Ptr("Microsoft.IoTSecurity/sensors"), + // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub/providers/Microsoft.IoTSecurity/sensors/mySensor"), + // Properties: &armiotsecurity.SensorProperties{ + // ConnectivityTime: to.Ptr("2020-11-17T12:31:25Z"), + // DynamicLearning: to.Ptr(true), + // LearningMode: to.Ptr(true), + // SensorStatus: to.Ptr(armiotsecurity.SensorStatusOk), + // SensorType: to.Ptr(armiotsecurity.SensorTypeOt), + // SensorVersion: to.Ptr("2020.11.01.1643"), + // TiAutomaticUpdates: to.Ptr(true), + // TiStatus: to.Ptr(armiotsecurity.TiStatusOk), + // TiVersion: to.Ptr("2020-11-17T12:31:25Z"), + // Zone: to.Ptr("Zone Name"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Sensors/Delete.json +func ExampleSensorsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewSensorsClient().Delete(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", "mySensor", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Sensors/DownloadActivation.json +func ExampleSensorsClient_DownloadActivation() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewSensorsClient().DownloadActivation(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", "mySensor", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Sensors/DownloadResetPassword.json +func ExampleSensorsClient_DownloadResetPassword() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewSensorsClient().DownloadResetPassword(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", "mySensor", armiotsecurity.ResetPasswordInput{ + ApplianceID: to.Ptr("3214-528AV23-D121-D3-E1"), + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Sensors/TriggerTiPackageUpdate.json +func ExampleSensorsClient_TriggerTiPackageUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewSensorsClient().TriggerTiPackageUpdate(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", "mySensor", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_sites_client.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/sites_client.go similarity index 81% rename from sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_sites_client.go rename to sdk/resourcemanager/iotsecurity/armiotsecurity/sites_client.go index 07c0311adf8b..dda37aa20f88 100644 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_sites_client.go +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/sites_client.go @@ -5,6 +5,7 @@ // 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 armiotsecurity @@ -12,8 +13,6 @@ import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -23,44 +22,36 @@ import ( // SitesClient contains the methods for the Sites group. // Don't use this type directly, use NewSitesClient() instead. type SitesClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewSitesClient creates a new instance of SitesClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewSitesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SitesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".SitesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &SitesClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // CreateOrUpdate - Create or update IoT site // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// scope - Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) -// siteModel - The IoT sites model -// options - SitesClientCreateOrUpdateOptions contains the optional parameters for the SitesClient.CreateOrUpdate method. +// - scope - Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) +// - siteModel - The IoT sites model +// - options - SitesClientCreateOrUpdateOptions contains the optional parameters for the SitesClient.CreateOrUpdate method. func (client *SitesClient) CreateOrUpdate(ctx context.Context, scope string, siteModel SiteModel, options *SitesClientCreateOrUpdateOptions) (SitesClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, scope, siteModel, options) if err != nil { return SitesClientCreateOrUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SitesClientCreateOrUpdateResponse{}, err } @@ -74,7 +65,7 @@ func (client *SitesClient) CreateOrUpdate(ctx context.Context, scope string, sit func (client *SitesClient) createOrUpdateCreateRequest(ctx context.Context, scope string, siteModel SiteModel, options *SitesClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.IoTSecurity/sites/default" urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -96,15 +87,16 @@ func (client *SitesClient) createOrUpdateHandleResponse(resp *http.Response) (Si // Delete - Delete IoT site // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// scope - Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) -// options - SitesClientDeleteOptions contains the optional parameters for the SitesClient.Delete method. +// - scope - Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) +// - options - SitesClientDeleteOptions contains the optional parameters for the SitesClient.Delete method. func (client *SitesClient) Delete(ctx context.Context, scope string, options *SitesClientDeleteOptions) (SitesClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, scope, options) if err != nil { return SitesClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SitesClientDeleteResponse{}, err } @@ -118,7 +110,7 @@ func (client *SitesClient) Delete(ctx context.Context, scope string, options *Si func (client *SitesClient) deleteCreateRequest(ctx context.Context, scope string, options *SitesClientDeleteOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.IoTSecurity/sites/default" urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -131,15 +123,16 @@ func (client *SitesClient) deleteCreateRequest(ctx context.Context, scope string // Get - Get IoT site // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// scope - Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) -// options - SitesClientGetOptions contains the optional parameters for the SitesClient.Get method. +// - scope - Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) +// - options - SitesClientGetOptions contains the optional parameters for the SitesClient.Get method. func (client *SitesClient) Get(ctx context.Context, scope string, options *SitesClientGetOptions) (SitesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, scope, options) if err != nil { return SitesClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SitesClientGetResponse{}, err } @@ -153,7 +146,7 @@ func (client *SitesClient) Get(ctx context.Context, scope string, options *Sites func (client *SitesClient) getCreateRequest(ctx context.Context, scope string, options *SitesClientGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.IoTSecurity/sites/default" urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -175,15 +168,16 @@ func (client *SitesClient) getHandleResponse(resp *http.Response) (SitesClientGe // List - List IoT sites // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-02-01-preview -// scope - Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) -// options - SitesClientListOptions contains the optional parameters for the SitesClient.List method. +// - scope - Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) +// - options - SitesClientListOptions contains the optional parameters for the SitesClient.List method. func (client *SitesClient) List(ctx context.Context, scope string, options *SitesClientListOptions) (SitesClientListResponse, error) { req, err := client.listCreateRequest(ctx, scope, options) if err != nil { return SitesClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SitesClientListResponse{}, err } @@ -197,7 +191,7 @@ func (client *SitesClient) List(ctx context.Context, scope string, options *Site func (client *SitesClient) listCreateRequest(ctx context.Context, scope string, options *SitesClientListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.IoTSecurity/sites" urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/sites_client_example_test.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/sites_client_example_test.go new file mode 100644 index 000000000000..753320e63904 --- /dev/null +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/sites_client_example_test.go @@ -0,0 +1,167 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armiotsecurity_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/iotsecurity/armiotsecurity" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Sites/List.json +func ExampleSitesClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSitesClient().List(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub/sites", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SitesList = armiotsecurity.SitesList{ + // Value: []*armiotsecurity.SiteModel{ + // { + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.IoTSecurity/sites"), + // ID: to.Ptr("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub/providers/Microsoft.IoTSecurity/sites/default"), + // Properties: &armiotsecurity.SiteProperties{ + // DisplayName: to.Ptr("IoT site name"), + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // "key2": to.Ptr("value2"), + // }, + // }, + // SystemData: &armiotsecurity.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // }, + // }}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Sites/Get.json +func ExampleSitesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSitesClient().Get(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SiteModel = armiotsecurity.SiteModel{ + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.IoTSecurity/sites"), + // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub/providers/Microsoft.IoTSecurity/sites/default"), + // Properties: &armiotsecurity.SiteProperties{ + // DisplayName: to.Ptr("IoT site name"), + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // "key2": to.Ptr("value2"), + // }, + // }, + // SystemData: &armiotsecurity.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Sites/Put.json +func ExampleSitesClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSitesClient().CreateOrUpdate(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", armiotsecurity.SiteModel{ + Properties: &armiotsecurity.SiteProperties{ + DisplayName: to.Ptr("IoT site name"), + 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) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SiteModel = armiotsecurity.SiteModel{ + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.IoTSecurity/sites"), + // ID: to.Ptr("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub/providers/Microsoft.IoTSecurity/sites/default"), + // Properties: &armiotsecurity.SiteProperties{ + // DisplayName: to.Ptr("IoT site name"), + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // "key2": to.Ptr("value2"), + // }, + // }, + // SystemData: &armiotsecurity.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-27T21:53:29.0928001Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armiotsecurity.CreatedByTypeUser), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Sites/Delete.json +func ExampleSitesClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armiotsecurity.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewSitesClient().Delete(ctx, "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_time_rfc3339.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/time_rfc3339.go similarity index 96% rename from sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/iotsecurity/armiotsecurity/time_rfc3339.go index 9d99020150f1..d339dbb43f9b 100644 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/iotsecurity/armiotsecurity/time_rfc3339.go @@ -5,6 +5,7 @@ // 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 armiotsecurity @@ -61,7 +62,7 @@ func (t *timeRFC3339) Parse(layout, value string) error { return err } -func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_defendersettings_client_test.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_defendersettings_client_test.go deleted file mode 100644 index ea0b0ab2612e..000000000000 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_defendersettings_client_test.go +++ /dev/null @@ -1,145 +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. - -package armiotsecurity_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/iotsecurity/armiotsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/DefenderSettings/List.json -func ExampleDefenderSettingsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewDefenderSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/DefenderSettings/Get.json -func ExampleDefenderSettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewDefenderSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/DefenderSettings/Put.json -func ExampleDefenderSettingsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewDefenderSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - armiotsecurity.DefenderSettingsModel{ - Properties: &armiotsecurity.DefenderSettingsProperties{ - DeviceQuota: to.Ptr[int32](2000), - MdeIntegration: &armiotsecurity.DefenderSettingsPropertiesMdeIntegration{ - Status: to.Ptr(armiotsecurity.MdeIntegrationEnabled), - }, - OnboardingKind: to.Ptr(armiotsecurity.OnboardingKindDefault), - SentinelWorkspaceResourceIDs: []*string{ - to.Ptr("/subscriptions/c4930e90-cd72-4aa5-93e9-2d081d129569/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace1")}, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/DefenderSettings/Delete.json -func ExampleDefenderSettingsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewDefenderSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/DefenderSettings/PackageDownloads.json -func ExampleDefenderSettingsClient_PackageDownloads() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewDefenderSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.PackageDownloads(ctx, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/DefenderSettings/DownloadManagerActivation.json -func ExampleDefenderSettingsClient_DownloadManagerActivation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewDefenderSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.DownloadManagerActivation(ctx, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_devicegroups_client_test.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_devicegroups_client_test.go deleted file mode 100644 index fcd088afc68f..000000000000 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_devicegroups_client_test.go +++ /dev/null @@ -1,109 +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. - -package armiotsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotsecurity/armiotsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/DeviceGroups/List.json -func ExampleDeviceGroupsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewDeviceGroupsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", - "eastus", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/DeviceGroups/Get.json -func ExampleDeviceGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewDeviceGroupsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", - "eastus", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myGroup", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/DeviceGroups/Put.json -func ExampleDeviceGroupsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewDeviceGroupsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", - "eastus", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "myGroup", - armiotsecurity.DeviceGroupModel{ - Properties: map[string]interface{}{}, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/DeviceGroups/Delete.json -func ExampleDeviceGroupsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewDeviceGroupsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", - "eastus", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "myGroup", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_devices_client_test.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_devices_client_test.go deleted file mode 100644 index 39553278fd3c..000000000000 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_devices_client_test.go +++ /dev/null @@ -1,66 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armiotsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotsecurity/armiotsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Devices/List.json -func ExampleDevicesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewDevicesClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", - "eastus", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myGroup", - &armiotsecurity.DevicesClientListOptions{SkipToken: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Devices/Get.json -func ExampleDevicesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewDevicesClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", - "eastus", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myGroup", - "fa30e727-16e1-4e81-84f1-d26b9153d1b2", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_locations_client_test.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_locations_client_test.go deleted file mode 100644 index f2a38f0d25e1..000000000000 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_locations_client_test.go +++ /dev/null @@ -1,63 +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. - -package armiotsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotsecurity/armiotsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Locations/List.json -func ExampleLocationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewLocationsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", - "", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Locations/Get.json -func ExampleLocationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewLocationsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", - "eastus", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_onpremisesensors_client_test.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_onpremisesensors_client_test.go deleted file mode 100644 index 25a5b9c6fe7a..000000000000 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_onpremisesensors_client_test.go +++ /dev/null @@ -1,140 +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. - -package armiotsecurity_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/iotsecurity/armiotsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/OnPremiseSensors/List.json -func ExampleOnPremiseSensorsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewOnPremiseSensorsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/OnPremiseSensors/Get.json -func ExampleOnPremiseSensorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewOnPremiseSensorsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "mySensor", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/OnPremiseSensors/Put.json -func ExampleOnPremiseSensorsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewOnPremiseSensorsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "mySensor", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/OnPremiseSensors/Delete.json -func ExampleOnPremiseSensorsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewOnPremiseSensorsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc24", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "mySensor", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/OnPremiseSensors/DownloadActivation.json -func ExampleOnPremiseSensorsClient_DownloadActivation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewOnPremiseSensorsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.DownloadActivation(ctx, - "mySensor", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/OnPremiseSensors/DownloadResetPassword.json -func ExampleOnPremiseSensorsClient_DownloadResetPassword() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewOnPremiseSensorsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.DownloadResetPassword(ctx, - "mySensor", - armiotsecurity.ResetPasswordInput{ - ApplianceID: to.Ptr("3214-528AV23-D121-D3-E1"), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_operations_client_test.go deleted file mode 100644 index 8608a41f2c6d..000000000000 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_operations_client_test.go +++ /dev/null @@ -1,41 +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. - -package armiotsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotsecurity/armiotsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Operations/List.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_sensors_client_test.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_sensors_client_test.go deleted file mode 100644 index 9fbecd8a3f15..000000000000 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_sensors_client_test.go +++ /dev/null @@ -1,173 +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. - -package armiotsecurity_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/iotsecurity/armiotsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Sensors/List.json -func ExampleSensorsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewSensorsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Sensors/Get.json -func ExampleSensorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewSensorsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", - "mySensor", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Sensors/Put.json -func ExampleSensorsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewSensorsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", - "mySensor", - armiotsecurity.SensorModel{ - Properties: &armiotsecurity.SensorProperties{ - SensorType: to.Ptr(armiotsecurity.SensorTypeOt), - TiAutomaticUpdates: to.Ptr(true), - Zone: to.Ptr("Zone Name"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Sensors/Delete.json -func ExampleSensorsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewSensorsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", - "mySensor", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Sensors/DownloadActivation.json -func ExampleSensorsClient_DownloadActivation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewSensorsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.DownloadActivation(ctx, - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", - "mySensor", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Sensors/DownloadResetPassword.json -func ExampleSensorsClient_DownloadResetPassword() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewSensorsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.DownloadResetPassword(ctx, - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", - "mySensor", - armiotsecurity.ResetPasswordInput{ - ApplianceID: to.Ptr("3214-528AV23-D121-D3-E1"), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Sensors/TriggerTiPackageUpdate.json -func ExampleSensorsClient_TriggerTiPackageUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewSensorsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.TriggerTiPackageUpdate(ctx, - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", - "mySensor", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_sites_client_test.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_sites_client_test.go deleted file mode 100644 index 91c9802fb1cf..000000000000 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/ze_generated_example_sites_client_test.go +++ /dev/null @@ -1,109 +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. - -package armiotsecurity_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/iotsecurity/armiotsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Sites/List.json -func ExampleSitesClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewSitesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub/sites", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Sites/Get.json -func ExampleSitesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewSitesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Sites/Put.json -func ExampleSitesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewSitesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", - armiotsecurity.SiteModel{ - Properties: &armiotsecurity.SiteProperties{ - DisplayName: to.Ptr("IoT site name"), - 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iotsecurity/resource-manager/Microsoft.IoTSecurity/preview/2021-02-01-preview/examples/Sites/Delete.json -func ExampleSitesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiotsecurity.NewSitesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/myHub", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_models_serde.go b/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_models_serde.go deleted file mode 100644 index e4601e20c067..000000000000 --- a/sdk/resourcemanager/iotsecurity/armiotsecurity/zz_generated_models_serde.go +++ /dev/null @@ -1,374 +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. - -package armiotsecurity - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type DefenderSettingsProperties. -func (d DefenderSettingsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "deviceQuota", d.DeviceQuota) - populateTimeRFC3339(objectMap, "evaluationEndTime", d.EvaluationEndTime) - populate(objectMap, "mdeIntegration", d.MdeIntegration) - populate(objectMap, "onboardingKind", d.OnboardingKind) - populate(objectMap, "sentinelWorkspaceResourceIds", d.SentinelWorkspaceResourceIDs) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderSettingsProperties. -func (d *DefenderSettingsProperties) UnmarshalJSON(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 "deviceQuota": - err = unpopulate(val, "DeviceQuota", &d.DeviceQuota) - delete(rawMsg, key) - case "evaluationEndTime": - err = unpopulateTimeRFC3339(val, "EvaluationEndTime", &d.EvaluationEndTime) - delete(rawMsg, key) - case "mdeIntegration": - err = unpopulate(val, "MdeIntegration", &d.MdeIntegration) - delete(rawMsg, key) - case "onboardingKind": - err = unpopulate(val, "OnboardingKind", &d.OnboardingKind) - delete(rawMsg, key) - case "sentinelWorkspaceResourceIds": - err = unpopulate(val, "SentinelWorkspaceResourceIDs", &d.SentinelWorkspaceResourceIDs) - 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 DeviceProperties. -func (d DeviceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalFields", &d.AdditionalFields) - populate(objectMap, "authorizedState", d.AuthorizedState) - populate(objectMap, "businessFunction", d.BusinessFunction) - populate(objectMap, "cpes", d.Cpes) - populate(objectMap, "criticality", d.Criticality) - populate(objectMap, "deviceCategoryDisplayName", d.DeviceCategoryDisplayName) - populate(objectMap, "deviceCategoryId", d.DeviceCategoryID) - populate(objectMap, "deviceDataSource", d.DeviceDataSource) - populate(objectMap, "deviceName", d.DeviceName) - populate(objectMap, "deviceStatus", d.DeviceStatus) - populate(objectMap, "deviceSubTypeDisplayName", d.DeviceSubTypeDisplayName) - populate(objectMap, "deviceSubTypeId", d.DeviceSubTypeID) - populate(objectMap, "deviceTags", d.DeviceTags) - populate(objectMap, "deviceTypeDisplayName", d.DeviceTypeDisplayName) - populate(objectMap, "deviceTypeId", d.DeviceTypeID) - populate(objectMap, "firmwares", d.Firmwares) - populateTimeRFC3339(objectMap, "firstSeen", d.FirstSeen) - populate(objectMap, "hardware", d.Hardware) - populateTimeRFC3339(objectMap, "lastProgrammingTime", d.LastProgrammingTime) - populateTimeRFC3339(objectMap, "lastSeen", d.LastSeen) - populateTimeRFC3339(objectMap, "lastUpdated", d.LastUpdated) - populate(objectMap, "mergedDevices", d.MergedDevices) - populate(objectMap, "mergedToDeviceId", d.MergedToDeviceID) - populate(objectMap, "nics", d.Nics) - populate(objectMap, "onboardingStatus", d.OnboardingStatus) - populate(objectMap, "operatingSystem", d.OperatingSystem) - populate(objectMap, "packages", d.Packages) - populate(objectMap, "parentDeviceId", d.ParentDeviceID) - populate(objectMap, "parentRackNumber", d.ParentRackNumber) - populate(objectMap, "parentSlotNumber", d.ParentSlotNumber) - populate(objectMap, "profilingConfidence", d.ProfilingConfidence) - populate(objectMap, "programmingState", d.ProgrammingState) - populate(objectMap, "purdueLevel", d.PurdueLevel) - populate(objectMap, "riskScore", d.RiskScore) - populate(objectMap, "schemaVersion", d.SchemaVersion) - populate(objectMap, "sensor", d.Sensor) - populate(objectMap, "slots", d.Slots) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceProperties. -func (d *DeviceProperties) UnmarshalJSON(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 "additionalFields": - err = unpopulate(val, "AdditionalFields", &d.AdditionalFields) - delete(rawMsg, key) - case "authorizedState": - err = unpopulate(val, "AuthorizedState", &d.AuthorizedState) - delete(rawMsg, key) - case "businessFunction": - err = unpopulate(val, "BusinessFunction", &d.BusinessFunction) - delete(rawMsg, key) - case "cpes": - err = unpopulate(val, "Cpes", &d.Cpes) - delete(rawMsg, key) - case "criticality": - err = unpopulate(val, "Criticality", &d.Criticality) - delete(rawMsg, key) - case "deviceCategoryDisplayName": - err = unpopulate(val, "DeviceCategoryDisplayName", &d.DeviceCategoryDisplayName) - delete(rawMsg, key) - case "deviceCategoryId": - err = unpopulate(val, "DeviceCategoryID", &d.DeviceCategoryID) - delete(rawMsg, key) - case "deviceDataSource": - err = unpopulate(val, "DeviceDataSource", &d.DeviceDataSource) - delete(rawMsg, key) - case "deviceName": - err = unpopulate(val, "DeviceName", &d.DeviceName) - delete(rawMsg, key) - case "deviceStatus": - err = unpopulate(val, "DeviceStatus", &d.DeviceStatus) - delete(rawMsg, key) - case "deviceSubTypeDisplayName": - err = unpopulate(val, "DeviceSubTypeDisplayName", &d.DeviceSubTypeDisplayName) - delete(rawMsg, key) - case "deviceSubTypeId": - err = unpopulate(val, "DeviceSubTypeID", &d.DeviceSubTypeID) - delete(rawMsg, key) - case "deviceTags": - err = unpopulate(val, "DeviceTags", &d.DeviceTags) - delete(rawMsg, key) - case "deviceTypeDisplayName": - err = unpopulate(val, "DeviceTypeDisplayName", &d.DeviceTypeDisplayName) - delete(rawMsg, key) - case "deviceTypeId": - err = unpopulate(val, "DeviceTypeID", &d.DeviceTypeID) - delete(rawMsg, key) - case "firmwares": - err = unpopulate(val, "Firmwares", &d.Firmwares) - delete(rawMsg, key) - case "firstSeen": - err = unpopulateTimeRFC3339(val, "FirstSeen", &d.FirstSeen) - delete(rawMsg, key) - case "hardware": - err = unpopulate(val, "Hardware", &d.Hardware) - delete(rawMsg, key) - case "lastProgrammingTime": - err = unpopulateTimeRFC3339(val, "LastProgrammingTime", &d.LastProgrammingTime) - delete(rawMsg, key) - case "lastSeen": - err = unpopulateTimeRFC3339(val, "LastSeen", &d.LastSeen) - delete(rawMsg, key) - case "lastUpdated": - err = unpopulateTimeRFC3339(val, "LastUpdated", &d.LastUpdated) - delete(rawMsg, key) - case "mergedDevices": - err = unpopulate(val, "MergedDevices", &d.MergedDevices) - delete(rawMsg, key) - case "mergedToDeviceId": - err = unpopulate(val, "MergedToDeviceID", &d.MergedToDeviceID) - delete(rawMsg, key) - case "nics": - err = unpopulate(val, "Nics", &d.Nics) - delete(rawMsg, key) - case "onboardingStatus": - err = unpopulate(val, "OnboardingStatus", &d.OnboardingStatus) - delete(rawMsg, key) - case "operatingSystem": - err = unpopulate(val, "OperatingSystem", &d.OperatingSystem) - delete(rawMsg, key) - case "packages": - err = unpopulate(val, "Packages", &d.Packages) - delete(rawMsg, key) - case "parentDeviceId": - err = unpopulate(val, "ParentDeviceID", &d.ParentDeviceID) - delete(rawMsg, key) - case "parentRackNumber": - err = unpopulate(val, "ParentRackNumber", &d.ParentRackNumber) - delete(rawMsg, key) - case "parentSlotNumber": - err = unpopulate(val, "ParentSlotNumber", &d.ParentSlotNumber) - delete(rawMsg, key) - case "profilingConfidence": - err = unpopulate(val, "ProfilingConfidence", &d.ProfilingConfidence) - delete(rawMsg, key) - case "programmingState": - err = unpopulate(val, "ProgrammingState", &d.ProgrammingState) - delete(rawMsg, key) - case "purdueLevel": - err = unpopulate(val, "PurdueLevel", &d.PurdueLevel) - delete(rawMsg, key) - case "riskScore": - err = unpopulate(val, "RiskScore", &d.RiskScore) - delete(rawMsg, key) - case "schemaVersion": - err = unpopulate(val, "SchemaVersion", &d.SchemaVersion) - delete(rawMsg, key) - case "sensor": - err = unpopulate(val, "Sensor", &d.Sensor) - delete(rawMsg, key) - case "slots": - err = unpopulate(val, "Slots", &d.Slots) - 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 Nic. -func (n Nic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "ipv4Address", n.IPv4Address) - populate(objectMap, "ipv6Address", n.IPv6Address) - populateTimeRFC3339(objectMap, "lastSeen", n.LastSeen) - populate(objectMap, "macAddress", n.MacAddress) - populate(objectMap, "macCertainty", n.MacCertainty) - populate(objectMap, "networkAdapterVendor", n.NetworkAdapterVendor) - populate(objectMap, "vlans", n.Vlans) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Nic. -func (n *Nic) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "ipv4Address": - err = unpopulate(val, "IPv4Address", &n.IPv4Address) - delete(rawMsg, key) - case "ipv6Address": - err = unpopulate(val, "IPv6Address", &n.IPv6Address) - delete(rawMsg, key) - case "lastSeen": - err = unpopulateTimeRFC3339(val, "LastSeen", &n.LastSeen) - delete(rawMsg, key) - case "macAddress": - err = unpopulate(val, "MacAddress", &n.MacAddress) - delete(rawMsg, key) - case "macCertainty": - err = unpopulate(val, "MacCertainty", &n.MacCertainty) - delete(rawMsg, key) - case "networkAdapterVendor": - err = unpopulate(val, "NetworkAdapterVendor", &n.NetworkAdapterVendor) - delete(rawMsg, key) - case "vlans": - err = unpopulate(val, "Vlans", &n.Vlans) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SiteProperties. -func (s SiteProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "tags", s.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Slot. -func (s Slot) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", &s.AdditionalData) - populate(objectMap, "cpes", s.Cpes) - populate(objectMap, "firmwareVersion", s.FirmwareVersion) - populate(objectMap, "hardwareRevision", s.HardwareRevision) - populate(objectMap, "hardwareVendor", s.HardwareVendor) - populate(objectMap, "model", s.Model) - populate(objectMap, "moduleVersion", s.ModuleVersion) - populate(objectMap, "productCode", s.ProductCode) - populate(objectMap, "rackNumber", s.RackNumber) - populate(objectMap, "serialNumber", s.SerialNumber) - populate(objectMap, "slotNumber", s.SlotNumber) - populate(objectMap, "slotType", s.SlotType) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(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 = unpopulateTimeRFC3339(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 = unpopulateTimeRFC3339(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]interface{}, k string, v interface{}) { - 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 interface{}) error { - if data == nil { - 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/powerbiprivatelinks/armpowerbiprivatelinks/CHANGELOG.md b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/CHANGELOG.md index 3888208fb84d..1579a5c27f7b 100644 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/CHANGELOG.md +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/CHANGELOG.md @@ -1,5 +1,30 @@ # Release History +## 2.0.0 (2023-04-03) +### Breaking Changes + +- Function `NewPowerBIResourcesClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*PowerBIResourcesClient.Create` parameter(s) have been changed from `(context.Context, TenantResource, *PowerBIResourcesClientCreateOptions)` to `(context.Context, string, string, TenantResource, *PowerBIResourcesClientCreateOptions)` +- Function `*PowerBIResourcesClient.Delete` parameter(s) have been changed from `(context.Context, *PowerBIResourcesClientDeleteOptions)` to `(context.Context, string, string, *PowerBIResourcesClientDeleteOptions)` +- Function `*PowerBIResourcesClient.ListByResourceName` parameter(s) have been changed from `(context.Context, *PowerBIResourcesClientListByResourceNameOptions)` to `(context.Context, string, string, *PowerBIResourcesClientListByResourceNameOptions)` +- Function `*PowerBIResourcesClient.Update` parameter(s) have been changed from `(context.Context, TenantResource, *PowerBIResourcesClientUpdateOptions)` to `(context.Context, string, string, TenantResource, *PowerBIResourcesClientUpdateOptions)` +- Function `NewPrivateEndpointConnectionsClient` parameter(s) have been changed from `(string, string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*PrivateEndpointConnectionsClient.BeginDelete` parameter(s) have been changed from `(context.Context, *PrivateEndpointConnectionsClientBeginDeleteOptions)` to `(context.Context, string, string, string, *PrivateEndpointConnectionsClientBeginDeleteOptions)` +- Function `*PrivateEndpointConnectionsClient.Create` parameter(s) have been changed from `(context.Context, PrivateEndpointConnection, *PrivateEndpointConnectionsClientCreateOptions)` to `(context.Context, string, string, string, PrivateEndpointConnection, *PrivateEndpointConnectionsClientCreateOptions)` +- Function `*PrivateEndpointConnectionsClient.Get` parameter(s) have been changed from `(context.Context, *PrivateEndpointConnectionsClientGetOptions)` to `(context.Context, string, string, string, *PrivateEndpointConnectionsClientGetOptions)` +- Function `NewPrivateLinkResourcesClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*PrivateLinkResourcesClient.Get` parameter(s) have been changed from `(context.Context, string, *PrivateLinkResourcesClientGetOptions)` to `(context.Context, string, string, string, *PrivateLinkResourcesClientGetOptions)` +- Function `*PrivateLinkResourcesClient.NewListByResourcePager` parameter(s) have been changed from `(*PrivateLinkResourcesClientListByResourceOptions)` to `(string, string, *PrivateLinkResourcesClientListByResourceOptions)` +- Function `NewPrivateLinkServiceResourceOperationResultsClient` parameter(s) have been changed from `(string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*PrivateLinkServiceResourceOperationResultsClient.BeginGet` parameter(s) have been changed from `(context.Context, *PrivateLinkServiceResourceOperationResultsClientBeginGetOptions)` to `(context.Context, string, *PrivateLinkServiceResourceOperationResultsClientBeginGetOptions)` +- Function `NewPrivateLinkServicesClient` parameter(s) have been changed from `(string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*PrivateLinkServicesClient.ListByResourceGroup` parameter(s) have been changed from `(context.Context, *PrivateLinkServicesClientListByResourceGroupOptions)` to `(context.Context, string, *PrivateLinkServicesClientListByResourceGroupOptions)` + +### Features Added + +- New struct `ClientFactory` which is a client factory used to create any client in this module + + ## 1.0.0 (2022-05-18) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/README.md b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/README.md index 27476826548e..f8dfa9ebffe7 100644 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/README.md +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/README.md @@ -33,12 +33,12 @@ 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). -## Clients +## Client Factory -Azure Power BI Private Links modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. +Azure Power BI Private Links module consists of one or more clients. We provide a client factory which could be used to create any client in this module. ```go -client, err := armpowerbiprivatelinks.NewPrivateLinkServicesForPowerBIClient(, cred, nil) +clientFactory, err := armpowerbiprivatelinks.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). @@ -49,7 +49,15 @@ options := arm.ClientOptions { Cloud: cloud.AzureChina, }, } -client, err := armpowerbiprivatelinks.NewPrivateLinkServicesForPowerBIClient(, cred, &options) +clientFactory, err := armpowerbiprivatelinks.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.NewPowerBIResourcesClient() ``` ## Provide Feedback diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/autorest.md b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/autorest.md index dc8395611352..7c15a4ca8771 100644 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/autorest.md +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/powerbiprivatelinks/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/powerbiprivatelinks/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/powerbiprivatelinks/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/powerbiprivatelinks/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/client_factory.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/client_factory.go new file mode 100644 index 000000000000..1e5dfff03490 --- /dev/null +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/client_factory.go @@ -0,0 +1,74 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armpowerbiprivatelinks + +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 + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// 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 Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPrivateLinkServicesForPowerBIClient() *PrivateLinkServicesForPowerBIClient { + subClient, _ := NewPrivateLinkServicesForPowerBIClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPrivateLinkServiceResourceOperationResultsClient() *PrivateLinkServiceResourceOperationResultsClient { + subClient, _ := NewPrivateLinkServiceResourceOperationResultsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPrivateLinkServicesClient() *PrivateLinkServicesClient { + subClient, _ := NewPrivateLinkServicesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPowerBIResourcesClient() *PowerBIResourcesClient { + subClient, _ := NewPowerBIResourcesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { + subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_constants.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/constants.go similarity index 99% rename from sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_constants.go rename to sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/constants.go index a9444b89c81d..2f394bcf3854 100644 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_constants.go +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/constants.go @@ -5,12 +5,13 @@ // 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 armpowerbiprivatelinks const ( moduleName = "armpowerbiprivatelinks" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/go.mod b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/go.mod index 27e4fc5d7885..b18a50f961eb 100644 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/go.mod +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/go.mod @@ -1,21 +1,21 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/v2 go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect + github.com/golang-jwt/jwt/v4 v4.5.0 // indirect + github.com/google/uuid v1.3.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect - golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect - golang.org/x/text v0.3.7 // indirect + github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect + golang.org/x/crypto v0.6.0 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect ) diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/go.sum b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/go.sum index ed5b814680ee..8ba445a8c4da 100644 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/go.sum +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/go.sum @@ -1,33 +1,31 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= +github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.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/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= +golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_models.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/models.go similarity index 98% rename from sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_models.go rename to sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/models.go index 8b86aff6d876..e409c7a2730e 100644 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_models.go +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/models.go @@ -5,6 +5,7 @@ // 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 armpowerbiprivatelinks @@ -46,7 +47,7 @@ type ConnectionState struct { // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty" azure:"ro"` + Info any `json:"info,omitempty" azure:"ro"` // READ-ONLY; The additional info type. Type *string `json:"type,omitempty" azure:"ro"` @@ -144,7 +145,7 @@ type OperationListResult struct { Value []*Operation `json:"value,omitempty" azure:"ro"` } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters } @@ -236,7 +237,7 @@ type PrivateEndpointConnectionsClientGetOptions struct { // placeholder for future optional parameters } -// PrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.ListByResource +// PrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByResourcePager // method. type PrivateEndpointConnectionsClientListByResourceOptions struct { // placeholder for future optional parameters @@ -292,7 +293,7 @@ type PrivateLinkResourcesClientGetOptions struct { // placeholder for future optional parameters } -// PrivateLinkResourcesClientListByResourceOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByResource +// PrivateLinkResourcesClientListByResourceOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByResourcePager // method. type PrivateLinkResourcesClientListByResourceOptions struct { // placeholder for future optional parameters diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/models_serde.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/models_serde.go new file mode 100644 index 000000000000..1d0190089a36 --- /dev/null +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/models_serde.go @@ -0,0 +1,890 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armpowerbiprivatelinks + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AsyncOperationDetail. +func (a AsyncOperationDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endTime", a.EndTime) + populate(objectMap, "error", a.Error) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "startTime", a.StartTime) + populate(objectMap, "status", a.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AsyncOperationDetail. +func (a *AsyncOperationDetail) UnmarshalJSON(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 "endTime": + err = unpopulate(val, "EndTime", &a.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &a.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "startTime": + err = unpopulate(val, "StartTime", &a.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + 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 ConnectionState. +func (c ConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionsRequired", c.ActionsRequired) + populate(objectMap, "description", c.Description) + populate(objectMap, "status", c.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionState. +func (c *ConnectionState) UnmarshalJSON(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 "actionsRequired": + err = unpopulate(val, "ActionsRequired", &c.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + 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 ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "info", &e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type 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 GroupConnectivityInformation. +func (g GroupConnectivityInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "customerVisibleFqdns", g.CustomerVisibleFqdns) + populate(objectMap, "groupId", g.GroupID) + populate(objectMap, "internalFqdn", g.InternalFqdn) + populate(objectMap, "memberName", g.MemberName) + populate(objectMap, "privateLinkServiceArmRegion", g.PrivateLinkServiceArmRegion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupConnectivityInformation. +func (g *GroupConnectivityInformation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customerVisibleFqdns": + err = unpopulate(val, "CustomerVisibleFqdns", &g.CustomerVisibleFqdns) + delete(rawMsg, key) + case "groupId": + err = unpopulate(val, "GroupID", &g.GroupID) + delete(rawMsg, key) + case "internalFqdn": + err = unpopulate(val, "InternalFqdn", &g.InternalFqdn) + delete(rawMsg, key) + case "memberName": + err = unpopulate(val, "MemberName", &g.MemberName) + delete(rawMsg, key) + case "privateLinkServiceArmRegion": + err = unpopulate(val, "PrivateLinkServiceArmRegion", &g.PrivateLinkServiceArmRegion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, 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 PrivateEndpoint. +func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. +func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. +func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkConnectionDetail. +func (p PrivateLinkConnectionDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "id", p.ID) + populate(objectMap, "linkIdentifier", p.LinkIdentifier) + populate(objectMap, "memberName", p.MemberName) + populate(objectMap, "privateIpAddress", p.PrivateIPAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkConnectionDetail. +func (p *PrivateLinkConnectionDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "linkIdentifier": + err = unpopulate(val, "LinkIdentifier", &p.LinkIdentifier) + delete(rawMsg, key) + case "memberName": + err = unpopulate(val, "MemberName", &p.MemberName) + delete(rawMsg, key) + case "privateIpAddress": + err = unpopulate(val, "PrivateIPAddress", &p.PrivateIPAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "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 PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourcesListResult. +func (p PrivateLinkResourcesListResult) 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 PrivateLinkResourcesListResult. +func (p *PrivateLinkResourcesListResult) UnmarshalJSON(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 PrivateLinkServiceConnection. +func (p PrivateLinkServiceConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupIds", p.GroupIDs) + populate(objectMap, "name", p.Name) + populate(objectMap, "requestMessage", p.RequestMessage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnection. +func (p *PrivateLinkServiceConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "requestMessage": + err = unpopulate(val, "RequestMessage", &p.RequestMessage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceProxy. +func (p PrivateLinkServiceProxy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupConnectivityInformation", p.GroupConnectivityInformation) + populate(objectMap, "id", p.ID) + populate(objectMap, "remotePrivateEndpointConnection", p.RemotePrivateEndpointConnection) + populate(objectMap, "remotePrivateLinkServiceConnectionState", p.RemotePrivateLinkServiceConnectionState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceProxy. +func (p *PrivateLinkServiceProxy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupConnectivityInformation": + err = unpopulate(val, "GroupConnectivityInformation", &p.GroupConnectivityInformation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "remotePrivateEndpointConnection": + err = unpopulate(val, "RemotePrivateEndpointConnection", &p.RemotePrivateEndpointConnection) + delete(rawMsg, key) + case "remotePrivateLinkServiceConnectionState": + err = unpopulate(val, "RemotePrivateLinkServiceConnectionState", &p.RemotePrivateLinkServiceConnectionState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RemotePrivateEndpointConnection. +func (r RemotePrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RemotePrivateEndpointConnection. +func (r *RemotePrivateEndpointConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + } + if err != nil { + 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) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(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 = unpopulateTimeRFC3339(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 = unpopulateTimeRFC3339(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 TenantProperties. +func (t TenantProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "privateEndpointConnections", t.PrivateEndpointConnections) + populate(objectMap, "tenantId", t.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TenantProperties. +func (t *TenantProperties) UnmarshalJSON(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 "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &t.PrivateEndpointConnections) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &t.TenantID) + 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 TenantResource. +func (t TenantResource) 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) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TenantResource. +func (t *TenantResource) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +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 { + 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/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_operations_client.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/operations_client.go similarity index 77% rename from sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_operations_client.go rename to sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/operations_client.go index ccbcc2451ecb..de961f33f3b4 100644 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_operations_client.go +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/operations_client.go @@ -5,6 +5,7 @@ // 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 armpowerbiprivatelinks @@ -12,8 +13,6 @@ import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -22,36 +21,27 @@ import ( // OperationsClient contains the methods for the Operations group. // Don't use this type directly, use NewOperationsClient() instead. type OperationsClient struct { - host string - pl runtime.Pipeline + 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. +// - 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) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &OperationsClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // NewListPager - Lists all of the available Power BI RP operations. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-06-01 -// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// - 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 { @@ -68,7 +58,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption if err != nil { return OperationsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return OperationsClientListResponse{}, err } @@ -83,7 +73,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption // listCreateRequest creates the List request. func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.PowerBI/operations" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/operations_client_example_test.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/operations_client_example_test.go new file mode 100644 index 000000000000..bc31126dee6f --- /dev/null +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/operations_client_example_test.go @@ -0,0 +1,163 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armpowerbiprivatelinks_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/Operations_List.json +func ExampleOperationsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpowerbiprivatelinks.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOperationsClient().NewListPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.OperationListResult = armpowerbiprivatelinks.OperationListResult{ + // Value: []*armpowerbiprivatelinks.Operation{ + // { + // Name: to.Ptr("Microsoft.PowerBI/privateLinkServicesForPowerBI/read"), + // Display: &armpowerbiprivatelinks.OperationDisplay{ + // Description: to.Ptr("Gets all resources for the tenant private link service"), + // Operation: to.Ptr("Gets all resources"), + // Provider: to.Ptr("Microsoft Power BI"), + // Resource: to.Ptr("Private link service resources"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.PowerBI/privateLinkServicesForPowerBI/operationResults/operationId/read"), + // Display: &armpowerbiprivatelinks.OperationDisplay{ + // Description: to.Ptr("Gets operation result of Private Link Service Resources for Power BI."), + // Operation: to.Ptr("Get Operation Result"), + // Provider: to.Ptr("Microsoft Power BI"), + // Resource: to.Ptr("Private link service resources"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.PowerBI/privateLinkServicesForPowerBI/azureResourceName/read"), + // Display: &armpowerbiprivatelinks.OperationDisplay{ + // Description: to.Ptr("Gets resources for the tenant private link service by name"), + // Operation: to.Ptr("Gets resource by name"), + // Provider: to.Ptr("Microsoft Power BI"), + // Resource: to.Ptr("Private link service resources"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.PowerBI/privateLinkServicesForPowerBI/azureResourceName/write"), + // Display: &armpowerbiprivatelinks.OperationDisplay{ + // Description: to.Ptr("Creates or updates resource for the tenant private link service"), + // Operation: to.Ptr("Creates or updates private link service"), + // Provider: to.Ptr("Microsoft Power BI"), + // Resource: to.Ptr("Private link service resources"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.PowerBI/privateLinkServicesForPowerBI/azureResourceName/delete"), + // Display: &armpowerbiprivatelinks.OperationDisplay{ + // Description: to.Ptr("Deletes resource for the tenant private link service"), + // Operation: to.Ptr("Deletes private link service"), + // Provider: to.Ptr("Microsoft Power BI"), + // Resource: to.Ptr("Private link service resources"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.PowerBI/privateLinkServicesForPowerBI/azureResourceName/privateLinkResources/read"), + // Display: &armpowerbiprivatelinks.OperationDisplay{ + // Description: to.Ptr("Gets private link resources in a Azure resource"), + // Operation: to.Ptr("Gets private link resources by name"), + // Provider: to.Ptr("Microsoft Power BI"), + // Resource: to.Ptr("Private link service resources"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.PowerBI/privateLinkServicesForPowerBI/azureResourceName/privateEndpointConnectionProxies/privateEndpointName.privateEndpointGuid/read"), + // Display: &armpowerbiprivatelinks.OperationDisplay{ + // Description: to.Ptr("Gets private endpoint connection proxy for the tenant"), + // Operation: to.Ptr("Gets private endpoint connection proxy"), + // Provider: to.Ptr("Microsoft Power BI"), + // Resource: to.Ptr("Private link service resources"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.PowerBI/privateLinkServicesForPowerBI/azureResourceName/privateEndpointConnectionProxies/privateEndpointName.privateEndpointGuid/write"), + // Display: &armpowerbiprivatelinks.OperationDisplay{ + // Description: to.Ptr("Creates or updates private endpoint connection proxy for the tenant"), + // Operation: to.Ptr("Creates or updates private endpoint connection proxy"), + // Provider: to.Ptr("Microsoft Power BI"), + // Resource: to.Ptr("Private link service resources"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.PowerBI/privateLinkServicesForPowerBI/azureResourceName/privateEndpointConnectionProxies/privateEndpointName.privateEndpointGuid/delete"), + // Display: &armpowerbiprivatelinks.OperationDisplay{ + // Description: to.Ptr("Deletes private endpoint connection proxy for the tenant"), + // Operation: to.Ptr("Deletes private endpoint connection proxy"), + // Provider: to.Ptr("Microsoft Power BI"), + // Resource: to.Ptr("Private link service resources"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.PowerBI/privateLinkServicesForPowerBI/azureResourceName/privateEndpointConnectionProxies/privateEndpointName.privateEndpointGuid/validate/action"), + // Display: &armpowerbiprivatelinks.OperationDisplay{ + // Description: to.Ptr("Validates a private endpoint connection proxy before create or update"), + // Operation: to.Ptr("Validates a private endpoint connection proxy"), + // Provider: to.Ptr("Microsoft Power BI"), + // Resource: to.Ptr("Private link service resources"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.PowerBI/privateLinkServicesForPowerBI/azureResourceName/privateEndpointConnections/privateEndpointName.privateEndpointGuid/read"), + // Display: &armpowerbiprivatelinks.OperationDisplay{ + // Description: to.Ptr("Gets private endpoint connection for the tenant"), + // Operation: to.Ptr("Gets private endpoint connection"), + // Provider: to.Ptr("Microsoft Power BI"), + // Resource: to.Ptr("Private link service resources"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.PowerBI/privateLinkServicesForPowerBI/azureResourceName/privateEndpointConnections/privateEndpointName.privateEndpointGuid/write"), + // Display: &armpowerbiprivatelinks.OperationDisplay{ + // Description: to.Ptr("Creates or updates private endpoint connection for the tenant"), + // Operation: to.Ptr("Creates or updates private endpoint connection"), + // Provider: to.Ptr("Microsoft Power BI"), + // Resource: to.Ptr("Private link service resources"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.PowerBI/privateLinkServicesForPowerBI/azureResourceName/privateEndpointConnections/privateEndpointName.privateEndpointGuid/delete"), + // Display: &armpowerbiprivatelinks.OperationDisplay{ + // Description: to.Ptr("Deletes private endpoint connection for the tenant"), + // Operation: to.Ptr("Deletes private endpoint connection"), + // Provider: to.Ptr("Microsoft Power BI"), + // Resource: to.Ptr("Private link service resources"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_powerbiresources_client.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/powerbiresources_client.go similarity index 63% rename from sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_powerbiresources_client.go rename to sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/powerbiresources_client.go index a3c25e4fa651..5f39262602fc 100644 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_powerbiresources_client.go +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/powerbiresources_client.go @@ -5,6 +5,7 @@ // 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 armpowerbiprivatelinks @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,52 +24,40 @@ import ( // PowerBIResourcesClient contains the methods for the PowerBIResources group. // Don't use this type directly, use NewPowerBIResourcesClient() instead. type PowerBIResourcesClient struct { - host string - subscriptionID string - resourceGroupName string - azureResourceName string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewPowerBIResourcesClient creates a new instance of PowerBIResourcesClient with the specified values. -// subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). -// resourceGroupName - The name of the resource group. -// azureResourceName - The name of the Azure resource. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewPowerBIResourcesClient(subscriptionID string, resourceGroupName string, azureResourceName string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PowerBIResourcesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPowerBIResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PowerBIResourcesClient, error) { + cl, err := arm.NewClient(moduleName+".PowerBIResourcesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &PowerBIResourcesClient{ - subscriptionID: subscriptionID, - resourceGroupName: resourceGroupName, - azureResourceName: azureResourceName, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // Create - Creates or updates a Private Link Service Resource for Power BI. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-06-01 -// body - Tenant resource to be created or updated. -// options - PowerBIResourcesClientCreateOptions contains the optional parameters for the PowerBIResourcesClient.Create method. -func (client *PowerBIResourcesClient) Create(ctx context.Context, body TenantResource, options *PowerBIResourcesClientCreateOptions) (PowerBIResourcesClientCreateResponse, error) { - req, err := client.createCreateRequest(ctx, body, options) +// - resourceGroupName - The name of the resource group. +// - azureResourceName - The name of the Azure resource. +// - body - Tenant resource to be created or updated. +// - options - PowerBIResourcesClientCreateOptions contains the optional parameters for the PowerBIResourcesClient.Create method. +func (client *PowerBIResourcesClient) Create(ctx context.Context, resourceGroupName string, azureResourceName string, body TenantResource, options *PowerBIResourcesClientCreateOptions) (PowerBIResourcesClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, azureResourceName, body, options) if err != nil { return PowerBIResourcesClientCreateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PowerBIResourcesClientCreateResponse{}, err } @@ -81,21 +68,21 @@ func (client *PowerBIResourcesClient) Create(ctx context.Context, body TenantRes } // createCreateRequest creates the Create request. -func (client *PowerBIResourcesClient) createCreateRequest(ctx context.Context, body TenantResource, options *PowerBIResourcesClientCreateOptions) (*policy.Request, error) { +func (client *PowerBIResourcesClient) createCreateRequest(ctx context.Context, resourceGroupName string, azureResourceName string, body TenantResource, options *PowerBIResourcesClientCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) - if client.azureResourceName == "" { - return nil, errors.New("parameter client.azureResourceName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if azureResourceName == "" { + return nil, errors.New("parameter azureResourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{azureResourceName}", url.PathEscape(client.azureResourceName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + urlPath = strings.ReplaceAll(urlPath, "{azureResourceName}", url.PathEscape(azureResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -120,14 +107,17 @@ func (client *PowerBIResourcesClient) createHandleResponse(resp *http.Response) // Delete - Deletes a Private Link Service Resource for Power BI. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-06-01 -// options - PowerBIResourcesClientDeleteOptions contains the optional parameters for the PowerBIResourcesClient.Delete method. -func (client *PowerBIResourcesClient) Delete(ctx context.Context, options *PowerBIResourcesClientDeleteOptions) (PowerBIResourcesClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, options) +// - resourceGroupName - The name of the resource group. +// - azureResourceName - The name of the Azure resource. +// - options - PowerBIResourcesClientDeleteOptions contains the optional parameters for the PowerBIResourcesClient.Delete method. +func (client *PowerBIResourcesClient) Delete(ctx context.Context, resourceGroupName string, azureResourceName string, options *PowerBIResourcesClientDeleteOptions) (PowerBIResourcesClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, azureResourceName, options) if err != nil { return PowerBIResourcesClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PowerBIResourcesClientDeleteResponse{}, err } @@ -138,21 +128,21 @@ func (client *PowerBIResourcesClient) Delete(ctx context.Context, options *Power } // deleteCreateRequest creates the Delete request. -func (client *PowerBIResourcesClient) deleteCreateRequest(ctx context.Context, options *PowerBIResourcesClientDeleteOptions) (*policy.Request, error) { +func (client *PowerBIResourcesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, azureResourceName string, options *PowerBIResourcesClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) - if client.azureResourceName == "" { - return nil, errors.New("parameter client.azureResourceName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if azureResourceName == "" { + return nil, errors.New("parameter azureResourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{azureResourceName}", url.PathEscape(client.azureResourceName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + urlPath = strings.ReplaceAll(urlPath, "{azureResourceName}", url.PathEscape(azureResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -165,15 +155,18 @@ func (client *PowerBIResourcesClient) deleteCreateRequest(ctx context.Context, o // ListByResourceName - Gets all the private link resources for the given Azure resource. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-06-01 -// options - PowerBIResourcesClientListByResourceNameOptions contains the optional parameters for the PowerBIResourcesClient.ListByResourceName -// method. -func (client *PowerBIResourcesClient) ListByResourceName(ctx context.Context, options *PowerBIResourcesClientListByResourceNameOptions) (PowerBIResourcesClientListByResourceNameResponse, error) { - req, err := client.listByResourceNameCreateRequest(ctx, options) +// - resourceGroupName - The name of the resource group. +// - azureResourceName - The name of the Azure resource. +// - options - PowerBIResourcesClientListByResourceNameOptions contains the optional parameters for the PowerBIResourcesClient.ListByResourceName +// method. +func (client *PowerBIResourcesClient) ListByResourceName(ctx context.Context, resourceGroupName string, azureResourceName string, options *PowerBIResourcesClientListByResourceNameOptions) (PowerBIResourcesClientListByResourceNameResponse, error) { + req, err := client.listByResourceNameCreateRequest(ctx, resourceGroupName, azureResourceName, options) if err != nil { return PowerBIResourcesClientListByResourceNameResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PowerBIResourcesClientListByResourceNameResponse{}, err } @@ -184,21 +177,21 @@ func (client *PowerBIResourcesClient) ListByResourceName(ctx context.Context, op } // listByResourceNameCreateRequest creates the ListByResourceName request. -func (client *PowerBIResourcesClient) listByResourceNameCreateRequest(ctx context.Context, options *PowerBIResourcesClientListByResourceNameOptions) (*policy.Request, error) { +func (client *PowerBIResourcesClient) listByResourceNameCreateRequest(ctx context.Context, resourceGroupName string, azureResourceName string, options *PowerBIResourcesClientListByResourceNameOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) - if client.azureResourceName == "" { - return nil, errors.New("parameter client.azureResourceName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if azureResourceName == "" { + return nil, errors.New("parameter azureResourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{azureResourceName}", url.PathEscape(client.azureResourceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + urlPath = strings.ReplaceAll(urlPath, "{azureResourceName}", url.PathEscape(azureResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -220,15 +213,18 @@ func (client *PowerBIResourcesClient) listByResourceNameHandleResponse(resp *htt // Update - Creates or updates a Private Link Service Resource for Power BI. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-06-01 -// body - Tenant resource to be created or updated. -// options - PowerBIResourcesClientUpdateOptions contains the optional parameters for the PowerBIResourcesClient.Update method. -func (client *PowerBIResourcesClient) Update(ctx context.Context, body TenantResource, options *PowerBIResourcesClientUpdateOptions) (PowerBIResourcesClientUpdateResponse, error) { - req, err := client.updateCreateRequest(ctx, body, options) +// - resourceGroupName - The name of the resource group. +// - azureResourceName - The name of the Azure resource. +// - body - Tenant resource to be created or updated. +// - options - PowerBIResourcesClientUpdateOptions contains the optional parameters for the PowerBIResourcesClient.Update method. +func (client *PowerBIResourcesClient) Update(ctx context.Context, resourceGroupName string, azureResourceName string, body TenantResource, options *PowerBIResourcesClientUpdateOptions) (PowerBIResourcesClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, azureResourceName, body, options) if err != nil { return PowerBIResourcesClientUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PowerBIResourcesClientUpdateResponse{}, err } @@ -239,21 +235,21 @@ func (client *PowerBIResourcesClient) Update(ctx context.Context, body TenantRes } // updateCreateRequest creates the Update request. -func (client *PowerBIResourcesClient) updateCreateRequest(ctx context.Context, body TenantResource, options *PowerBIResourcesClientUpdateOptions) (*policy.Request, error) { +func (client *PowerBIResourcesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, azureResourceName string, body TenantResource, options *PowerBIResourcesClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) - if client.azureResourceName == "" { - return nil, errors.New("parameter client.azureResourceName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if azureResourceName == "" { + return nil, errors.New("parameter azureResourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{azureResourceName}", url.PathEscape(client.azureResourceName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + urlPath = strings.ReplaceAll(urlPath, "{azureResourceName}", url.PathEscape(azureResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/powerbiresources_client_example_test.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/powerbiresources_client_example_test.go new file mode 100644 index 000000000000..d2847841007e --- /dev/null +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/powerbiresources_client_example_test.go @@ -0,0 +1,164 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpowerbiprivatelinks_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/powerbiprivatelinks/armpowerbiprivatelinks/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PowerBIResources_ListByResourceName.json +func ExamplePowerBIResourcesClient_ListByResourceName() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpowerbiprivatelinks.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPowerBIResourcesClient().ListByResourceName(ctx, "resourceGroup", "azureResourceName", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.TenantResourceArray = []*armpowerbiprivatelinks.TenantResource{ + // { + // Name: to.Ptr("conection 1"), + // Location: to.Ptr("west us"), + // Properties: &armpowerbiprivatelinks.TenantProperties{ + // PrivateEndpointConnections: []*armpowerbiprivatelinks.PrivateEndpointConnection{ + // { + // Name: to.Ptr("myPrivateEndpointConnection"), + // Type: to.Ptr("string"), + // ID: to.Ptr("/subscriptions/a0020869-4d28-422a-89f4-c2413130d73c/resourceGroups/resourceGroup/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/azureResourceName/privateEndpointConnections/myPrivateEndpointConnection.58ffb8de-89ad-41eb-9f8f-de0a7db9d721"), + // Properties: &armpowerbiprivatelinks.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armpowerbiprivatelinks.PrivateEndpoint{ + // ID: to.Ptr("/subscriptions/a0020869-4d28-422a-89f4-c2413130d73c/resourceGroups/resourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), + // }, + // PrivateLinkServiceConnectionState: &armpowerbiprivatelinks.ConnectionState{ + // Description: to.Ptr("My private endpoint connection"), + // ActionsRequired: to.Ptr("None"), + // Status: to.Ptr(armpowerbiprivatelinks.PersistedConnectionStatusPending), + // }, + // }, + // }}, + // TenantID: to.Ptr("ac2bc297-8a3e-46f3-972d-87c2b4ae6e2f"), + // }, + // Tags: map[string]*string{ + // "tag1": to.Ptr("value1"), + // "tag2": to.Ptr("value2"), + // }, + // }} +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PowerBIResources_Create.json +func ExamplePowerBIResourcesClient_Create() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpowerbiprivatelinks.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPowerBIResourcesClient().Create(ctx, "resourceGroup", "azureResourceName", armpowerbiprivatelinks.TenantResource{ + Location: to.Ptr("global"), + Properties: &armpowerbiprivatelinks.TenantProperties{ + TenantID: to.Ptr("ac2bc297-8a3e-46f3-972d-87c2b4ae6e2f"), + }, + Tags: map[string]*string{ + "tag1": to.Ptr("value1"), + "tag2": to.Ptr("value2"), + }, + }, &armpowerbiprivatelinks.PowerBIResourcesClientCreateOptions{ClientTenantID: to.Ptr("ac2bc297-8a3e-46f3-972d-87c2b4ae6e2f")}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.TenantResource = armpowerbiprivatelinks.TenantResource{ + // Name: to.Ptr("myPrivateLinkServiceResource"), + // Location: to.Ptr("global"), + // Properties: &armpowerbiprivatelinks.TenantProperties{ + // TenantID: to.Ptr("ac2bc297-8a3e-46f3-972d-87c2b4ae6e2f"), + // }, + // Tags: map[string]*string{ + // "tag1": to.Ptr("value1"), + // "tag2": to.Ptr("value2"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PowerBIResources_Update.json +func ExamplePowerBIResourcesClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpowerbiprivatelinks.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPowerBIResourcesClient().Update(ctx, "resourceGroup", "azureResourceName", armpowerbiprivatelinks.TenantResource{ + Location: to.Ptr("global"), + Properties: &armpowerbiprivatelinks.TenantProperties{ + TenantID: to.Ptr("ac2bc297-8a3e-46f3-972d-87c2b4ae6e2f"), + }, + Tags: map[string]*string{ + "tag1": to.Ptr("value1"), + "tag2": to.Ptr("value2"), + }, + }, &armpowerbiprivatelinks.PowerBIResourcesClientUpdateOptions{ClientTenantID: to.Ptr("ac2bc297-8a3e-46f3-972d-87c2b4ae6e2f")}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.TenantResource = armpowerbiprivatelinks.TenantResource{ + // Name: to.Ptr("myPrivateLinkServiceResource"), + // Location: to.Ptr("global"), + // Properties: &armpowerbiprivatelinks.TenantProperties{ + // TenantID: to.Ptr("ac2bc297-8a3e-46f3-972d-87c2b4ae6e2f"), + // }, + // Tags: map[string]*string{ + // "tag1": to.Ptr("value1"), + // "tag2": to.Ptr("value2"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PowerBIResources_Delete.json +func ExamplePowerBIResourcesClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpowerbiprivatelinks.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewPowerBIResourcesClient().Delete(ctx, "resourceGroup", "azureResourceName", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privateendpointconnections_client.go similarity index 64% rename from sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_privateendpointconnections_client.go rename to sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privateendpointconnections_client.go index 7db3064963dd..73f6d1c8dfe9 100644 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privateendpointconnections_client.go @@ -5,6 +5,7 @@ // 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 armpowerbiprivatelinks @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,56 +24,42 @@ import ( // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. // Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. type PrivateEndpointConnectionsClient struct { - host string - subscriptionID string - resourceGroupName string - azureResourceName string - privateEndpointName string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -// subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). -// resourceGroupName - The name of the resource group. -// azureResourceName - The name of the Azure resource. -// privateEndpointName - The name of the private endpoint. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewPrivateEndpointConnectionsClient(subscriptionID string, resourceGroupName string, azureResourceName string, privateEndpointName string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { + cl, err := arm.NewClient(moduleName+".PrivateEndpointConnectionsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &PrivateEndpointConnectionsClient{ - subscriptionID: subscriptionID, - resourceGroupName: resourceGroupName, - azureResourceName: azureResourceName, - privateEndpointName: privateEndpointName, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // Create - Updates the status of Private Endpoint Connection object. Used to approve or reject a connection. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-06-01 -// privateEndpointConnection - Private endpoint connection object to update. -// options - PrivateEndpointConnectionsClientCreateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Create -// method. -func (client *PrivateEndpointConnectionsClient) Create(ctx context.Context, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientCreateOptions) (PrivateEndpointConnectionsClientCreateResponse, error) { - req, err := client.createCreateRequest(ctx, privateEndpointConnection, options) +// - resourceGroupName - The name of the resource group. +// - azureResourceName - The name of the Azure resource. +// - privateEndpointName - The name of the private endpoint. +// - privateEndpointConnection - Private endpoint connection object to update. +// - options - PrivateEndpointConnectionsClientCreateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Create +// method. +func (client *PrivateEndpointConnectionsClient) Create(ctx context.Context, resourceGroupName string, azureResourceName string, privateEndpointName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientCreateOptions) (PrivateEndpointConnectionsClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, azureResourceName, privateEndpointName, privateEndpointConnection, options) if err != nil { return PrivateEndpointConnectionsClientCreateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientCreateResponse{}, err } @@ -85,25 +70,25 @@ func (client *PrivateEndpointConnectionsClient) Create(ctx context.Context, priv } // createCreateRequest creates the Create request. -func (client *PrivateEndpointConnectionsClient) createCreateRequest(ctx context.Context, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientCreateOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) createCreateRequest(ctx context.Context, resourceGroupName string, azureResourceName string, privateEndpointName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateEndpointConnections/{privateEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) - if client.azureResourceName == "" { - return nil, errors.New("parameter client.azureResourceName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if azureResourceName == "" { + return nil, errors.New("parameter azureResourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{azureResourceName}", url.PathEscape(client.azureResourceName)) - if client.privateEndpointName == "" { - return nil, errors.New("parameter client.privateEndpointName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{azureResourceName}", url.PathEscape(azureResourceName)) + if privateEndpointName == "" { + return nil, errors.New("parameter privateEndpointName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{privateEndpointName}", url.PathEscape(client.privateEndpointName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointName}", url.PathEscape(privateEndpointName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -125,32 +110,37 @@ func (client *PrivateEndpointConnectionsClient) createHandleResponse(resp *http. // BeginDelete - Deletes a private endpoint connection for Power BI by private endpoint name. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-06-01 -// options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete -// method. -func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { +// - resourceGroupName - The name of the resource group. +// - azureResourceName - The name of the Azure resource. +// - privateEndpointName - The name of the private endpoint. +// - options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, azureResourceName string, privateEndpointName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, options) + resp, err := client.deleteOperation(ctx, resourceGroupName, azureResourceName, privateEndpointName, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - Deletes a private endpoint connection for Power BI by private endpoint name. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-06-01 -func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, options) +func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, azureResourceName string, privateEndpointName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, azureResourceName, privateEndpointName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -161,25 +151,25 @@ func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Cont } // deleteCreateRequest creates the Delete request. -func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, azureResourceName string, privateEndpointName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateEndpointConnections/{privateEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) - if client.azureResourceName == "" { - return nil, errors.New("parameter client.azureResourceName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if azureResourceName == "" { + return nil, errors.New("parameter azureResourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{azureResourceName}", url.PathEscape(client.azureResourceName)) - if client.privateEndpointName == "" { - return nil, errors.New("parameter client.privateEndpointName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{azureResourceName}", url.PathEscape(azureResourceName)) + if privateEndpointName == "" { + return nil, errors.New("parameter privateEndpointName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{privateEndpointName}", url.PathEscape(client.privateEndpointName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointName}", url.PathEscape(privateEndpointName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -192,15 +182,19 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Get a specific private endpoint connection for Power BI by private endpoint name. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-06-01 -// options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. -func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, options) +// - resourceGroupName - The name of the resource group. +// - azureResourceName - The name of the Azure resource. +// - privateEndpointName - The name of the private endpoint. +// - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, azureResourceName string, privateEndpointName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, azureResourceName, privateEndpointName, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } @@ -211,25 +205,25 @@ func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, options } // getCreateRequest creates the Get request. -func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, options *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, azureResourceName string, privateEndpointName string, options *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateEndpointConnections/{privateEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) - if client.azureResourceName == "" { - return nil, errors.New("parameter client.azureResourceName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if azureResourceName == "" { + return nil, errors.New("parameter azureResourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{azureResourceName}", url.PathEscape(client.azureResourceName)) - if client.privateEndpointName == "" { - return nil, errors.New("parameter client.privateEndpointName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{azureResourceName}", url.PathEscape(azureResourceName)) + if privateEndpointName == "" { + return nil, errors.New("parameter privateEndpointName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{privateEndpointName}", url.PathEscape(client.privateEndpointName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointName}", url.PathEscape(privateEndpointName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -250,12 +244,12 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res } // NewListByResourcePager - Gets private endpoint connection for Power BI. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-06-01 -// resourceGroupName - The name of the resource group within the user's subscription. -// azureResourceName - The name of the powerbi resource. -// options - PrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.ListByResource -// method. +// - resourceGroupName - The name of the resource group within the user's subscription. +// - azureResourceName - The name of the powerbi resource. +// - options - PrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByResourcePager +// method. func (client *PrivateEndpointConnectionsClient) NewListByResourcePager(resourceGroupName string, azureResourceName string, options *PrivateEndpointConnectionsClientListByResourceOptions) *runtime.Pager[PrivateEndpointConnectionsClientListByResourceResponse] { return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListByResourceResponse]{ More: func(page PrivateEndpointConnectionsClientListByResourceResponse) bool { @@ -272,7 +266,7 @@ func (client *PrivateEndpointConnectionsClient) NewListByResourcePager(resourceG if err != nil { return PrivateEndpointConnectionsClientListByResourceResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientListByResourceResponse{}, err } @@ -299,7 +293,7 @@ func (client *PrivateEndpointConnectionsClient) listByResourceCreateRequest(ctx return nil, errors.New("parameter azureResourceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{azureResourceName}", url.PathEscape(azureResourceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privateendpointconnections_client_example_test.go new file mode 100644 index 000000000000..51f92192f122 --- /dev/null +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privateendpointconnections_client_example_test.go @@ -0,0 +1,164 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpowerbiprivatelinks_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/powerbiprivatelinks/armpowerbiprivatelinks/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PrivateEndpointConnections_ListByResource.json +func ExamplePrivateEndpointConnectionsClient_NewListByResourcePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpowerbiprivatelinks.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListByResourcePager("resourceGroup", "azureResourceName", 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.PrivateEndpointConnectionListResult = armpowerbiprivatelinks.PrivateEndpointConnectionListResult{ + // Value: []*armpowerbiprivatelinks.PrivateEndpointConnection{ + // { + // Name: to.Ptr("myPrivateEndpointName.58ffb8de-89ad-41eb-9f8f-de0a7db9d721"), + // Type: to.Ptr("Microsoft.PowerBI/privateLinkServicesForPowerBI/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/a0020869-4d28-422a-89f4-c2413130d73c/resourceGroups/resourceGroup/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/azureResourceName/privateEndpointConnections/myPrivateEndpointName.58ffb8de-89ad-41eb-9f8f-de0a7db9d721"), + // Properties: &armpowerbiprivatelinks.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armpowerbiprivatelinks.PrivateEndpoint{ + // ID: to.Ptr("/subscriptions/a0020869-4d28-422a-89f4-c2413130d73c/resourceGroups/resourceGroup/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/azureResourceName/privateEndpointConnections/myPrivateEndpointName"), + // }, + // PrivateLinkServiceConnectionState: &armpowerbiprivatelinks.ConnectionState{ + // Description: to.Ptr("Test"), + // ActionsRequired: to.Ptr("None"), + // Status: to.Ptr(armpowerbiprivatelinks.PersistedConnectionStatusPending), + // }, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PrivateEndpointConnections_Get.json +func ExamplePrivateEndpointConnectionsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpowerbiprivatelinks.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "resourceGroup", "azureResourceName", "myPrivateEndpointName", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PrivateEndpointConnection = armpowerbiprivatelinks.PrivateEndpointConnection{ + // Name: to.Ptr("myPrivateEndpointName.58ffb8de-89ad-41eb-9f8f-de0a7db9d721"), + // Type: to.Ptr("Microsoft.PowerBI/privateLinkServicesForPowerBI/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/a0020869-4d28-422a-89f4-c2413130d73c/resourceGroups/resourceGroup/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/azureResourceName/privateEndpointConnections/myPrivateEndpointName.58ffb8de-89ad-41eb-9f8f-de0a7db9d721"), + // Properties: &armpowerbiprivatelinks.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armpowerbiprivatelinks.PrivateEndpoint{ + // ID: to.Ptr("/subscriptions/a0020869-4d28-422a-89f4-c2413130d73c/resourceGroups/resourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpointName"), + // }, + // PrivateLinkServiceConnectionState: &armpowerbiprivatelinks.ConnectionState{ + // Description: to.Ptr("please approve"), + // ActionsRequired: to.Ptr("None"), + // Status: to.Ptr(armpowerbiprivatelinks.PersistedConnectionStatusPending), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PrivateEndpointConnections_Create.json +func ExamplePrivateEndpointConnectionsClient_Create() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpowerbiprivatelinks.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrivateEndpointConnectionsClient().Create(ctx, "resourceGroup", "azureResourceName", "myPrivateEndpointName", armpowerbiprivatelinks.PrivateEndpointConnection{ + Properties: &armpowerbiprivatelinks.PrivateEndpointConnectionProperties{ + PrivateEndpoint: &armpowerbiprivatelinks.PrivateEndpoint{ + ID: to.Ptr("/subscriptions/a0020869-4d28-422a-89f4-c2413130d73c/resourceGroups/resourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpointName"), + }, + PrivateLinkServiceConnectionState: &armpowerbiprivatelinks.ConnectionState{ + Description: to.Ptr(""), + ActionsRequired: to.Ptr("None"), + Status: to.Ptr(armpowerbiprivatelinks.PersistedConnectionStatus("Approved ")), + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PrivateEndpointConnection = armpowerbiprivatelinks.PrivateEndpointConnection{ + // Name: to.Ptr("myPrivateEndpointName.58ffb8de-89ad-41eb-9f8f-de0a7db9d721"), + // Type: to.Ptr("Microsoft.PowerBI/privateLinkServicesForPowerBI/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/a0020869-4d28-422a-89f4-c2413130d73c/resourceGroups/resourceGroup/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/azureResourceName/privateEndpointConnections/myPrivateEndpointName.58ffb8de-89ad-41eb-9f8f-de0a7db9d721"), + // Properties: &armpowerbiprivatelinks.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armpowerbiprivatelinks.PrivateEndpoint{ + // ID: to.Ptr("/subscriptions/a0020869-4d28-422a-89f4-c2413130d73c/resourceGroups/resourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpointName"), + // }, + // PrivateLinkServiceConnectionState: &armpowerbiprivatelinks.ConnectionState{ + // Description: to.Ptr(""), + // ActionsRequired: to.Ptr("None"), + // Status: to.Ptr(armpowerbiprivatelinks.PersistedConnectionStatus("Approved ")), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PrivateEndpointConnections_Delete.json +func ExamplePrivateEndpointConnectionsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpowerbiprivatelinks.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "resourceGroup", "azureResourceName", "myPrivateEndpointName", 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/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkresources_client.go similarity index 64% rename from sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_privatelinkresources_client.go rename to sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkresources_client.go index 6a68c1dc5874..80b9496d1a80 100644 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkresources_client.go @@ -5,6 +5,7 @@ // 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 armpowerbiprivatelinks @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,53 +24,41 @@ import ( // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. // Don't use this type directly, use NewPrivateLinkResourcesClient() instead. type PrivateLinkResourcesClient struct { - host string - subscriptionID string - resourceGroupName string - azureResourceName string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -// subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). -// resourceGroupName - The name of the resource group. -// azureResourceName - The name of the Azure resource. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewPrivateLinkResourcesClient(subscriptionID string, resourceGroupName string, azureResourceName string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { + cl, err := arm.NewClient(moduleName+".PrivateLinkResourcesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &PrivateLinkResourcesClient{ - subscriptionID: subscriptionID, - resourceGroupName: resourceGroupName, - azureResourceName: azureResourceName, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // Get - Get properties of a private link resource. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-06-01 -// privateLinkResourceName - The name of private link resource. -// options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get -// method. -func (client *PrivateLinkResourcesClient) Get(ctx context.Context, privateLinkResourceName string, options *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, privateLinkResourceName, options) +// - resourceGroupName - The name of the resource group. +// - azureResourceName - The name of the Azure resource. +// - privateLinkResourceName - The name of private link resource. +// - options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get +// method. +func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, azureResourceName string, privateLinkResourceName string, options *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, azureResourceName, privateLinkResourceName, options) if err != nil { return PrivateLinkResourcesClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkResourcesClientGetResponse{}, err } @@ -82,25 +69,25 @@ func (client *PrivateLinkResourcesClient) Get(ctx context.Context, privateLinkRe } // getCreateRequest creates the Get request. -func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, privateLinkResourceName string, options *PrivateLinkResourcesClientGetOptions) (*policy.Request, error) { +func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, azureResourceName string, privateLinkResourceName string, options *PrivateLinkResourcesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateLinkResources/{privateLinkResourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) - if client.azureResourceName == "" { - return nil, errors.New("parameter client.azureResourceName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if azureResourceName == "" { + return nil, errors.New("parameter azureResourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{azureResourceName}", url.PathEscape(client.azureResourceName)) + urlPath = strings.ReplaceAll(urlPath, "{azureResourceName}", url.PathEscape(azureResourceName)) if privateLinkResourceName == "" { return nil, errors.New("parameter privateLinkResourceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateLinkResourceName}", url.PathEscape(privateLinkResourceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -121,11 +108,13 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) } // NewListByResourcePager - List private link resources under a specific Power BI resource. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-06-01 -// options - PrivateLinkResourcesClientListByResourceOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByResource -// method. -func (client *PrivateLinkResourcesClient) NewListByResourcePager(options *PrivateLinkResourcesClientListByResourceOptions) *runtime.Pager[PrivateLinkResourcesClientListByResourceResponse] { +// - resourceGroupName - The name of the resource group. +// - azureResourceName - The name of the Azure resource. +// - options - PrivateLinkResourcesClientListByResourceOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByResourcePager +// method. +func (client *PrivateLinkResourcesClient) NewListByResourcePager(resourceGroupName string, azureResourceName string, options *PrivateLinkResourcesClientListByResourceOptions) *runtime.Pager[PrivateLinkResourcesClientListByResourceResponse] { return runtime.NewPager(runtime.PagingHandler[PrivateLinkResourcesClientListByResourceResponse]{ More: func(page PrivateLinkResourcesClientListByResourceResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -134,14 +123,14 @@ func (client *PrivateLinkResourcesClient) NewListByResourcePager(options *Privat var req *policy.Request var err error if page == nil { - req, err = client.listByResourceCreateRequest(ctx, options) + req, err = client.listByResourceCreateRequest(ctx, resourceGroupName, azureResourceName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return PrivateLinkResourcesClientListByResourceResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkResourcesClientListByResourceResponse{}, err } @@ -154,21 +143,21 @@ func (client *PrivateLinkResourcesClient) NewListByResourcePager(options *Privat } // listByResourceCreateRequest creates the ListByResource request. -func (client *PrivateLinkResourcesClient) listByResourceCreateRequest(ctx context.Context, options *PrivateLinkResourcesClientListByResourceOptions) (*policy.Request, error) { +func (client *PrivateLinkResourcesClient) listByResourceCreateRequest(ctx context.Context, resourceGroupName string, azureResourceName string, options *PrivateLinkResourcesClientListByResourceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateLinkResources" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) - if client.azureResourceName == "" { - return nil, errors.New("parameter client.azureResourceName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if azureResourceName == "" { + return nil, errors.New("parameter azureResourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{azureResourceName}", url.PathEscape(client.azureResourceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + urlPath = strings.ReplaceAll(urlPath, "{azureResourceName}", url.PathEscape(azureResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkresources_client_example_test.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkresources_client_example_test.go new file mode 100644 index 000000000000..ac955aec88f4 --- /dev/null +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkresources_client_example_test.go @@ -0,0 +1,92 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armpowerbiprivatelinks_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PrivateLinkResources_ListByResource.json +func ExamplePrivateLinkResourcesClient_NewListByResourcePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpowerbiprivatelinks.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPrivateLinkResourcesClient().NewListByResourcePager("resourceGroup", "azureResourceName", 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.PrivateLinkResourcesListResult = armpowerbiprivatelinks.PrivateLinkResourcesListResult{ + // Value: []*armpowerbiprivatelinks.PrivateLinkResource{ + // { + // Name: to.Ptr("tenant"), + // Type: to.Ptr("Microsoft.PowerBI/{resourceType}/privateLinkResources"), + // ID: to.Ptr("subscriptions/a0020869-4d28-422a-89f4-c2413130d73c/resourceGroups/resourceGroup/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/azureResourceName/privateLinkResources/tenant"), + // Properties: &armpowerbiprivatelinks.PrivateLinkResourceProperties{ + // GroupID: to.Ptr("tenant"), + // RequiredMembers: []*string{ + // to.Ptr("tenant"), + // to.Ptr("capacity:3df897a4f10b49e9bddb0e9cf062adba")}, + // RequiredZoneNames: []*string{ + // to.Ptr("privatelink.powerbi.com")}, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PrivateLinkResources_Get.json +func ExamplePrivateLinkResourcesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpowerbiprivatelinks.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrivateLinkResourcesClient().Get(ctx, "resourceGroup", "azureResourceName", "tenant", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PrivateLinkResource = armpowerbiprivatelinks.PrivateLinkResource{ + // Name: to.Ptr("tenant"), + // Type: to.Ptr("Microsoft.PowerBI/{resourceType}/privateLinkResources"), + // ID: to.Ptr("subscriptions/a0020869-4d28-422a-89f4-c2413130d73c/resourceGroups/resourceGroup/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/azureResourceName/privateLinkResources/tenant"), + // Properties: &armpowerbiprivatelinks.PrivateLinkResourceProperties{ + // GroupID: to.Ptr("tenant"), + // RequiredMembers: []*string{ + // to.Ptr("tenant"), + // to.Ptr("capacity:3df897a4f10b49e9bddb0e9cf062adba")}, + // RequiredZoneNames: []*string{ + // to.Ptr("privatelink.powerbi.com")}, + // }, + // } +} diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_privatelinkserviceresourceoperationresults_client.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkserviceresourceoperationresults_client.go similarity index 59% rename from sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_privatelinkserviceresourceoperationresults_client.go rename to sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkserviceresourceoperationresults_client.go index 6ef5804a4443..fd8c4d98d9fc 100644 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_privatelinkserviceresourceoperationresults_client.go +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkserviceresourceoperationresults_client.go @@ -5,6 +5,7 @@ // 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 armpowerbiprivatelinks @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,66 +24,57 @@ import ( // PrivateLinkServiceResourceOperationResultsClient contains the methods for the PrivateLinkServiceResourceOperationResults group. // Don't use this type directly, use NewPrivateLinkServiceResourceOperationResultsClient() instead. type PrivateLinkServiceResourceOperationResultsClient struct { - host string + internal *arm.Client subscriptionID string - operationID string - pl runtime.Pipeline } // NewPrivateLinkServiceResourceOperationResultsClient creates a new instance of PrivateLinkServiceResourceOperationResultsClient with the specified values. -// subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). -// operationID - The id of Azure async operation. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewPrivateLinkServiceResourceOperationResultsClient(subscriptionID string, operationID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkServiceResourceOperationResultsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPrivateLinkServiceResourceOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkServiceResourceOperationResultsClient, error) { + cl, err := arm.NewClient(moduleName+".PrivateLinkServiceResourceOperationResultsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &PrivateLinkServiceResourceOperationResultsClient{ subscriptionID: subscriptionID, - operationID: operationID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // BeginGet - Gets operation result of Private Link Service Resources for Power BI. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-06-01 -// options - PrivateLinkServiceResourceOperationResultsClientBeginGetOptions contains the optional parameters for the PrivateLinkServiceResourceOperationResultsClient.BeginGet -// method. -func (client *PrivateLinkServiceResourceOperationResultsClient) BeginGet(ctx context.Context, options *PrivateLinkServiceResourceOperationResultsClientBeginGetOptions) (*runtime.Poller[PrivateLinkServiceResourceOperationResultsClientGetResponse], error) { +// - operationID - The id of Azure async operation. +// - options - PrivateLinkServiceResourceOperationResultsClientBeginGetOptions contains the optional parameters for the PrivateLinkServiceResourceOperationResultsClient.BeginGet +// method. +func (client *PrivateLinkServiceResourceOperationResultsClient) BeginGet(ctx context.Context, operationID string, options *PrivateLinkServiceResourceOperationResultsClientBeginGetOptions) (*runtime.Poller[PrivateLinkServiceResourceOperationResultsClientGetResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.get(ctx, options) + resp, err := client.get(ctx, operationID, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PrivateLinkServiceResourceOperationResultsClientGetResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateLinkServiceResourceOperationResultsClientGetResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[PrivateLinkServiceResourceOperationResultsClientGetResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[PrivateLinkServiceResourceOperationResultsClientGetResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Get - Gets operation result of Private Link Service Resources for Power BI. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-06-01 -func (client *PrivateLinkServiceResourceOperationResultsClient) get(ctx context.Context, options *PrivateLinkServiceResourceOperationResultsClientBeginGetOptions) (*http.Response, error) { - req, err := client.getCreateRequest(ctx, options) +func (client *PrivateLinkServiceResourceOperationResultsClient) get(ctx context.Context, operationID string, options *PrivateLinkServiceResourceOperationResultsClientBeginGetOptions) (*http.Response, error) { + req, err := client.getCreateRequest(ctx, operationID, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -95,17 +85,17 @@ func (client *PrivateLinkServiceResourceOperationResultsClient) get(ctx context. } // getCreateRequest creates the Get request. -func (client *PrivateLinkServiceResourceOperationResultsClient) getCreateRequest(ctx context.Context, options *PrivateLinkServiceResourceOperationResultsClientBeginGetOptions) (*policy.Request, error) { +func (client *PrivateLinkServiceResourceOperationResultsClient) getCreateRequest(ctx context.Context, operationID string, options *PrivateLinkServiceResourceOperationResultsClientBeginGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.PowerBI/operationResults/{operationId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if client.operationID == "" { - return nil, errors.New("parameter client.operationID cannot be empty") + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(client.operationID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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 } diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_privatelinkserviceresourceoperationresults_client_test.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkserviceresourceoperationresults_client_example_test.go similarity index 51% rename from sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_privatelinkserviceresourceoperationresults_client_test.go rename to sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkserviceresourceoperationresults_client_example_test.go index afcbd3632875..a86c3de9ca2c 100644 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_privatelinkserviceresourceoperationresults_client_test.go +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkserviceresourceoperationresults_client_example_test.go @@ -5,6 +5,7 @@ // 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 armpowerbiprivatelinks_test @@ -13,23 +14,21 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PrivateLinkServiceResourceOperationResults_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PrivateLinkServiceResourceOperationResults_Get.json func ExamplePrivateLinkServiceResourceOperationResultsClient_BeginGet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armpowerbiprivatelinks.NewPrivateLinkServiceResourceOperationResultsClient("a0020869-4d28-422a-89f4-c2413130d73c", - "9a062a88-e463-4697-bef2-fe039df73a02", cred, nil) + clientFactory, err := armpowerbiprivatelinks.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginGet(ctx, - nil) + poller, err := clientFactory.NewPrivateLinkServiceResourceOperationResultsClient().BeginGet(ctx, "9a062a88-e463-4697-bef2-fe039df73a02", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -37,6 +36,12 @@ func ExamplePrivateLinkServiceResourceOperationResultsClient_BeginGet() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AsyncOperationDetail = armpowerbiprivatelinks.AsyncOperationDetail{ + // Name: to.Ptr("9a062a88-e463-4697-bef2-fe039df73a02"), + // StartTime: to.Ptr("2017-01-06T18:58:24.7596323+00:00"), + // Status: to.Ptr("InProgress"), + // } } diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_privatelinkservices_client.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkservices_client.go similarity index 61% rename from sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_privatelinkservices_client.go rename to sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkservices_client.go index 7bfc60a6b2f7..44daea7d72a3 100644 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_privatelinkservices_client.go +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkservices_client.go @@ -5,6 +5,7 @@ // 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 armpowerbiprivatelinks @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,49 +24,39 @@ import ( // PrivateLinkServicesClient contains the methods for the PrivateLinkServices group. // Don't use this type directly, use NewPrivateLinkServicesClient() instead. type PrivateLinkServicesClient struct { - host string - subscriptionID string - resourceGroupName string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewPrivateLinkServicesClient creates a new instance of PrivateLinkServicesClient with the specified values. -// subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). -// resourceGroupName - The name of the resource group. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewPrivateLinkServicesClient(subscriptionID string, resourceGroupName string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkServicesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPrivateLinkServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkServicesClient, error) { + cl, err := arm.NewClient(moduleName+".PrivateLinkServicesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &PrivateLinkServicesClient{ - subscriptionID: subscriptionID, - resourceGroupName: resourceGroupName, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // ListByResourceGroup - Gets all the private link resources for the given resource group. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-06-01 -// options - PrivateLinkServicesClientListByResourceGroupOptions contains the optional parameters for the PrivateLinkServicesClient.ListByResourceGroup -// method. -func (client *PrivateLinkServicesClient) ListByResourceGroup(ctx context.Context, options *PrivateLinkServicesClientListByResourceGroupOptions) (PrivateLinkServicesClientListByResourceGroupResponse, error) { - req, err := client.listByResourceGroupCreateRequest(ctx, options) +// - resourceGroupName - The name of the resource group. +// - options - PrivateLinkServicesClientListByResourceGroupOptions contains the optional parameters for the PrivateLinkServicesClient.ListByResourceGroup +// method. +func (client *PrivateLinkServicesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, options *PrivateLinkServicesClientListByResourceGroupOptions) (PrivateLinkServicesClientListByResourceGroupResponse, error) { + req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) if err != nil { return PrivateLinkServicesClientListByResourceGroupResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkServicesClientListByResourceGroupResponse{}, err } @@ -78,17 +67,17 @@ func (client *PrivateLinkServicesClient) ListByResourceGroup(ctx context.Context } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *PrivateLinkServicesClient) listByResourceGroupCreateRequest(ctx context.Context, options *PrivateLinkServicesClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *PrivateLinkServicesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PrivateLinkServicesClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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 } diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkservices_client_example_test.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkservices_client_example_test.go new file mode 100644 index 000000000000..aec222ad50ee --- /dev/null +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkservices_client_example_test.go @@ -0,0 +1,66 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armpowerbiprivatelinks_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PrivateLinkServices_ListByResourceGroup.json +func ExamplePrivateLinkServicesClient_ListByResourceGroup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpowerbiprivatelinks.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrivateLinkServicesClient().ListByResourceGroup(ctx, "resourceGroup", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.TenantResourceArray = []*armpowerbiprivatelinks.TenantResource{ + // { + // Name: to.Ptr("conection 1"), + // Location: to.Ptr("west us"), + // Properties: &armpowerbiprivatelinks.TenantProperties{ + // PrivateEndpointConnections: []*armpowerbiprivatelinks.PrivateEndpointConnection{ + // { + // Name: to.Ptr("myPrivateEndpointConnections"), + // Type: to.Ptr("string"), + // ID: to.Ptr("1001"), + // Properties: &armpowerbiprivatelinks.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armpowerbiprivatelinks.PrivateEndpoint{ + // ID: to.Ptr("myPrivateEndpoint"), + // }, + // PrivateLinkServiceConnectionState: &armpowerbiprivatelinks.ConnectionState{ + // Description: to.Ptr("My private endpoint connection"), + // ActionsRequired: to.Ptr("None"), + // Status: to.Ptr(armpowerbiprivatelinks.PersistedConnectionStatusPending), + // }, + // }, + // }}, + // TenantID: to.Ptr("ac2bc297-8a3e-46f3-972d-87c2b4ae6e2f"), + // }, + // Tags: map[string]*string{ + // "tag1": to.Ptr("value1"), + // "tag2": to.Ptr("value2"), + // }, + // }} +} diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_privatelinkservicesforpowerbi_client.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkservicesforpowerbi_client.go similarity index 78% rename from sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_privatelinkservicesforpowerbi_client.go rename to sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkservicesforpowerbi_client.go index 6abc868f0000..8bb94034461e 100644 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_privatelinkservicesforpowerbi_client.go +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkservicesforpowerbi_client.go @@ -5,6 +5,7 @@ // 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 armpowerbiprivatelinks @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,46 +24,38 @@ import ( // PrivateLinkServicesForPowerBIClient contains the methods for the PrivateLinkServicesForPowerBI group. // Don't use this type directly, use NewPrivateLinkServicesForPowerBIClient() instead. type PrivateLinkServicesForPowerBIClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewPrivateLinkServicesForPowerBIClient creates a new instance of PrivateLinkServicesForPowerBIClient with the specified values. -// subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewPrivateLinkServicesForPowerBIClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkServicesForPowerBIClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".PrivateLinkServicesForPowerBIClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &PrivateLinkServicesForPowerBIClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // ListBySubscriptionID - Gets all the private link resources for the given subscription id. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-06-01 -// options - PrivateLinkServicesForPowerBIClientListBySubscriptionIDOptions contains the optional parameters for the PrivateLinkServicesForPowerBIClient.ListBySubscriptionID -// method. +// - options - PrivateLinkServicesForPowerBIClientListBySubscriptionIDOptions contains the optional parameters for the PrivateLinkServicesForPowerBIClient.ListBySubscriptionID +// method. func (client *PrivateLinkServicesForPowerBIClient) ListBySubscriptionID(ctx context.Context, options *PrivateLinkServicesForPowerBIClientListBySubscriptionIDOptions) (PrivateLinkServicesForPowerBIClientListBySubscriptionIDResponse, error) { req, err := client.listBySubscriptionIDCreateRequest(ctx, options) if err != nil { return PrivateLinkServicesForPowerBIClientListBySubscriptionIDResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkServicesForPowerBIClientListBySubscriptionIDResponse{}, err } @@ -81,7 +72,7 @@ func (client *PrivateLinkServicesForPowerBIClient) listBySubscriptionIDCreateReq 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkservicesforpowerbi_client_example_test.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkservicesforpowerbi_client_example_test.go new file mode 100644 index 000000000000..8b19157d4b72 --- /dev/null +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/privatelinkservicesforpowerbi_client_example_test.go @@ -0,0 +1,66 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armpowerbiprivatelinks_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PrivateLinkServices_ListBySubscriptionId.json +func ExamplePrivateLinkServicesForPowerBIClient_ListBySubscriptionID() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpowerbiprivatelinks.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrivateLinkServicesForPowerBIClient().ListBySubscriptionID(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.TenantResourceArray = []*armpowerbiprivatelinks.TenantResource{ + // { + // Name: to.Ptr("conection 1"), + // Location: to.Ptr("west us"), + // Properties: &armpowerbiprivatelinks.TenantProperties{ + // PrivateEndpointConnections: []*armpowerbiprivatelinks.PrivateEndpointConnection{ + // { + // Name: to.Ptr("myPrivateEndpointConnections"), + // Type: to.Ptr("string"), + // ID: to.Ptr("1001"), + // Properties: &armpowerbiprivatelinks.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armpowerbiprivatelinks.PrivateEndpoint{ + // ID: to.Ptr("myPrivateEndpoint"), + // }, + // PrivateLinkServiceConnectionState: &armpowerbiprivatelinks.ConnectionState{ + // Description: to.Ptr("My private endpoint connection"), + // ActionsRequired: to.Ptr("None"), + // Status: to.Ptr(armpowerbiprivatelinks.PersistedConnectionStatusPending), + // }, + // }, + // }}, + // TenantID: to.Ptr("ac2bc297-8a3e-46f3-972d-87c2b4ae6e2f"), + // }, + // Tags: map[string]*string{ + // "tag1": to.Ptr("value1"), + // "tag2": to.Ptr("value2"), + // }, + // }} +} diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_response_types.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/response_types.go similarity index 91% rename from sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_response_types.go rename to sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/response_types.go index f82fede67dcd..ccb533e8ea47 100644 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_response_types.go +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/response_types.go @@ -5,10 +5,11 @@ // 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 armpowerbiprivatelinks -// OperationsClientListResponse contains the response from method OperationsClient.List. +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { OperationListResult } @@ -39,7 +40,7 @@ type PrivateEndpointConnectionsClientCreateResponse struct { PrivateEndpointConnection } -// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.Delete. +// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete. type PrivateEndpointConnectionsClientDeleteResponse struct { // placeholder for future response values } @@ -49,7 +50,7 @@ type PrivateEndpointConnectionsClientGetResponse struct { PrivateEndpointConnection } -// PrivateEndpointConnectionsClientListByResourceResponse contains the response from method PrivateEndpointConnectionsClient.ListByResource. +// PrivateEndpointConnectionsClientListByResourceResponse contains the response from method PrivateEndpointConnectionsClient.NewListByResourcePager. type PrivateEndpointConnectionsClientListByResourceResponse struct { PrivateEndpointConnectionListResult } @@ -59,12 +60,12 @@ type PrivateLinkResourcesClientGetResponse struct { PrivateLinkResource } -// PrivateLinkResourcesClientListByResourceResponse contains the response from method PrivateLinkResourcesClient.ListByResource. +// PrivateLinkResourcesClientListByResourceResponse contains the response from method PrivateLinkResourcesClient.NewListByResourcePager. type PrivateLinkResourcesClientListByResourceResponse struct { PrivateLinkResourcesListResult } -// PrivateLinkServiceResourceOperationResultsClientGetResponse contains the response from method PrivateLinkServiceResourceOperationResultsClient.Get. +// PrivateLinkServiceResourceOperationResultsClientGetResponse contains the response from method PrivateLinkServiceResourceOperationResultsClient.BeginGet. type PrivateLinkServiceResourceOperationResultsClientGetResponse struct { AsyncOperationDetail } diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_time_rfc3339.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/time_rfc3339.go similarity index 96% rename from sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/time_rfc3339.go index b467280a1b82..0adf04069fdb 100644 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/time_rfc3339.go @@ -5,6 +5,7 @@ // 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 armpowerbiprivatelinks @@ -61,7 +62,7 @@ func (t *timeRFC3339) Parse(layout, value string) error { return err } -func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_operations_client_test.go deleted file mode 100644 index 55a3cc29b951..000000000000 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_operations_client_test.go +++ /dev/null @@ -1,41 +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. - -package armpowerbiprivatelinks_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/Operations_List.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerbiprivatelinks.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_powerbiresources_client_test.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_powerbiresources_client_test.go deleted file mode 100644 index 2f515afae819..000000000000 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_powerbiresources_client_test.go +++ /dev/null @@ -1,124 +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. - -package armpowerbiprivatelinks_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/powerbiprivatelinks/armpowerbiprivatelinks" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PowerBIResources_ListByResourceName.json -func ExamplePowerBIResourcesClient_ListByResourceName() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerbiprivatelinks.NewPowerBIResourcesClient("a0020869-4d28-422a-89f4-c2413130d73c", - "resourceGroup", - "azureResourceName", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListByResourceName(ctx, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PowerBIResources_Create.json -func ExamplePowerBIResourcesClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerbiprivatelinks.NewPowerBIResourcesClient("a0020869-4d28-422a-89f4-c2413130d73c", - "resourceGroup", - "azureResourceName", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, - armpowerbiprivatelinks.TenantResource{ - Location: to.Ptr("global"), - Properties: &armpowerbiprivatelinks.TenantProperties{ - TenantID: to.Ptr("ac2bc297-8a3e-46f3-972d-87c2b4ae6e2f"), - }, - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, - &armpowerbiprivatelinks.PowerBIResourcesClientCreateOptions{ClientTenantID: to.Ptr("ac2bc297-8a3e-46f3-972d-87c2b4ae6e2f")}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PowerBIResources_Update.json -func ExamplePowerBIResourcesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerbiprivatelinks.NewPowerBIResourcesClient("a0020869-4d28-422a-89f4-c2413130d73c", - "resourceGroup", - "azureResourceName", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - armpowerbiprivatelinks.TenantResource{ - Location: to.Ptr("global"), - Properties: &armpowerbiprivatelinks.TenantProperties{ - TenantID: to.Ptr("ac2bc297-8a3e-46f3-972d-87c2b4ae6e2f"), - }, - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, - &armpowerbiprivatelinks.PowerBIResourcesClientUpdateOptions{ClientTenantID: to.Ptr("ac2bc297-8a3e-46f3-972d-87c2b4ae6e2f")}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PowerBIResources_Delete.json -func ExamplePowerBIResourcesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerbiprivatelinks.NewPowerBIResourcesClient("a0020869-4d28-422a-89f4-c2413130d73c", - "resourceGroup", - "azureResourceName", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_privateendpointconnections_client_test.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_privateendpointconnections_client_test.go deleted file mode 100644 index 053d375608c6..000000000000 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_privateendpointconnections_client_test.go +++ /dev/null @@ -1,130 +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. - -package armpowerbiprivatelinks_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/powerbiprivatelinks/armpowerbiprivatelinks" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PrivateEndpointConnections_ListByResource.json -func ExamplePrivateEndpointConnectionsClient_NewListByResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerbiprivatelinks.NewPrivateEndpointConnectionsClient("a0020869-4d28-422a-89f4-c2413130d73c", - "", - "", - "", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourcePager("resourceGroup", - "azureResourceName", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PrivateEndpointConnections_Get.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerbiprivatelinks.NewPrivateEndpointConnectionsClient("a0020869-4d28-422a-89f4-c2413130d73c", - "resourceGroup", - "azureResourceName", - "myPrivateEndpointName", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PrivateEndpointConnections_Create.json -func ExamplePrivateEndpointConnectionsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerbiprivatelinks.NewPrivateEndpointConnectionsClient("a0020869-4d28-422a-89f4-c2413130d73c", - "resourceGroup", - "azureResourceName", - "myPrivateEndpointName", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, - armpowerbiprivatelinks.PrivateEndpointConnection{ - Properties: &armpowerbiprivatelinks.PrivateEndpointConnectionProperties{ - PrivateEndpoint: &armpowerbiprivatelinks.PrivateEndpoint{ - ID: to.Ptr("/subscriptions/a0020869-4d28-422a-89f4-c2413130d73c/resourceGroups/resourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpointName"), - }, - PrivateLinkServiceConnectionState: &armpowerbiprivatelinks.ConnectionState{ - Description: to.Ptr(""), - ActionsRequired: to.Ptr("None"), - Status: to.Ptr(armpowerbiprivatelinks.PersistedConnectionStatus("Approved ")), - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PrivateEndpointConnections_Delete.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerbiprivatelinks.NewPrivateEndpointConnectionsClient("a0020869-4d28-422a-89f4-c2413130d73c", - "resourceGroup", - "azureResourceName", - "myPrivateEndpointName", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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) - } -} diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_privatelinkresources_client_test.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_privatelinkresources_client_test.go deleted file mode 100644 index bc9844bffeaa..000000000000 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_privatelinkresources_client_test.go +++ /dev/null @@ -1,66 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpowerbiprivatelinks_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PrivateLinkResources_ListByResource.json -func ExamplePrivateLinkResourcesClient_NewListByResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerbiprivatelinks.NewPrivateLinkResourcesClient("a0020869-4d28-422a-89f4-c2413130d73c", - "resourceGroup", - "azureResourceName", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourcePager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PrivateLinkResources_Get.json -func ExamplePrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerbiprivatelinks.NewPrivateLinkResourcesClient("a0020869-4d28-422a-89f4-c2413130d73c", - "resourceGroup", - "azureResourceName", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "tenant", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_privatelinkservices_client_test.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_privatelinkservices_client_test.go deleted file mode 100644 index fbefea471c4d..000000000000 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_privatelinkservices_client_test.go +++ /dev/null @@ -1,38 +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. - -package armpowerbiprivatelinks_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/powerbiprivatelinks/resource-manager/Microsoft.PowerBI/stable/2020-06-01/examples/PrivateLinkServices_ListByResourceGroup.json -func ExamplePrivateLinkServicesClient_ListByResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpowerbiprivatelinks.NewPrivateLinkServicesClient("a0020869-4d28-422a-89f4-c2413130d73c", - "resourceGroup", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListByResourceGroup(ctx, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_privatelinkservicesforpowerbi_client_test.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_privatelinkservicesforpowerbi_client_test.go deleted file mode 100644 index 97d13a9423b8..000000000000 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/ze_generated_example_privatelinkservicesforpowerbi_client_test.go +++ /dev/null @@ -1,9 +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. - -package armpowerbiprivatelinks_test diff --git a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_models_serde.go b/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_models_serde.go deleted file mode 100644 index 1df1abf02a2a..000000000000 --- a/sdk/resourcemanager/powerbiprivatelinks/armpowerbiprivatelinks/zz_generated_models_serde.go +++ /dev/null @@ -1,104 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpowerbiprivatelinks - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(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 = unpopulateTimeRFC3339(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 = unpopulateTimeRFC3339(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 TenantProperties. -func (t TenantProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "privateEndpointConnections", t.PrivateEndpointConnections) - populate(objectMap, "tenantId", t.TenantID) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type TenantResource. -func (t TenantResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - 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 interface{}) error { - if data == nil { - 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/recoveryservices/armrecoveryservicessiterecovery/CHANGELOG.md b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/CHANGELOG.md index cd02d5a99c88..a249d7d7ec82 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/CHANGELOG.md +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/CHANGELOG.md @@ -1,5 +1,179 @@ # Release History +## 2.0.0 (2023-04-03) +### Breaking Changes + +- Function `NewMigrationRecoveryPointsClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*MigrationRecoveryPointsClient.Get` parameter(s) have been changed from `(context.Context, string, string, string, string, *MigrationRecoveryPointsClientGetOptions)` to `(context.Context, string, string, string, string, string, string, *MigrationRecoveryPointsClientGetOptions)` +- Function `*MigrationRecoveryPointsClient.NewListByReplicationMigrationItemsPager` parameter(s) have been changed from `(string, string, string, *MigrationRecoveryPointsClientListByReplicationMigrationItemsOptions)` to `(string, string, string, string, string, *MigrationRecoveryPointsClientListByReplicationMigrationItemsOptions)` +- Function `NewOperationsClient` parameter(s) have been changed from `(string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*OperationsClient.NewListPager` parameter(s) have been changed from `(*OperationsClientListOptions)` to `(string, *OperationsClientListOptions)` +- Function `NewRecoveryPointsClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*RecoveryPointsClient.Get` parameter(s) have been changed from `(context.Context, string, string, string, string, *RecoveryPointsClientGetOptions)` to `(context.Context, string, string, string, string, string, string, *RecoveryPointsClientGetOptions)` +- Function `*RecoveryPointsClient.NewListByReplicationProtectedItemsPager` parameter(s) have been changed from `(string, string, string, *RecoveryPointsClientListByReplicationProtectedItemsOptions)` to `(string, string, string, string, string, *RecoveryPointsClientListByReplicationProtectedItemsOptions)` +- Function `NewReplicationAlertSettingsClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationAlertSettingsClient.Create` parameter(s) have been changed from `(context.Context, string, ConfigureAlertRequest, *ReplicationAlertSettingsClientCreateOptions)` to `(context.Context, string, string, string, ConfigureAlertRequest, *ReplicationAlertSettingsClientCreateOptions)` +- Function `*ReplicationAlertSettingsClient.Get` parameter(s) have been changed from `(context.Context, string, *ReplicationAlertSettingsClientGetOptions)` to `(context.Context, string, string, string, *ReplicationAlertSettingsClientGetOptions)` +- Function `*ReplicationAlertSettingsClient.NewListPager` parameter(s) have been changed from `(*ReplicationAlertSettingsClientListOptions)` to `(string, string, *ReplicationAlertSettingsClientListOptions)` +- Function `NewReplicationAppliancesClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationAppliancesClient.NewListPager` parameter(s) have been changed from `(*ReplicationAppliancesClientListOptions)` to `(string, string, *ReplicationAppliancesClientListOptions)` +- Function `NewReplicationEligibilityResultsClient` parameter(s) have been changed from `(string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationEligibilityResultsClient.Get` parameter(s) have been changed from `(context.Context, string, *ReplicationEligibilityResultsClientGetOptions)` to `(context.Context, string, string, *ReplicationEligibilityResultsClientGetOptions)` +- Function `*ReplicationEligibilityResultsClient.List` parameter(s) have been changed from `(context.Context, string, *ReplicationEligibilityResultsClientListOptions)` to `(context.Context, string, string, *ReplicationEligibilityResultsClientListOptions)` +- Function `NewReplicationEventsClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationEventsClient.Get` parameter(s) have been changed from `(context.Context, string, *ReplicationEventsClientGetOptions)` to `(context.Context, string, string, string, *ReplicationEventsClientGetOptions)` +- Function `*ReplicationEventsClient.NewListPager` parameter(s) have been changed from `(*ReplicationEventsClientListOptions)` to `(string, string, *ReplicationEventsClientListOptions)` +- Function `NewReplicationFabricsClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationFabricsClient.BeginCheckConsistency` parameter(s) have been changed from `(context.Context, string, *ReplicationFabricsClientBeginCheckConsistencyOptions)` to `(context.Context, string, string, string, *ReplicationFabricsClientBeginCheckConsistencyOptions)` +- Function `*ReplicationFabricsClient.BeginCreate` parameter(s) have been changed from `(context.Context, string, FabricCreationInput, *ReplicationFabricsClientBeginCreateOptions)` to `(context.Context, string, string, string, FabricCreationInput, *ReplicationFabricsClientBeginCreateOptions)` +- Function `*ReplicationFabricsClient.BeginDelete` parameter(s) have been changed from `(context.Context, string, *ReplicationFabricsClientBeginDeleteOptions)` to `(context.Context, string, string, string, *ReplicationFabricsClientBeginDeleteOptions)` +- Function `*ReplicationFabricsClient.BeginMigrateToAAD` parameter(s) have been changed from `(context.Context, string, *ReplicationFabricsClientBeginMigrateToAADOptions)` to `(context.Context, string, string, string, *ReplicationFabricsClientBeginMigrateToAADOptions)` +- Function `*ReplicationFabricsClient.BeginPurge` parameter(s) have been changed from `(context.Context, string, *ReplicationFabricsClientBeginPurgeOptions)` to `(context.Context, string, string, string, *ReplicationFabricsClientBeginPurgeOptions)` +- Function `*ReplicationFabricsClient.BeginReassociateGateway` parameter(s) have been changed from `(context.Context, string, FailoverProcessServerRequest, *ReplicationFabricsClientBeginReassociateGatewayOptions)` to `(context.Context, string, string, string, FailoverProcessServerRequest, *ReplicationFabricsClientBeginReassociateGatewayOptions)` +- Function `*ReplicationFabricsClient.BeginRenewCertificate` parameter(s) have been changed from `(context.Context, string, RenewCertificateInput, *ReplicationFabricsClientBeginRenewCertificateOptions)` to `(context.Context, string, string, string, RenewCertificateInput, *ReplicationFabricsClientBeginRenewCertificateOptions)` +- Function `*ReplicationFabricsClient.Get` parameter(s) have been changed from `(context.Context, string, *ReplicationFabricsClientGetOptions)` to `(context.Context, string, string, string, *ReplicationFabricsClientGetOptions)` +- Function `*ReplicationFabricsClient.NewListPager` parameter(s) have been changed from `(*ReplicationFabricsClientListOptions)` to `(string, string, *ReplicationFabricsClientListOptions)` +- Function `NewReplicationJobsClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationJobsClient.BeginCancel` parameter(s) have been changed from `(context.Context, string, *ReplicationJobsClientBeginCancelOptions)` to `(context.Context, string, string, string, *ReplicationJobsClientBeginCancelOptions)` +- Function `*ReplicationJobsClient.BeginExport` parameter(s) have been changed from `(context.Context, JobQueryParameter, *ReplicationJobsClientBeginExportOptions)` to `(context.Context, string, string, JobQueryParameter, *ReplicationJobsClientBeginExportOptions)` +- Function `*ReplicationJobsClient.BeginRestart` parameter(s) have been changed from `(context.Context, string, *ReplicationJobsClientBeginRestartOptions)` to `(context.Context, string, string, string, *ReplicationJobsClientBeginRestartOptions)` +- Function `*ReplicationJobsClient.BeginResume` parameter(s) have been changed from `(context.Context, string, ResumeJobParams, *ReplicationJobsClientBeginResumeOptions)` to `(context.Context, string, string, string, ResumeJobParams, *ReplicationJobsClientBeginResumeOptions)` +- Function `*ReplicationJobsClient.Get` parameter(s) have been changed from `(context.Context, string, *ReplicationJobsClientGetOptions)` to `(context.Context, string, string, string, *ReplicationJobsClientGetOptions)` +- Function `*ReplicationJobsClient.NewListPager` parameter(s) have been changed from `(*ReplicationJobsClientListOptions)` to `(string, string, *ReplicationJobsClientListOptions)` +- Function `NewReplicationLogicalNetworksClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationLogicalNetworksClient.Get` parameter(s) have been changed from `(context.Context, string, string, *ReplicationLogicalNetworksClientGetOptions)` to `(context.Context, string, string, string, string, *ReplicationLogicalNetworksClientGetOptions)` +- Function `*ReplicationLogicalNetworksClient.NewListByReplicationFabricsPager` parameter(s) have been changed from `(string, *ReplicationLogicalNetworksClientListByReplicationFabricsOptions)` to `(string, string, string, *ReplicationLogicalNetworksClientListByReplicationFabricsOptions)` +- Function `NewReplicationMigrationItemsClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationMigrationItemsClient.BeginCreate` parameter(s) have been changed from `(context.Context, string, string, string, EnableMigrationInput, *ReplicationMigrationItemsClientBeginCreateOptions)` to `(context.Context, string, string, string, string, string, EnableMigrationInput, *ReplicationMigrationItemsClientBeginCreateOptions)` +- Function `*ReplicationMigrationItemsClient.BeginDelete` parameter(s) have been changed from `(context.Context, string, string, string, *ReplicationMigrationItemsClientBeginDeleteOptions)` to `(context.Context, string, string, string, string, string, *ReplicationMigrationItemsClientBeginDeleteOptions)` +- Function `*ReplicationMigrationItemsClient.BeginMigrate` parameter(s) have been changed from `(context.Context, string, string, string, MigrateInput, *ReplicationMigrationItemsClientBeginMigrateOptions)` to `(context.Context, string, string, string, string, string, MigrateInput, *ReplicationMigrationItemsClientBeginMigrateOptions)` +- Function `*ReplicationMigrationItemsClient.BeginPauseReplication` parameter(s) have been changed from `(context.Context, string, string, string, PauseReplicationInput, *ReplicationMigrationItemsClientBeginPauseReplicationOptions)` to `(context.Context, string, string, string, string, string, PauseReplicationInput, *ReplicationMigrationItemsClientBeginPauseReplicationOptions)` +- Function `*ReplicationMigrationItemsClient.BeginResumeReplication` parameter(s) have been changed from `(context.Context, string, string, string, ResumeReplicationInput, *ReplicationMigrationItemsClientBeginResumeReplicationOptions)` to `(context.Context, string, string, string, string, string, ResumeReplicationInput, *ReplicationMigrationItemsClientBeginResumeReplicationOptions)` +- Function `*ReplicationMigrationItemsClient.BeginResync` parameter(s) have been changed from `(context.Context, string, string, string, ResyncInput, *ReplicationMigrationItemsClientBeginResyncOptions)` to `(context.Context, string, string, string, string, string, ResyncInput, *ReplicationMigrationItemsClientBeginResyncOptions)` +- Function `*ReplicationMigrationItemsClient.BeginTestMigrate` parameter(s) have been changed from `(context.Context, string, string, string, TestMigrateInput, *ReplicationMigrationItemsClientBeginTestMigrateOptions)` to `(context.Context, string, string, string, string, string, TestMigrateInput, *ReplicationMigrationItemsClientBeginTestMigrateOptions)` +- Function `*ReplicationMigrationItemsClient.BeginTestMigrateCleanup` parameter(s) have been changed from `(context.Context, string, string, string, TestMigrateCleanupInput, *ReplicationMigrationItemsClientBeginTestMigrateCleanupOptions)` to `(context.Context, string, string, string, string, string, TestMigrateCleanupInput, *ReplicationMigrationItemsClientBeginTestMigrateCleanupOptions)` +- Function `*ReplicationMigrationItemsClient.BeginUpdate` parameter(s) have been changed from `(context.Context, string, string, string, UpdateMigrationItemInput, *ReplicationMigrationItemsClientBeginUpdateOptions)` to `(context.Context, string, string, string, string, string, UpdateMigrationItemInput, *ReplicationMigrationItemsClientBeginUpdateOptions)` +- Function `*ReplicationMigrationItemsClient.Get` parameter(s) have been changed from `(context.Context, string, string, string, *ReplicationMigrationItemsClientGetOptions)` to `(context.Context, string, string, string, string, string, *ReplicationMigrationItemsClientGetOptions)` +- Function `*ReplicationMigrationItemsClient.NewListByReplicationProtectionContainersPager` parameter(s) have been changed from `(string, string, *ReplicationMigrationItemsClientListByReplicationProtectionContainersOptions)` to `(string, string, string, string, *ReplicationMigrationItemsClientListByReplicationProtectionContainersOptions)` +- Function `*ReplicationMigrationItemsClient.NewListPager` parameter(s) have been changed from `(*ReplicationMigrationItemsClientListOptions)` to `(string, string, *ReplicationMigrationItemsClientListOptions)` +- Function `NewReplicationNetworkMappingsClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationNetworkMappingsClient.BeginCreate` parameter(s) have been changed from `(context.Context, string, string, string, CreateNetworkMappingInput, *ReplicationNetworkMappingsClientBeginCreateOptions)` to `(context.Context, string, string, string, string, string, CreateNetworkMappingInput, *ReplicationNetworkMappingsClientBeginCreateOptions)` +- Function `*ReplicationNetworkMappingsClient.BeginDelete` parameter(s) have been changed from `(context.Context, string, string, string, *ReplicationNetworkMappingsClientBeginDeleteOptions)` to `(context.Context, string, string, string, string, string, *ReplicationNetworkMappingsClientBeginDeleteOptions)` +- Function `*ReplicationNetworkMappingsClient.BeginUpdate` parameter(s) have been changed from `(context.Context, string, string, string, UpdateNetworkMappingInput, *ReplicationNetworkMappingsClientBeginUpdateOptions)` to `(context.Context, string, string, string, string, string, UpdateNetworkMappingInput, *ReplicationNetworkMappingsClientBeginUpdateOptions)` +- Function `*ReplicationNetworkMappingsClient.Get` parameter(s) have been changed from `(context.Context, string, string, string, *ReplicationNetworkMappingsClientGetOptions)` to `(context.Context, string, string, string, string, string, *ReplicationNetworkMappingsClientGetOptions)` +- Function `*ReplicationNetworkMappingsClient.NewListByReplicationNetworksPager` parameter(s) have been changed from `(string, string, *ReplicationNetworkMappingsClientListByReplicationNetworksOptions)` to `(string, string, string, string, *ReplicationNetworkMappingsClientListByReplicationNetworksOptions)` +- Function `*ReplicationNetworkMappingsClient.NewListPager` parameter(s) have been changed from `(*ReplicationNetworkMappingsClientListOptions)` to `(string, string, *ReplicationNetworkMappingsClientListOptions)` +- Function `NewReplicationNetworksClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationNetworksClient.Get` parameter(s) have been changed from `(context.Context, string, string, *ReplicationNetworksClientGetOptions)` to `(context.Context, string, string, string, string, *ReplicationNetworksClientGetOptions)` +- Function `*ReplicationNetworksClient.NewListByReplicationFabricsPager` parameter(s) have been changed from `(string, *ReplicationNetworksClientListByReplicationFabricsOptions)` to `(string, string, string, *ReplicationNetworksClientListByReplicationFabricsOptions)` +- Function `*ReplicationNetworksClient.NewListPager` parameter(s) have been changed from `(*ReplicationNetworksClientListOptions)` to `(string, string, *ReplicationNetworksClientListOptions)` +- Function `NewReplicationPoliciesClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationPoliciesClient.BeginCreate` parameter(s) have been changed from `(context.Context, string, CreatePolicyInput, *ReplicationPoliciesClientBeginCreateOptions)` to `(context.Context, string, string, string, CreatePolicyInput, *ReplicationPoliciesClientBeginCreateOptions)` +- Function `*ReplicationPoliciesClient.BeginDelete` parameter(s) have been changed from `(context.Context, string, *ReplicationPoliciesClientBeginDeleteOptions)` to `(context.Context, string, string, string, *ReplicationPoliciesClientBeginDeleteOptions)` +- Function `*ReplicationPoliciesClient.BeginUpdate` parameter(s) have been changed from `(context.Context, string, UpdatePolicyInput, *ReplicationPoliciesClientBeginUpdateOptions)` to `(context.Context, string, string, string, UpdatePolicyInput, *ReplicationPoliciesClientBeginUpdateOptions)` +- Function `*ReplicationPoliciesClient.Get` parameter(s) have been changed from `(context.Context, string, *ReplicationPoliciesClientGetOptions)` to `(context.Context, string, string, string, *ReplicationPoliciesClientGetOptions)` +- Function `*ReplicationPoliciesClient.NewListPager` parameter(s) have been changed from `(*ReplicationPoliciesClientListOptions)` to `(string, string, *ReplicationPoliciesClientListOptions)` +- Function `NewReplicationProtectableItemsClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationProtectableItemsClient.Get` parameter(s) have been changed from `(context.Context, string, string, string, *ReplicationProtectableItemsClientGetOptions)` to `(context.Context, string, string, string, string, string, *ReplicationProtectableItemsClientGetOptions)` +- Function `*ReplicationProtectableItemsClient.NewListByReplicationProtectionContainersPager` parameter(s) have been changed from `(string, string, *ReplicationProtectableItemsClientListByReplicationProtectionContainersOptions)` to `(string, string, string, string, *ReplicationProtectableItemsClientListByReplicationProtectionContainersOptions)` +- Function `NewReplicationProtectedItemsClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationProtectedItemsClient.BeginAddDisks` parameter(s) have been changed from `(context.Context, string, string, string, AddDisksInput, *ReplicationProtectedItemsClientBeginAddDisksOptions)` to `(context.Context, string, string, string, string, string, AddDisksInput, *ReplicationProtectedItemsClientBeginAddDisksOptions)` +- Function `*ReplicationProtectedItemsClient.BeginApplyRecoveryPoint` parameter(s) have been changed from `(context.Context, string, string, string, ApplyRecoveryPointInput, *ReplicationProtectedItemsClientBeginApplyRecoveryPointOptions)` to `(context.Context, string, string, string, string, string, ApplyRecoveryPointInput, *ReplicationProtectedItemsClientBeginApplyRecoveryPointOptions)` +- Function `*ReplicationProtectedItemsClient.BeginCreate` parameter(s) have been changed from `(context.Context, string, string, string, EnableProtectionInput, *ReplicationProtectedItemsClientBeginCreateOptions)` to `(context.Context, string, string, string, string, string, EnableProtectionInput, *ReplicationProtectedItemsClientBeginCreateOptions)` +- Function `*ReplicationProtectedItemsClient.BeginDelete` parameter(s) have been changed from `(context.Context, string, string, string, DisableProtectionInput, *ReplicationProtectedItemsClientBeginDeleteOptions)` to `(context.Context, string, string, string, string, string, DisableProtectionInput, *ReplicationProtectedItemsClientBeginDeleteOptions)` +- Function `*ReplicationProtectedItemsClient.BeginFailoverCancel` parameter(s) have been changed from `(context.Context, string, string, string, *ReplicationProtectedItemsClientBeginFailoverCancelOptions)` to `(context.Context, string, string, string, string, string, *ReplicationProtectedItemsClientBeginFailoverCancelOptions)` +- Function `*ReplicationProtectedItemsClient.BeginFailoverCommit` parameter(s) have been changed from `(context.Context, string, string, string, *ReplicationProtectedItemsClientBeginFailoverCommitOptions)` to `(context.Context, string, string, string, string, string, *ReplicationProtectedItemsClientBeginFailoverCommitOptions)` +- Function `*ReplicationProtectedItemsClient.BeginPlannedFailover` parameter(s) have been changed from `(context.Context, string, string, string, PlannedFailoverInput, *ReplicationProtectedItemsClientBeginPlannedFailoverOptions)` to `(context.Context, string, string, string, string, string, PlannedFailoverInput, *ReplicationProtectedItemsClientBeginPlannedFailoverOptions)` +- Function `*ReplicationProtectedItemsClient.BeginPurge` parameter(s) have been changed from `(context.Context, string, string, string, *ReplicationProtectedItemsClientBeginPurgeOptions)` to `(context.Context, string, string, string, string, string, *ReplicationProtectedItemsClientBeginPurgeOptions)` +- Function `*ReplicationProtectedItemsClient.BeginRemoveDisks` parameter(s) have been changed from `(context.Context, string, string, string, RemoveDisksInput, *ReplicationProtectedItemsClientBeginRemoveDisksOptions)` to `(context.Context, string, string, string, string, string, RemoveDisksInput, *ReplicationProtectedItemsClientBeginRemoveDisksOptions)` +- Function `*ReplicationProtectedItemsClient.BeginRepairReplication` parameter(s) have been changed from `(context.Context, string, string, string, *ReplicationProtectedItemsClientBeginRepairReplicationOptions)` to `(context.Context, string, string, string, string, string, *ReplicationProtectedItemsClientBeginRepairReplicationOptions)` +- Function `*ReplicationProtectedItemsClient.BeginReprotect` parameter(s) have been changed from `(context.Context, string, string, string, ReverseReplicationInput, *ReplicationProtectedItemsClientBeginReprotectOptions)` to `(context.Context, string, string, string, string, string, ReverseReplicationInput, *ReplicationProtectedItemsClientBeginReprotectOptions)` +- Function `*ReplicationProtectedItemsClient.BeginResolveHealthErrors` parameter(s) have been changed from `(context.Context, string, string, string, ResolveHealthInput, *ReplicationProtectedItemsClientBeginResolveHealthErrorsOptions)` to `(context.Context, string, string, string, string, string, ResolveHealthInput, *ReplicationProtectedItemsClientBeginResolveHealthErrorsOptions)` +- Function `*ReplicationProtectedItemsClient.BeginSwitchProvider` parameter(s) have been changed from `(context.Context, string, string, string, SwitchProviderInput, *ReplicationProtectedItemsClientBeginSwitchProviderOptions)` to `(context.Context, string, string, string, string, string, SwitchProviderInput, *ReplicationProtectedItemsClientBeginSwitchProviderOptions)` +- Function `*ReplicationProtectedItemsClient.BeginTestFailover` parameter(s) have been changed from `(context.Context, string, string, string, TestFailoverInput, *ReplicationProtectedItemsClientBeginTestFailoverOptions)` to `(context.Context, string, string, string, string, string, TestFailoverInput, *ReplicationProtectedItemsClientBeginTestFailoverOptions)` +- Function `*ReplicationProtectedItemsClient.BeginTestFailoverCleanup` parameter(s) have been changed from `(context.Context, string, string, string, TestFailoverCleanupInput, *ReplicationProtectedItemsClientBeginTestFailoverCleanupOptions)` to `(context.Context, string, string, string, string, string, TestFailoverCleanupInput, *ReplicationProtectedItemsClientBeginTestFailoverCleanupOptions)` +- Function `*ReplicationProtectedItemsClient.BeginUnplannedFailover` parameter(s) have been changed from `(context.Context, string, string, string, UnplannedFailoverInput, *ReplicationProtectedItemsClientBeginUnplannedFailoverOptions)` to `(context.Context, string, string, string, string, string, UnplannedFailoverInput, *ReplicationProtectedItemsClientBeginUnplannedFailoverOptions)` +- Function `*ReplicationProtectedItemsClient.BeginUpdate` parameter(s) have been changed from `(context.Context, string, string, string, UpdateReplicationProtectedItemInput, *ReplicationProtectedItemsClientBeginUpdateOptions)` to `(context.Context, string, string, string, string, string, UpdateReplicationProtectedItemInput, *ReplicationProtectedItemsClientBeginUpdateOptions)` +- Function `*ReplicationProtectedItemsClient.BeginUpdateAppliance` parameter(s) have been changed from `(context.Context, string, string, string, UpdateApplianceForReplicationProtectedItemInput, *ReplicationProtectedItemsClientBeginUpdateApplianceOptions)` to `(context.Context, string, string, string, string, string, UpdateApplianceForReplicationProtectedItemInput, *ReplicationProtectedItemsClientBeginUpdateApplianceOptions)` +- Function `*ReplicationProtectedItemsClient.BeginUpdateMobilityService` parameter(s) have been changed from `(context.Context, string, string, string, UpdateMobilityServiceRequest, *ReplicationProtectedItemsClientBeginUpdateMobilityServiceOptions)` to `(context.Context, string, string, string, string, string, UpdateMobilityServiceRequest, *ReplicationProtectedItemsClientBeginUpdateMobilityServiceOptions)` +- Function `*ReplicationProtectedItemsClient.Get` parameter(s) have been changed from `(context.Context, string, string, string, *ReplicationProtectedItemsClientGetOptions)` to `(context.Context, string, string, string, string, string, *ReplicationProtectedItemsClientGetOptions)` +- Function `*ReplicationProtectedItemsClient.NewListByReplicationProtectionContainersPager` parameter(s) have been changed from `(string, string, *ReplicationProtectedItemsClientListByReplicationProtectionContainersOptions)` to `(string, string, string, string, *ReplicationProtectedItemsClientListByReplicationProtectionContainersOptions)` +- Function `*ReplicationProtectedItemsClient.NewListPager` parameter(s) have been changed from `(*ReplicationProtectedItemsClientListOptions)` to `(string, string, *ReplicationProtectedItemsClientListOptions)` +- Function `NewReplicationProtectionContainerMappingsClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationProtectionContainerMappingsClient.BeginCreate` parameter(s) have been changed from `(context.Context, string, string, string, CreateProtectionContainerMappingInput, *ReplicationProtectionContainerMappingsClientBeginCreateOptions)` to `(context.Context, string, string, string, string, string, CreateProtectionContainerMappingInput, *ReplicationProtectionContainerMappingsClientBeginCreateOptions)` +- Function `*ReplicationProtectionContainerMappingsClient.BeginDelete` parameter(s) have been changed from `(context.Context, string, string, string, RemoveProtectionContainerMappingInput, *ReplicationProtectionContainerMappingsClientBeginDeleteOptions)` to `(context.Context, string, string, string, string, string, RemoveProtectionContainerMappingInput, *ReplicationProtectionContainerMappingsClientBeginDeleteOptions)` +- Function `*ReplicationProtectionContainerMappingsClient.BeginPurge` parameter(s) have been changed from `(context.Context, string, string, string, *ReplicationProtectionContainerMappingsClientBeginPurgeOptions)` to `(context.Context, string, string, string, string, string, *ReplicationProtectionContainerMappingsClientBeginPurgeOptions)` +- Function `*ReplicationProtectionContainerMappingsClient.BeginUpdate` parameter(s) have been changed from `(context.Context, string, string, string, UpdateProtectionContainerMappingInput, *ReplicationProtectionContainerMappingsClientBeginUpdateOptions)` to `(context.Context, string, string, string, string, string, UpdateProtectionContainerMappingInput, *ReplicationProtectionContainerMappingsClientBeginUpdateOptions)` +- Function `*ReplicationProtectionContainerMappingsClient.Get` parameter(s) have been changed from `(context.Context, string, string, string, *ReplicationProtectionContainerMappingsClientGetOptions)` to `(context.Context, string, string, string, string, string, *ReplicationProtectionContainerMappingsClientGetOptions)` +- Function `*ReplicationProtectionContainerMappingsClient.NewListByReplicationProtectionContainersPager` parameter(s) have been changed from `(string, string, *ReplicationProtectionContainerMappingsClientListByReplicationProtectionContainersOptions)` to `(string, string, string, string, *ReplicationProtectionContainerMappingsClientListByReplicationProtectionContainersOptions)` +- Function `*ReplicationProtectionContainerMappingsClient.NewListPager` parameter(s) have been changed from `(*ReplicationProtectionContainerMappingsClientListOptions)` to `(string, string, *ReplicationProtectionContainerMappingsClientListOptions)` +- Function `NewReplicationProtectionContainersClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationProtectionContainersClient.BeginCreate` parameter(s) have been changed from `(context.Context, string, string, CreateProtectionContainerInput, *ReplicationProtectionContainersClientBeginCreateOptions)` to `(context.Context, string, string, string, string, CreateProtectionContainerInput, *ReplicationProtectionContainersClientBeginCreateOptions)` +- Function `*ReplicationProtectionContainersClient.BeginDelete` parameter(s) have been changed from `(context.Context, string, string, *ReplicationProtectionContainersClientBeginDeleteOptions)` to `(context.Context, string, string, string, string, *ReplicationProtectionContainersClientBeginDeleteOptions)` +- Function `*ReplicationProtectionContainersClient.BeginDiscoverProtectableItem` parameter(s) have been changed from `(context.Context, string, string, DiscoverProtectableItemRequest, *ReplicationProtectionContainersClientBeginDiscoverProtectableItemOptions)` to `(context.Context, string, string, string, string, DiscoverProtectableItemRequest, *ReplicationProtectionContainersClientBeginDiscoverProtectableItemOptions)` +- Function `*ReplicationProtectionContainersClient.BeginSwitchProtection` parameter(s) have been changed from `(context.Context, string, string, SwitchProtectionInput, *ReplicationProtectionContainersClientBeginSwitchProtectionOptions)` to `(context.Context, string, string, string, string, SwitchProtectionInput, *ReplicationProtectionContainersClientBeginSwitchProtectionOptions)` +- Function `*ReplicationProtectionContainersClient.Get` parameter(s) have been changed from `(context.Context, string, string, *ReplicationProtectionContainersClientGetOptions)` to `(context.Context, string, string, string, string, *ReplicationProtectionContainersClientGetOptions)` +- Function `*ReplicationProtectionContainersClient.NewListByReplicationFabricsPager` parameter(s) have been changed from `(string, *ReplicationProtectionContainersClientListByReplicationFabricsOptions)` to `(string, string, string, *ReplicationProtectionContainersClientListByReplicationFabricsOptions)` +- Function `*ReplicationProtectionContainersClient.NewListPager` parameter(s) have been changed from `(*ReplicationProtectionContainersClientListOptions)` to `(string, string, *ReplicationProtectionContainersClientListOptions)` +- Function `NewReplicationProtectionIntentsClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationProtectionIntentsClient.Create` parameter(s) have been changed from `(context.Context, string, CreateProtectionIntentInput, *ReplicationProtectionIntentsClientCreateOptions)` to `(context.Context, string, string, string, CreateProtectionIntentInput, *ReplicationProtectionIntentsClientCreateOptions)` +- Function `*ReplicationProtectionIntentsClient.Get` parameter(s) have been changed from `(context.Context, string, *ReplicationProtectionIntentsClientGetOptions)` to `(context.Context, string, string, string, *ReplicationProtectionIntentsClientGetOptions)` +- Function `*ReplicationProtectionIntentsClient.NewListPager` parameter(s) have been changed from `(*ReplicationProtectionIntentsClientListOptions)` to `(string, string, *ReplicationProtectionIntentsClientListOptions)` +- Function `NewReplicationRecoveryPlansClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationRecoveryPlansClient.BeginCreate` parameter(s) have been changed from `(context.Context, string, CreateRecoveryPlanInput, *ReplicationRecoveryPlansClientBeginCreateOptions)` to `(context.Context, string, string, string, CreateRecoveryPlanInput, *ReplicationRecoveryPlansClientBeginCreateOptions)` +- Function `*ReplicationRecoveryPlansClient.BeginDelete` parameter(s) have been changed from `(context.Context, string, *ReplicationRecoveryPlansClientBeginDeleteOptions)` to `(context.Context, string, string, string, *ReplicationRecoveryPlansClientBeginDeleteOptions)` +- Function `*ReplicationRecoveryPlansClient.BeginFailoverCancel` parameter(s) have been changed from `(context.Context, string, *ReplicationRecoveryPlansClientBeginFailoverCancelOptions)` to `(context.Context, string, string, string, *ReplicationRecoveryPlansClientBeginFailoverCancelOptions)` +- Function `*ReplicationRecoveryPlansClient.BeginFailoverCommit` parameter(s) have been changed from `(context.Context, string, *ReplicationRecoveryPlansClientBeginFailoverCommitOptions)` to `(context.Context, string, string, string, *ReplicationRecoveryPlansClientBeginFailoverCommitOptions)` +- Function `*ReplicationRecoveryPlansClient.BeginPlannedFailover` parameter(s) have been changed from `(context.Context, string, RecoveryPlanPlannedFailoverInput, *ReplicationRecoveryPlansClientBeginPlannedFailoverOptions)` to `(context.Context, string, string, string, RecoveryPlanPlannedFailoverInput, *ReplicationRecoveryPlansClientBeginPlannedFailoverOptions)` +- Function `*ReplicationRecoveryPlansClient.BeginReprotect` parameter(s) have been changed from `(context.Context, string, *ReplicationRecoveryPlansClientBeginReprotectOptions)` to `(context.Context, string, string, string, *ReplicationRecoveryPlansClientBeginReprotectOptions)` +- Function `*ReplicationRecoveryPlansClient.BeginTestFailover` parameter(s) have been changed from `(context.Context, string, RecoveryPlanTestFailoverInput, *ReplicationRecoveryPlansClientBeginTestFailoverOptions)` to `(context.Context, string, string, string, RecoveryPlanTestFailoverInput, *ReplicationRecoveryPlansClientBeginTestFailoverOptions)` +- Function `*ReplicationRecoveryPlansClient.BeginTestFailoverCleanup` parameter(s) have been changed from `(context.Context, string, RecoveryPlanTestFailoverCleanupInput, *ReplicationRecoveryPlansClientBeginTestFailoverCleanupOptions)` to `(context.Context, string, string, string, RecoveryPlanTestFailoverCleanupInput, *ReplicationRecoveryPlansClientBeginTestFailoverCleanupOptions)` +- Function `*ReplicationRecoveryPlansClient.BeginUnplannedFailover` parameter(s) have been changed from `(context.Context, string, RecoveryPlanUnplannedFailoverInput, *ReplicationRecoveryPlansClientBeginUnplannedFailoverOptions)` to `(context.Context, string, string, string, RecoveryPlanUnplannedFailoverInput, *ReplicationRecoveryPlansClientBeginUnplannedFailoverOptions)` +- Function `*ReplicationRecoveryPlansClient.BeginUpdate` parameter(s) have been changed from `(context.Context, string, UpdateRecoveryPlanInput, *ReplicationRecoveryPlansClientBeginUpdateOptions)` to `(context.Context, string, string, string, UpdateRecoveryPlanInput, *ReplicationRecoveryPlansClientBeginUpdateOptions)` +- Function `*ReplicationRecoveryPlansClient.Get` parameter(s) have been changed from `(context.Context, string, *ReplicationRecoveryPlansClientGetOptions)` to `(context.Context, string, string, string, *ReplicationRecoveryPlansClientGetOptions)` +- Function `*ReplicationRecoveryPlansClient.NewListPager` parameter(s) have been changed from `(*ReplicationRecoveryPlansClientListOptions)` to `(string, string, *ReplicationRecoveryPlansClientListOptions)` +- Function `NewReplicationRecoveryServicesProvidersClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationRecoveryServicesProvidersClient.BeginCreate` parameter(s) have been changed from `(context.Context, string, string, AddRecoveryServicesProviderInput, *ReplicationRecoveryServicesProvidersClientBeginCreateOptions)` to `(context.Context, string, string, string, string, AddRecoveryServicesProviderInput, *ReplicationRecoveryServicesProvidersClientBeginCreateOptions)` +- Function `*ReplicationRecoveryServicesProvidersClient.BeginDelete` parameter(s) have been changed from `(context.Context, string, string, *ReplicationRecoveryServicesProvidersClientBeginDeleteOptions)` to `(context.Context, string, string, string, string, *ReplicationRecoveryServicesProvidersClientBeginDeleteOptions)` +- Function `*ReplicationRecoveryServicesProvidersClient.BeginPurge` parameter(s) have been changed from `(context.Context, string, string, *ReplicationRecoveryServicesProvidersClientBeginPurgeOptions)` to `(context.Context, string, string, string, string, *ReplicationRecoveryServicesProvidersClientBeginPurgeOptions)` +- Function `*ReplicationRecoveryServicesProvidersClient.BeginRefreshProvider` parameter(s) have been changed from `(context.Context, string, string, *ReplicationRecoveryServicesProvidersClientBeginRefreshProviderOptions)` to `(context.Context, string, string, string, string, *ReplicationRecoveryServicesProvidersClientBeginRefreshProviderOptions)` +- Function `*ReplicationRecoveryServicesProvidersClient.Get` parameter(s) have been changed from `(context.Context, string, string, *ReplicationRecoveryServicesProvidersClientGetOptions)` to `(context.Context, string, string, string, string, *ReplicationRecoveryServicesProvidersClientGetOptions)` +- Function `*ReplicationRecoveryServicesProvidersClient.NewListByReplicationFabricsPager` parameter(s) have been changed from `(string, *ReplicationRecoveryServicesProvidersClientListByReplicationFabricsOptions)` to `(string, string, string, *ReplicationRecoveryServicesProvidersClientListByReplicationFabricsOptions)` +- Function `*ReplicationRecoveryServicesProvidersClient.NewListPager` parameter(s) have been changed from `(*ReplicationRecoveryServicesProvidersClientListOptions)` to `(string, string, *ReplicationRecoveryServicesProvidersClientListOptions)` +- Function `NewReplicationStorageClassificationMappingsClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationStorageClassificationMappingsClient.BeginCreate` parameter(s) have been changed from `(context.Context, string, string, string, StorageClassificationMappingInput, *ReplicationStorageClassificationMappingsClientBeginCreateOptions)` to `(context.Context, string, string, string, string, string, StorageClassificationMappingInput, *ReplicationStorageClassificationMappingsClientBeginCreateOptions)` +- Function `*ReplicationStorageClassificationMappingsClient.BeginDelete` parameter(s) have been changed from `(context.Context, string, string, string, *ReplicationStorageClassificationMappingsClientBeginDeleteOptions)` to `(context.Context, string, string, string, string, string, *ReplicationStorageClassificationMappingsClientBeginDeleteOptions)` +- Function `*ReplicationStorageClassificationMappingsClient.Get` parameter(s) have been changed from `(context.Context, string, string, string, *ReplicationStorageClassificationMappingsClientGetOptions)` to `(context.Context, string, string, string, string, string, *ReplicationStorageClassificationMappingsClientGetOptions)` +- Function `*ReplicationStorageClassificationMappingsClient.NewListByReplicationStorageClassificationsPager` parameter(s) have been changed from `(string, string, *ReplicationStorageClassificationMappingsClientListByReplicationStorageClassificationsOptions)` to `(string, string, string, string, *ReplicationStorageClassificationMappingsClientListByReplicationStorageClassificationsOptions)` +- Function `*ReplicationStorageClassificationMappingsClient.NewListPager` parameter(s) have been changed from `(*ReplicationStorageClassificationMappingsClientListOptions)` to `(string, string, *ReplicationStorageClassificationMappingsClientListOptions)` +- Function `NewReplicationStorageClassificationsClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationStorageClassificationsClient.Get` parameter(s) have been changed from `(context.Context, string, string, *ReplicationStorageClassificationsClientGetOptions)` to `(context.Context, string, string, string, string, *ReplicationStorageClassificationsClientGetOptions)` +- Function `*ReplicationStorageClassificationsClient.NewListByReplicationFabricsPager` parameter(s) have been changed from `(string, *ReplicationStorageClassificationsClientListByReplicationFabricsOptions)` to `(string, string, string, *ReplicationStorageClassificationsClientListByReplicationFabricsOptions)` +- Function `*ReplicationStorageClassificationsClient.NewListPager` parameter(s) have been changed from `(*ReplicationStorageClassificationsClientListOptions)` to `(string, string, *ReplicationStorageClassificationsClientListOptions)` +- Function `NewReplicationVaultHealthClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationVaultHealthClient.BeginRefresh` parameter(s) have been changed from `(context.Context, *ReplicationVaultHealthClientBeginRefreshOptions)` to `(context.Context, string, string, *ReplicationVaultHealthClientBeginRefreshOptions)` +- Function `*ReplicationVaultHealthClient.Get` parameter(s) have been changed from `(context.Context, *ReplicationVaultHealthClientGetOptions)` to `(context.Context, string, string, *ReplicationVaultHealthClientGetOptions)` +- Function `NewReplicationVaultSettingClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationVaultSettingClient.BeginCreate` parameter(s) have been changed from `(context.Context, string, VaultSettingCreationInput, *ReplicationVaultSettingClientBeginCreateOptions)` to `(context.Context, string, string, string, VaultSettingCreationInput, *ReplicationVaultSettingClientBeginCreateOptions)` +- Function `*ReplicationVaultSettingClient.Get` parameter(s) have been changed from `(context.Context, string, *ReplicationVaultSettingClientGetOptions)` to `(context.Context, string, string, string, *ReplicationVaultSettingClientGetOptions)` +- Function `*ReplicationVaultSettingClient.NewListPager` parameter(s) have been changed from `(*ReplicationVaultSettingClientListOptions)` to `(string, string, *ReplicationVaultSettingClientListOptions)` +- Function `NewReplicationvCentersClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*ReplicationvCentersClient.BeginCreate` parameter(s) have been changed from `(context.Context, string, string, AddVCenterRequest, *ReplicationvCentersClientBeginCreateOptions)` to `(context.Context, string, string, string, string, AddVCenterRequest, *ReplicationvCentersClientBeginCreateOptions)` +- Function `*ReplicationvCentersClient.BeginDelete` parameter(s) have been changed from `(context.Context, string, string, *ReplicationvCentersClientBeginDeleteOptions)` to `(context.Context, string, string, string, string, *ReplicationvCentersClientBeginDeleteOptions)` +- Function `*ReplicationvCentersClient.BeginUpdate` parameter(s) have been changed from `(context.Context, string, string, UpdateVCenterRequest, *ReplicationvCentersClientBeginUpdateOptions)` to `(context.Context, string, string, string, string, UpdateVCenterRequest, *ReplicationvCentersClientBeginUpdateOptions)` +- Function `*ReplicationvCentersClient.Get` parameter(s) have been changed from `(context.Context, string, string, *ReplicationvCentersClientGetOptions)` to `(context.Context, string, string, string, string, *ReplicationvCentersClientGetOptions)` +- Function `*ReplicationvCentersClient.NewListByReplicationFabricsPager` parameter(s) have been changed from `(string, *ReplicationvCentersClientListByReplicationFabricsOptions)` to `(string, string, string, *ReplicationvCentersClientListByReplicationFabricsOptions)` +- Function `*ReplicationvCentersClient.NewListPager` parameter(s) have been changed from `(*ReplicationvCentersClientListOptions)` to `(string, string, *ReplicationvCentersClientListOptions)` +- Function `NewSupportedOperatingSystemsClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*SupportedOperatingSystemsClient.Get` parameter(s) have been changed from `(context.Context, *SupportedOperatingSystemsClientGetOptions)` to `(context.Context, string, string, *SupportedOperatingSystemsClientGetOptions)` +- Function `NewTargetComputeSizesClient` parameter(s) have been changed from `(string, string, string, azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `*TargetComputeSizesClient.NewListByReplicationProtectedItemsPager` parameter(s) have been changed from `(string, string, string, *TargetComputeSizesClientListByReplicationProtectedItemsOptions)` to `(string, string, string, string, string, *TargetComputeSizesClientListByReplicationProtectedItemsOptions)` + +### Features Added + +- New struct `ClientFactory` which is a client factory used to create any client in this module + + ## 1.1.0 (2022-12-23) ### Features Added diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/README.md b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/README.md index 789ca07755fd..071e2e5e5e05 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/README.md +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/README.md @@ -33,12 +33,12 @@ 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). -## Clients +## Client Factory -Azure Recovery Services Site Recovery modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. +Azure Recovery Services Site Recovery module consists of one or more clients. We provide a client factory which could be used to create any client in this module. ```go -client, err := armrecoveryservicessiterecovery.NewReplicationAppliancesClient(, cred, nil) +clientFactory, err := armrecoveryservicessiterecovery.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). @@ -49,7 +49,15 @@ options := arm.ClientOptions { Cloud: cloud.AzureChina, }, } -client, err := armrecoveryservicessiterecovery.NewReplicationAppliancesClient(, cred, &options) +clientFactory, err := armrecoveryservicessiterecovery.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.NewReplicationAppliancesClient() ``` ## Provide Feedback diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/autorest.md b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/autorest.md index f49e0bd711bb..5c19e7dbe21a 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/autorest.md +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/autorest.md @@ -5,8 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/e99a45d498a1c7fadc18229ecba5d84a471a8771/specification/recoveryservicessiterecovery/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/e99a45d498a1c7fadc18229ecba5d84a471a8771/specification/recoveryservicessiterecovery/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.0 +module-version: 2.0.0 +tag: package-2022-10 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/client_factory.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/client_factory.go new file mode 100644 index 000000000000..8ca1ea665d02 --- /dev/null +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/client_factory.go @@ -0,0 +1,179 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armrecoveryservicessiterecovery + +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 + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// 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 subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationAlertSettingsClient() *ReplicationAlertSettingsClient { + subClient, _ := NewReplicationAlertSettingsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationAppliancesClient() *ReplicationAppliancesClient { + subClient, _ := NewReplicationAppliancesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationEligibilityResultsClient() *ReplicationEligibilityResultsClient { + subClient, _ := NewReplicationEligibilityResultsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationEventsClient() *ReplicationEventsClient { + subClient, _ := NewReplicationEventsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationFabricsClient() *ReplicationFabricsClient { + subClient, _ := NewReplicationFabricsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationLogicalNetworksClient() *ReplicationLogicalNetworksClient { + subClient, _ := NewReplicationLogicalNetworksClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationNetworksClient() *ReplicationNetworksClient { + subClient, _ := NewReplicationNetworksClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationNetworkMappingsClient() *ReplicationNetworkMappingsClient { + subClient, _ := NewReplicationNetworkMappingsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationProtectionContainersClient() *ReplicationProtectionContainersClient { + subClient, _ := NewReplicationProtectionContainersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationMigrationItemsClient() *ReplicationMigrationItemsClient { + subClient, _ := NewReplicationMigrationItemsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewMigrationRecoveryPointsClient() *MigrationRecoveryPointsClient { + subClient, _ := NewMigrationRecoveryPointsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationProtectableItemsClient() *ReplicationProtectableItemsClient { + subClient, _ := NewReplicationProtectableItemsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationProtectedItemsClient() *ReplicationProtectedItemsClient { + subClient, _ := NewReplicationProtectedItemsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewRecoveryPointsClient() *RecoveryPointsClient { + subClient, _ := NewRecoveryPointsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewTargetComputeSizesClient() *TargetComputeSizesClient { + subClient, _ := NewTargetComputeSizesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationProtectionContainerMappingsClient() *ReplicationProtectionContainerMappingsClient { + subClient, _ := NewReplicationProtectionContainerMappingsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationRecoveryServicesProvidersClient() *ReplicationRecoveryServicesProvidersClient { + subClient, _ := NewReplicationRecoveryServicesProvidersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationStorageClassificationsClient() *ReplicationStorageClassificationsClient { + subClient, _ := NewReplicationStorageClassificationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationStorageClassificationMappingsClient() *ReplicationStorageClassificationMappingsClient { + subClient, _ := NewReplicationStorageClassificationMappingsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationvCentersClient() *ReplicationvCentersClient { + subClient, _ := NewReplicationvCentersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationJobsClient() *ReplicationJobsClient { + subClient, _ := NewReplicationJobsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationPoliciesClient() *ReplicationPoliciesClient { + subClient, _ := NewReplicationPoliciesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationProtectionIntentsClient() *ReplicationProtectionIntentsClient { + subClient, _ := NewReplicationProtectionIntentsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationRecoveryPlansClient() *ReplicationRecoveryPlansClient { + subClient, _ := NewReplicationRecoveryPlansClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSupportedOperatingSystemsClient() *SupportedOperatingSystemsClient { + subClient, _ := NewSupportedOperatingSystemsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationVaultHealthClient() *ReplicationVaultHealthClient { + subClient, _ := NewReplicationVaultHealthClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicationVaultSettingClient() *ReplicationVaultSettingClient { + subClient, _ := NewReplicationVaultSettingClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/constants.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/constants.go index 539f18550091..7f7c2b5e086c 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/constants.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/constants.go @@ -11,7 +11,7 @@ package armrecoveryservicessiterecovery const ( moduleName = "armrecoveryservicessiterecovery" - moduleVersion = "v1.1.0" + moduleVersion = "v2.0.0" ) // A2ARecoveryAvailabilityType - The recovery availability type of the virtual machine. diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/go.mod b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/go.mod index 35bad8fb0f53..cc1afc87a2b0 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/go.mod +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/go.mod @@ -1,21 +1,21 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2 go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 // indirect - github.com/golang-jwt/jwt/v4 v4.4.2 // indirect - github.com/google/uuid v1.1.1 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect + github.com/golang-jwt/jwt/v4 v4.5.0 // indirect + github.com/google/uuid v1.3.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect - golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect - golang.org/x/text v0.3.7 // indirect + github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect + golang.org/x/crypto v0.6.0 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect ) diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/go.sum b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/go.sum index 8c0539b73123..8ba445a8c4da 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/go.sum +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/go.sum @@ -1,30 +1,31 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 h1:t/W5MYAuQy81cvM8VUNfRLzhtKpXhVUAN7Cd7KVbTyc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0/go.mod h1:NBanQUfSWiWn3QEpWDTCU0IjBECKOYvl2R8xdRtMtiM= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 h1:VgSJlZH5u0k2qxSpqyghcFQKmvYckj46uymKK5XzkBM= -github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0/go.mod h1:BDJ5qMFKx9DugEg3+uQSDCdbYPr5s9vBTrL9P8TpqOU= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= +github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs= -github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.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-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= +golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/migrationrecoverypoints_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/migrationrecoverypoints_client.go index fbb0984fc00b..362608a690d0 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/migrationrecoverypoints_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/migrationrecoverypoints_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,56 +24,44 @@ import ( // MigrationRecoveryPointsClient contains the methods for the MigrationRecoveryPoints group. // Don't use this type directly, use NewMigrationRecoveryPointsClient() instead. type MigrationRecoveryPointsClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewMigrationRecoveryPointsClient creates a new instance of MigrationRecoveryPointsClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewMigrationRecoveryPointsClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MigrationRecoveryPointsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewMigrationRecoveryPointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MigrationRecoveryPointsClient, error) { + cl, err := arm.NewClient(moduleName+".MigrationRecoveryPointsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &MigrationRecoveryPointsClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // Get - Gets a recovery point for a migration item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric unique name. -// protectionContainerName - Protection container name. -// migrationItemName - Migration item name. -// migrationRecoveryPointName - The migration recovery point name. -// options - MigrationRecoveryPointsClientGetOptions contains the optional parameters for the MigrationRecoveryPointsClient.Get -// method. -func (client *MigrationRecoveryPointsClient) Get(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, migrationRecoveryPointName string, options *MigrationRecoveryPointsClientGetOptions) (MigrationRecoveryPointsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, fabricName, protectionContainerName, migrationItemName, migrationRecoveryPointName, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric unique name. +// - protectionContainerName - Protection container name. +// - migrationItemName - Migration item name. +// - migrationRecoveryPointName - The migration recovery point name. +// - options - MigrationRecoveryPointsClientGetOptions contains the optional parameters for the MigrationRecoveryPointsClient.Get +// method. +func (client *MigrationRecoveryPointsClient) Get(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, migrationRecoveryPointName string, options *MigrationRecoveryPointsClientGetOptions) (MigrationRecoveryPointsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, migrationItemName, migrationRecoveryPointName, options) if err != nil { return MigrationRecoveryPointsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return MigrationRecoveryPointsClientGetResponse{}, err } @@ -86,16 +72,16 @@ func (client *MigrationRecoveryPointsClient) Get(ctx context.Context, fabricName } // getCreateRequest creates the Get request. -func (client *MigrationRecoveryPointsClient) getCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, migrationRecoveryPointName string, options *MigrationRecoveryPointsClientGetOptions) (*policy.Request, error) { +func (client *MigrationRecoveryPointsClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, migrationRecoveryPointName string, options *MigrationRecoveryPointsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints/{migrationRecoveryPointName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -116,7 +102,7 @@ func (client *MigrationRecoveryPointsClient) getCreateRequest(ctx context.Contex return nil, errors.New("parameter migrationRecoveryPointName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{migrationRecoveryPointName}", url.PathEscape(migrationRecoveryPointName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -137,13 +123,16 @@ func (client *MigrationRecoveryPointsClient) getHandleResponse(resp *http.Respon } // NewListByReplicationMigrationItemsPager - Gets the recovery points for a migration item. +// // Generated from API version 2022-10-01 -// fabricName - Fabric unique name. -// protectionContainerName - Protection container name. -// migrationItemName - Migration item name. -// options - MigrationRecoveryPointsClientListByReplicationMigrationItemsOptions contains the optional parameters for the -// MigrationRecoveryPointsClient.ListByReplicationMigrationItems method. -func (client *MigrationRecoveryPointsClient) NewListByReplicationMigrationItemsPager(fabricName string, protectionContainerName string, migrationItemName string, options *MigrationRecoveryPointsClientListByReplicationMigrationItemsOptions) *runtime.Pager[MigrationRecoveryPointsClientListByReplicationMigrationItemsResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric unique name. +// - protectionContainerName - Protection container name. +// - migrationItemName - Migration item name. +// - options - MigrationRecoveryPointsClientListByReplicationMigrationItemsOptions contains the optional parameters for the +// MigrationRecoveryPointsClient.NewListByReplicationMigrationItemsPager method. +func (client *MigrationRecoveryPointsClient) NewListByReplicationMigrationItemsPager(resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, options *MigrationRecoveryPointsClientListByReplicationMigrationItemsOptions) *runtime.Pager[MigrationRecoveryPointsClientListByReplicationMigrationItemsResponse] { return runtime.NewPager(runtime.PagingHandler[MigrationRecoveryPointsClientListByReplicationMigrationItemsResponse]{ More: func(page MigrationRecoveryPointsClientListByReplicationMigrationItemsResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -152,14 +141,14 @@ func (client *MigrationRecoveryPointsClient) NewListByReplicationMigrationItemsP var req *policy.Request var err error if page == nil { - req, err = client.listByReplicationMigrationItemsCreateRequest(ctx, fabricName, protectionContainerName, migrationItemName, options) + req, err = client.listByReplicationMigrationItemsCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, migrationItemName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return MigrationRecoveryPointsClientListByReplicationMigrationItemsResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return MigrationRecoveryPointsClientListByReplicationMigrationItemsResponse{}, err } @@ -172,16 +161,16 @@ func (client *MigrationRecoveryPointsClient) NewListByReplicationMigrationItemsP } // listByReplicationMigrationItemsCreateRequest creates the ListByReplicationMigrationItems request. -func (client *MigrationRecoveryPointsClient) listByReplicationMigrationItemsCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, options *MigrationRecoveryPointsClientListByReplicationMigrationItemsOptions) (*policy.Request, error) { +func (client *MigrationRecoveryPointsClient) listByReplicationMigrationItemsCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, options *MigrationRecoveryPointsClientListByReplicationMigrationItemsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -198,7 +187,7 @@ func (client *MigrationRecoveryPointsClient) listByReplicationMigrationItemsCrea return nil, errors.New("parameter migrationItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{migrationItemName}", url.PathEscape(migrationItemName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/migrationrecoverypoints_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/migrationrecoverypoints_client_example_test.go index faaae2fee053..d6e6910eb942 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/migrationrecoverypoints_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/migrationrecoverypoints_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -13,48 +14,80 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/MigrationRecoveryPoints_ListByReplicationMigrationItems.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/MigrationRecoveryPoints_ListByReplicationMigrationItems.json func ExampleMigrationRecoveryPointsClient_NewListByReplicationMigrationItemsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewMigrationRecoveryPointsClient("migrationvault", "resourcegroup1", "cb53d0c3-bd59-4721-89bc-06916a9147ef", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByReplicationMigrationItemsPager("vmwarefabric1", "vmwareContainer1", "virtualmachine1", nil) + pager := clientFactory.NewMigrationRecoveryPointsClient().NewListByReplicationMigrationItemsPager("migrationvault", "resourcegroup1", "vmwarefabric1", "vmwareContainer1", "virtualmachine1", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.MigrationRecoveryPointCollection = armrecoveryservicessiterecovery.MigrationRecoveryPointCollection{ + // Value: []*armrecoveryservicessiterecovery.MigrationRecoveryPoint{ + // { + // Name: to.Ptr("648336ef-2d70-4d98-b100-8c299f97cd41"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationMigrationItems/migrationRecoveryPoints"), + // ID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationFabrics/vmwarefabric1/replicationProtectionContainers/vmwareContainer1/replicationMigrationItems/virtualmachine1/migrationRecoveryPoints/648336ef-2d70-4d98-b100-8c299f97cd41"), + // Properties: &armrecoveryservicessiterecovery.MigrationRecoveryPointProperties{ + // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T06:37:50.8082715Z"); return t}()), + // RecoveryPointType: to.Ptr(armrecoveryservicessiterecovery.MigrationRecoveryPointTypeCrashConsistent), + // }, + // }, + // { + // Name: to.Ptr("34cb2d05-e730-4d3f-b96b-a60a5e92acb2"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationMigrationItems/migrationRecoveryPoints"), + // ID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationFabrics/vmwarefabric1/replicationProtectionContainers/vmwareContainer1/replicationMigrationItems/virtualmachine1/migrationRecoveryPoints/34cb2d05-e730-4d3f-b96b-a60a5e92acb2"), + // Properties: &armrecoveryservicessiterecovery.MigrationRecoveryPointProperties{ + // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T07:37:30.9722019Z"); return t}()), + // RecoveryPointType: to.Ptr(armrecoveryservicessiterecovery.MigrationRecoveryPointTypeCrashConsistent), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/MigrationRecoveryPoints_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/MigrationRecoveryPoints_Get.json func ExampleMigrationRecoveryPointsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewMigrationRecoveryPointsClient("migrationvault", "resourcegroup1", "cb53d0c3-bd59-4721-89bc-06916a9147ef", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "vmwarefabric1", "vmwareContainer1", "virtualmachine1", "b22134ea-620c-474b-9fa5-3c1cb47708e3", nil) + res, err := clientFactory.NewMigrationRecoveryPointsClient().Get(ctx, "migrationvault", "resourcegroup1", "vmwarefabric1", "vmwareContainer1", "virtualmachine1", "b22134ea-620c-474b-9fa5-3c1cb47708e3", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.MigrationRecoveryPoint = armrecoveryservicessiterecovery.MigrationRecoveryPoint{ + // Name: to.Ptr("b22134ea-620c-474b-9fa5-3c1cb47708e3"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationMigrationItems/migrationRecoveryPoints"), + // ID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationFabrics/vmwarefabric1/replicationProtectionContainers/vmwareContainer1/replicationMigrationItems/virtualmachine1/migrationRecoveryPoints/b22134ea-620c-474b-9fa5-3c1cb47708e3"), + // Properties: &armrecoveryservicessiterecovery.MigrationRecoveryPointProperties{ + // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T06:37:50.8082715Z"); return t}()), + // RecoveryPointType: to.Ptr(armrecoveryservicessiterecovery.MigrationRecoveryPointTypeCrashConsistent), + // }, + // } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/models.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/models.go index ef27a9467567..8e57d9927861 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/models.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/models.go @@ -7110,7 +7110,7 @@ type MigrationRecoveryPointsClientGetOptions struct { // placeholder for future optional parameters } -// MigrationRecoveryPointsClientListByReplicationMigrationItemsOptions contains the optional parameters for the MigrationRecoveryPointsClient.ListByReplicationMigrationItems +// MigrationRecoveryPointsClientListByReplicationMigrationItemsOptions contains the optional parameters for the MigrationRecoveryPointsClient.NewListByReplicationMigrationItemsPager // method. type MigrationRecoveryPointsClientListByReplicationMigrationItemsOptions struct { // placeholder for future optional parameters @@ -7345,7 +7345,7 @@ type OSVersionWrapper struct { Version *string `json:"version,omitempty"` } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters } @@ -7375,7 +7375,7 @@ type OperationsDiscovery struct { Origin *string `json:"origin,omitempty"` // Properties. Reserved for future use. - Properties interface{} `json:"properties,omitempty"` + Properties any `json:"properties,omitempty"` } // OperationsDiscoveryCollection - Collection of ClientDiscovery details. @@ -8731,7 +8731,7 @@ type RecoveryPointsClientGetOptions struct { // placeholder for future optional parameters } -// RecoveryPointsClientListByReplicationProtectedItemsOptions contains the optional parameters for the RecoveryPointsClient.ListByReplicationProtectedItems +// RecoveryPointsClientListByReplicationProtectedItemsOptions contains the optional parameters for the RecoveryPointsClient.NewListByReplicationProtectedItemsPager // method. type RecoveryPointsClientListByReplicationProtectedItemsOptions struct { // placeholder for future optional parameters @@ -8989,7 +8989,7 @@ type ReplicationAlertSettingsClientGetOptions struct { // placeholder for future optional parameters } -// ReplicationAlertSettingsClientListOptions contains the optional parameters for the ReplicationAlertSettingsClient.List +// ReplicationAlertSettingsClientListOptions contains the optional parameters for the ReplicationAlertSettingsClient.NewListPager // method. type ReplicationAlertSettingsClientListOptions struct { // placeholder for future optional parameters @@ -9007,7 +9007,8 @@ type ReplicationApplianceProperties struct { ProviderSpecificDetails ApplianceSpecificDetailsClassification `json:"providerSpecificDetails,omitempty"` } -// ReplicationAppliancesClientListOptions contains the optional parameters for the ReplicationAppliancesClient.List method. +// ReplicationAppliancesClientListOptions contains the optional parameters for the ReplicationAppliancesClient.NewListPager +// method. type ReplicationAppliancesClientListOptions struct { // OData filter options. Filter *string @@ -9078,7 +9079,7 @@ type ReplicationEventsClientGetOptions struct { // placeholder for future optional parameters } -// ReplicationEventsClientListOptions contains the optional parameters for the ReplicationEventsClient.List method. +// ReplicationEventsClientListOptions contains the optional parameters for the ReplicationEventsClient.NewListPager method. type ReplicationEventsClientListOptions struct { // OData filter options. Filter *string @@ -9139,7 +9140,7 @@ type ReplicationFabricsClientGetOptions struct { Filter *string } -// ReplicationFabricsClientListOptions contains the optional parameters for the ReplicationFabricsClient.List method. +// ReplicationFabricsClientListOptions contains the optional parameters for the ReplicationFabricsClient.NewListPager method. type ReplicationFabricsClientListOptions struct { // placeholder for future optional parameters } @@ -9186,7 +9187,7 @@ type ReplicationJobsClientGetOptions struct { // placeholder for future optional parameters } -// ReplicationJobsClientListOptions contains the optional parameters for the ReplicationJobsClient.List method. +// ReplicationJobsClientListOptions contains the optional parameters for the ReplicationJobsClient.NewListPager method. type ReplicationJobsClientListOptions struct { // OData filter options. Filter *string @@ -9198,7 +9199,7 @@ type ReplicationLogicalNetworksClientGetOptions struct { // placeholder for future optional parameters } -// ReplicationLogicalNetworksClientListByReplicationFabricsOptions contains the optional parameters for the ReplicationLogicalNetworksClient.ListByReplicationFabrics +// ReplicationLogicalNetworksClientListByReplicationFabricsOptions contains the optional parameters for the ReplicationLogicalNetworksClient.NewListByReplicationFabricsPager // method. type ReplicationLogicalNetworksClientListByReplicationFabricsOptions struct { // placeholder for future optional parameters @@ -9275,7 +9276,7 @@ type ReplicationMigrationItemsClientGetOptions struct { // placeholder for future optional parameters } -// ReplicationMigrationItemsClientListByReplicationProtectionContainersOptions contains the optional parameters for the ReplicationMigrationItemsClient.ListByReplicationProtectionContainers +// ReplicationMigrationItemsClientListByReplicationProtectionContainersOptions contains the optional parameters for the ReplicationMigrationItemsClient.NewListByReplicationProtectionContainersPager // method. type ReplicationMigrationItemsClientListByReplicationProtectionContainersOptions struct { // OData filter options. @@ -9286,7 +9287,7 @@ type ReplicationMigrationItemsClientListByReplicationProtectionContainersOptions TakeToken *string } -// ReplicationMigrationItemsClientListOptions contains the optional parameters for the ReplicationMigrationItemsClient.List +// ReplicationMigrationItemsClientListOptions contains the optional parameters for the ReplicationMigrationItemsClient.NewListPager // method. type ReplicationMigrationItemsClientListOptions struct { // OData filter options. @@ -9324,13 +9325,13 @@ type ReplicationNetworkMappingsClientGetOptions struct { // placeholder for future optional parameters } -// ReplicationNetworkMappingsClientListByReplicationNetworksOptions contains the optional parameters for the ReplicationNetworkMappingsClient.ListByReplicationNetworks +// ReplicationNetworkMappingsClientListByReplicationNetworksOptions contains the optional parameters for the ReplicationNetworkMappingsClient.NewListByReplicationNetworksPager // method. type ReplicationNetworkMappingsClientListByReplicationNetworksOptions struct { // placeholder for future optional parameters } -// ReplicationNetworkMappingsClientListOptions contains the optional parameters for the ReplicationNetworkMappingsClient.List +// ReplicationNetworkMappingsClientListOptions contains the optional parameters for the ReplicationNetworkMappingsClient.NewListPager // method. type ReplicationNetworkMappingsClientListOptions struct { // placeholder for future optional parameters @@ -9341,13 +9342,13 @@ type ReplicationNetworksClientGetOptions struct { // placeholder for future optional parameters } -// ReplicationNetworksClientListByReplicationFabricsOptions contains the optional parameters for the ReplicationNetworksClient.ListByReplicationFabrics +// ReplicationNetworksClientListByReplicationFabricsOptions contains the optional parameters for the ReplicationNetworksClient.NewListByReplicationFabricsPager // method. type ReplicationNetworksClientListByReplicationFabricsOptions struct { // placeholder for future optional parameters } -// ReplicationNetworksClientListOptions contains the optional parameters for the ReplicationNetworksClient.List method. +// ReplicationNetworksClientListOptions contains the optional parameters for the ReplicationNetworksClient.NewListPager method. type ReplicationNetworksClientListOptions struct { // placeholder for future optional parameters } @@ -9378,7 +9379,7 @@ type ReplicationPoliciesClientGetOptions struct { // placeholder for future optional parameters } -// ReplicationPoliciesClientListOptions contains the optional parameters for the ReplicationPoliciesClient.List method. +// ReplicationPoliciesClientListOptions contains the optional parameters for the ReplicationPoliciesClient.NewListPager method. type ReplicationPoliciesClientListOptions struct { // placeholder for future optional parameters } @@ -9390,7 +9391,7 @@ type ReplicationProtectableItemsClientGetOptions struct { } // ReplicationProtectableItemsClientListByReplicationProtectionContainersOptions contains the optional parameters for the -// ReplicationProtectableItemsClient.ListByReplicationProtectionContainers method. +// ReplicationProtectableItemsClient.NewListByReplicationProtectionContainersPager method. type ReplicationProtectableItemsClientListByReplicationProtectionContainersOptions struct { // OData filter options. Filter *string @@ -9661,13 +9662,13 @@ type ReplicationProtectedItemsClientGetOptions struct { // placeholder for future optional parameters } -// ReplicationProtectedItemsClientListByReplicationProtectionContainersOptions contains the optional parameters for the ReplicationProtectedItemsClient.ListByReplicationProtectionContainers +// ReplicationProtectedItemsClientListByReplicationProtectionContainersOptions contains the optional parameters for the ReplicationProtectedItemsClient.NewListByReplicationProtectionContainersPager // method. type ReplicationProtectedItemsClientListByReplicationProtectionContainersOptions struct { // placeholder for future optional parameters } -// ReplicationProtectedItemsClientListOptions contains the optional parameters for the ReplicationProtectedItemsClient.List +// ReplicationProtectedItemsClientListOptions contains the optional parameters for the ReplicationProtectedItemsClient.NewListPager // method. type ReplicationProtectedItemsClientListOptions struct { // OData filter options. @@ -9711,12 +9712,12 @@ type ReplicationProtectionContainerMappingsClientGetOptions struct { } // ReplicationProtectionContainerMappingsClientListByReplicationProtectionContainersOptions contains the optional parameters -// for the ReplicationProtectionContainerMappingsClient.ListByReplicationProtectionContainers method. +// for the ReplicationProtectionContainerMappingsClient.NewListByReplicationProtectionContainersPager method. type ReplicationProtectionContainerMappingsClientListByReplicationProtectionContainersOptions struct { // placeholder for future optional parameters } -// ReplicationProtectionContainerMappingsClientListOptions contains the optional parameters for the ReplicationProtectionContainerMappingsClient.List +// ReplicationProtectionContainerMappingsClientListOptions contains the optional parameters for the ReplicationProtectionContainerMappingsClient.NewListPager // method. type ReplicationProtectionContainerMappingsClientListOptions struct { // placeholder for future optional parameters @@ -9756,13 +9757,13 @@ type ReplicationProtectionContainersClientGetOptions struct { // placeholder for future optional parameters } -// ReplicationProtectionContainersClientListByReplicationFabricsOptions contains the optional parameters for the ReplicationProtectionContainersClient.ListByReplicationFabrics +// ReplicationProtectionContainersClientListByReplicationFabricsOptions contains the optional parameters for the ReplicationProtectionContainersClient.NewListByReplicationFabricsPager // method. type ReplicationProtectionContainersClientListByReplicationFabricsOptions struct { // placeholder for future optional parameters } -// ReplicationProtectionContainersClientListOptions contains the optional parameters for the ReplicationProtectionContainersClient.List +// ReplicationProtectionContainersClientListOptions contains the optional parameters for the ReplicationProtectionContainersClient.NewListPager // method. type ReplicationProtectionContainersClientListOptions struct { // placeholder for future optional parameters @@ -9849,7 +9850,7 @@ type ReplicationProtectionIntentsClientGetOptions struct { // placeholder for future optional parameters } -// ReplicationProtectionIntentsClientListOptions contains the optional parameters for the ReplicationProtectionIntentsClient.List +// ReplicationProtectionIntentsClientListOptions contains the optional parameters for the ReplicationProtectionIntentsClient.NewListPager // method. type ReplicationProtectionIntentsClientListOptions struct { // The pagination token. @@ -10026,7 +10027,7 @@ type ReplicationRecoveryPlansClientGetOptions struct { // placeholder for future optional parameters } -// ReplicationRecoveryPlansClientListOptions contains the optional parameters for the ReplicationRecoveryPlansClient.List +// ReplicationRecoveryPlansClientListOptions contains the optional parameters for the ReplicationRecoveryPlansClient.NewListPager // method. type ReplicationRecoveryPlansClientListOptions struct { // placeholder for future optional parameters @@ -10066,13 +10067,13 @@ type ReplicationRecoveryServicesProvidersClientGetOptions struct { // placeholder for future optional parameters } -// ReplicationRecoveryServicesProvidersClientListByReplicationFabricsOptions contains the optional parameters for the ReplicationRecoveryServicesProvidersClient.ListByReplicationFabrics +// ReplicationRecoveryServicesProvidersClientListByReplicationFabricsOptions contains the optional parameters for the ReplicationRecoveryServicesProvidersClient.NewListByReplicationFabricsPager // method. type ReplicationRecoveryServicesProvidersClientListByReplicationFabricsOptions struct { // placeholder for future optional parameters } -// ReplicationRecoveryServicesProvidersClientListOptions contains the optional parameters for the ReplicationRecoveryServicesProvidersClient.List +// ReplicationRecoveryServicesProvidersClientListOptions contains the optional parameters for the ReplicationRecoveryServicesProvidersClient.NewListPager // method. type ReplicationRecoveryServicesProvidersClientListOptions struct { // placeholder for future optional parameters @@ -10099,12 +10100,12 @@ type ReplicationStorageClassificationMappingsClientGetOptions struct { } // ReplicationStorageClassificationMappingsClientListByReplicationStorageClassificationsOptions contains the optional parameters -// for the ReplicationStorageClassificationMappingsClient.ListByReplicationStorageClassifications method. +// for the ReplicationStorageClassificationMappingsClient.NewListByReplicationStorageClassificationsPager method. type ReplicationStorageClassificationMappingsClientListByReplicationStorageClassificationsOptions struct { // placeholder for future optional parameters } -// ReplicationStorageClassificationMappingsClientListOptions contains the optional parameters for the ReplicationStorageClassificationMappingsClient.List +// ReplicationStorageClassificationMappingsClientListOptions contains the optional parameters for the ReplicationStorageClassificationMappingsClient.NewListPager // method. type ReplicationStorageClassificationMappingsClientListOptions struct { // placeholder for future optional parameters @@ -10116,13 +10117,13 @@ type ReplicationStorageClassificationsClientGetOptions struct { // placeholder for future optional parameters } -// ReplicationStorageClassificationsClientListByReplicationFabricsOptions contains the optional parameters for the ReplicationStorageClassificationsClient.ListByReplicationFabrics +// ReplicationStorageClassificationsClientListByReplicationFabricsOptions contains the optional parameters for the ReplicationStorageClassificationsClient.NewListByReplicationFabricsPager // method. type ReplicationStorageClassificationsClientListByReplicationFabricsOptions struct { // placeholder for future optional parameters } -// ReplicationStorageClassificationsClientListOptions contains the optional parameters for the ReplicationStorageClassificationsClient.List +// ReplicationStorageClassificationsClientListOptions contains the optional parameters for the ReplicationStorageClassificationsClient.NewListPager // method. type ReplicationStorageClassificationsClientListOptions struct { // placeholder for future optional parameters @@ -10152,7 +10153,8 @@ type ReplicationVaultSettingClientGetOptions struct { // placeholder for future optional parameters } -// ReplicationVaultSettingClientListOptions contains the optional parameters for the ReplicationVaultSettingClient.List method. +// ReplicationVaultSettingClientListOptions contains the optional parameters for the ReplicationVaultSettingClient.NewListPager +// method. type ReplicationVaultSettingClientListOptions struct { // placeholder for future optional parameters } @@ -10183,13 +10185,13 @@ type ReplicationvCentersClientGetOptions struct { // placeholder for future optional parameters } -// ReplicationvCentersClientListByReplicationFabricsOptions contains the optional parameters for the ReplicationvCentersClient.ListByReplicationFabrics +// ReplicationvCentersClientListByReplicationFabricsOptions contains the optional parameters for the ReplicationvCentersClient.NewListByReplicationFabricsPager // method. type ReplicationvCentersClientListByReplicationFabricsOptions struct { // placeholder for future optional parameters } -// ReplicationvCentersClientListOptions contains the optional parameters for the ReplicationvCentersClient.List method. +// ReplicationvCentersClientListOptions contains the optional parameters for the ReplicationvCentersClient.NewListPager method. type ReplicationvCentersClientListOptions struct { // placeholder for future optional parameters } @@ -10791,7 +10793,7 @@ type TargetComputeSizeProperties struct { VCPUsAvailable *int32 `json:"vCPUsAvailable,omitempty" azure:"ro"` } -// TargetComputeSizesClientListByReplicationProtectedItemsOptions contains the optional parameters for the TargetComputeSizesClient.ListByReplicationProtectedItems +// TargetComputeSizesClientListByReplicationProtectedItemsOptions contains the optional parameters for the TargetComputeSizesClient.NewListByReplicationProtectedItemsPager // method. type TargetComputeSizesClientListByReplicationProtectedItemsOptions struct { // placeholder for future optional parameters diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/models_serde.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/models_serde.go index 9425a47528d6..8b1d2af07b20 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/models_serde.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/models_serde.go @@ -18,7 +18,7 @@ import ( // MarshalJSON implements the json.Marshaller interface for type A2AAddDisksInput. func (a A2AAddDisksInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "A2A" populate(objectMap, "vmDisks", a.VMDisks) populate(objectMap, "vmManagedDisks", a.VMManagedDisks) @@ -53,7 +53,7 @@ func (a *A2AAddDisksInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2AApplyRecoveryPointInput. func (a A2AApplyRecoveryPointInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "A2A" return json.Marshal(objectMap) } @@ -80,7 +80,7 @@ func (a *A2AApplyRecoveryPointInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2AContainerCreationInput. func (a A2AContainerCreationInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "A2A" return json.Marshal(objectMap) } @@ -107,7 +107,7 @@ func (a *A2AContainerCreationInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2AContainerMappingInput. func (a A2AContainerMappingInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "agentAutoUpdateStatus", a.AgentAutoUpdateStatus) populate(objectMap, "automationAccountArmId", a.AutomationAccountArmID) populate(objectMap, "automationAccountAuthenticationType", a.AutomationAccountAuthenticationType) @@ -146,7 +146,7 @@ func (a *A2AContainerMappingInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2ACreateProtectionIntentInput. func (a A2ACreateProtectionIntentInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "agentAutoUpdateStatus", a.AgentAutoUpdateStatus) populate(objectMap, "autoProtectionOfDataDisk", a.AutoProtectionOfDataDisk) populate(objectMap, "automationAccountArmId", a.AutomationAccountArmID) @@ -261,7 +261,7 @@ func (a *A2ACreateProtectionIntentInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2ACrossClusterMigrationApplyRecoveryPointInput. func (a A2ACrossClusterMigrationApplyRecoveryPointInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "A2ACrossClusterMigration" return json.Marshal(objectMap) } @@ -288,7 +288,7 @@ func (a *A2ACrossClusterMigrationApplyRecoveryPointInput) UnmarshalJSON(data []b // MarshalJSON implements the json.Marshaller interface for type A2ACrossClusterMigrationContainerCreationInput. func (a A2ACrossClusterMigrationContainerCreationInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "A2ACrossClusterMigration" return json.Marshal(objectMap) } @@ -315,7 +315,7 @@ func (a *A2ACrossClusterMigrationContainerCreationInput) UnmarshalJSON(data []by // MarshalJSON implements the json.Marshaller interface for type A2ACrossClusterMigrationEnableProtectionInput. func (a A2ACrossClusterMigrationEnableProtectionInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "fabricObjectId", a.FabricObjectID) objectMap["instanceType"] = "A2ACrossClusterMigration" populate(objectMap, "recoveryContainerId", a.RecoveryContainerID) @@ -350,7 +350,7 @@ func (a *A2ACrossClusterMigrationEnableProtectionInput) UnmarshalJSON(data []byt // MarshalJSON implements the json.Marshaller interface for type A2ACrossClusterMigrationPolicyCreationInput. func (a A2ACrossClusterMigrationPolicyCreationInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "A2ACrossClusterMigration" return json.Marshal(objectMap) } @@ -377,7 +377,7 @@ func (a *A2ACrossClusterMigrationPolicyCreationInput) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type A2ACrossClusterMigrationReplicationDetails. func (a A2ACrossClusterMigrationReplicationDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "fabricObjectId", a.FabricObjectID) objectMap["instanceType"] = "A2ACrossClusterMigration" populate(objectMap, "lifecycleId", a.LifecycleID) @@ -428,7 +428,7 @@ func (a *A2ACrossClusterMigrationReplicationDetails) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type A2AEnableProtectionInput. func (a A2AEnableProtectionInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskEncryptionInfo", a.DiskEncryptionInfo) populate(objectMap, "fabricObjectId", a.FabricObjectID) objectMap["instanceType"] = "A2A" @@ -527,7 +527,7 @@ func (a *A2AEnableProtectionInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2AEventDetails. func (a A2AEventDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "fabricLocation", a.FabricLocation) populate(objectMap, "fabricName", a.FabricName) populate(objectMap, "fabricObjectId", a.FabricObjectID) @@ -578,7 +578,7 @@ func (a *A2AEventDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2AExtendedLocationDetails. func (a A2AExtendedLocationDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "primaryExtendedLocation", a.PrimaryExtendedLocation) populate(objectMap, "recoveryExtendedLocation", a.RecoveryExtendedLocation) return json.Marshal(objectMap) @@ -609,7 +609,7 @@ func (a *A2AExtendedLocationDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2APolicyCreationInput. func (a A2APolicyCreationInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "appConsistentFrequencyInMinutes", a.AppConsistentFrequencyInMinutes) populate(objectMap, "crashConsistentFrequencyInMinutes", a.CrashConsistentFrequencyInMinutes) objectMap["instanceType"] = "A2A" @@ -652,7 +652,7 @@ func (a *A2APolicyCreationInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2APolicyDetails. func (a A2APolicyDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "appConsistentFrequencyInMinutes", a.AppConsistentFrequencyInMinutes) populate(objectMap, "crashConsistentFrequencyInMinutes", a.CrashConsistentFrequencyInMinutes) objectMap["instanceType"] = "A2A" @@ -699,7 +699,7 @@ func (a *A2APolicyDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2AProtectedDiskDetails. func (a A2AProtectedDiskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "allowedDiskLevelOperation", a.AllowedDiskLevelOperation) populate(objectMap, "dataPendingAtSourceAgentInMB", a.DataPendingAtSourceAgentInMB) populate(objectMap, "dataPendingInStagingStorageAccountInMB", a.DataPendingInStagingStorageAccountInMB) @@ -814,7 +814,7 @@ func (a *A2AProtectedDiskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2AProtectedManagedDiskDetails. func (a A2AProtectedManagedDiskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "allowedDiskLevelOperation", a.AllowedDiskLevelOperation) populate(objectMap, "dataPendingAtSourceAgentInMB", a.DataPendingAtSourceAgentInMB) populate(objectMap, "dataPendingInStagingStorageAccountInMB", a.DataPendingInStagingStorageAccountInMB) @@ -949,7 +949,7 @@ func (a *A2AProtectedManagedDiskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2AProtectionContainerMappingDetails. func (a A2AProtectionContainerMappingDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "agentAutoUpdateStatus", a.AgentAutoUpdateStatus) populate(objectMap, "automationAccountArmId", a.AutomationAccountArmID) populate(objectMap, "automationAccountAuthenticationType", a.AutomationAccountAuthenticationType) @@ -996,7 +996,7 @@ func (a *A2AProtectionContainerMappingDetails) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type A2AProtectionIntentDiskInputDetails. func (a A2AProtectionIntentDiskInputDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskUri", a.DiskURI) populate(objectMap, "primaryStagingStorageAccountCustomInput", a.PrimaryStagingStorageAccountCustomInput) populate(objectMap, "recoveryAzureStorageAccountCustomInput", a.RecoveryAzureStorageAccountCustomInput) @@ -1031,7 +1031,7 @@ func (a *A2AProtectionIntentDiskInputDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2AProtectionIntentManagedDiskInputDetails. func (a A2AProtectionIntentManagedDiskInputDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskEncryptionInfo", a.DiskEncryptionInfo) populate(objectMap, "diskId", a.DiskID) populate(objectMap, "primaryStagingStorageAccountCustomInput", a.PrimaryStagingStorageAccountCustomInput) @@ -1082,7 +1082,7 @@ func (a *A2AProtectionIntentManagedDiskInputDetails) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type A2ARecoveryPointDetails. func (a A2ARecoveryPointDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "disks", a.Disks) objectMap["instanceType"] = "A2A" populate(objectMap, "recoveryPointSyncType", a.RecoveryPointSyncType) @@ -1117,7 +1117,7 @@ func (a *A2ARecoveryPointDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2ARemoveDisksInput. func (a A2ARemoveDisksInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "A2A" populate(objectMap, "vmDisksUris", a.VMDisksUris) populate(objectMap, "vmManagedDisksIds", a.VMManagedDisksIDs) @@ -1152,7 +1152,7 @@ func (a *A2ARemoveDisksInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2AReplicationDetails. func (a A2AReplicationDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "agentCertificateExpiryDate", a.AgentCertificateExpiryDate) populateTimeRFC3339(objectMap, "agentExpiryDate", a.AgentExpiryDate) populate(objectMap, "agentVersion", a.AgentVersion) @@ -1391,7 +1391,7 @@ func (a *A2AReplicationDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2AReplicationIntentDetails. func (a A2AReplicationIntentDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "agentAutoUpdateStatus", a.AgentAutoUpdateStatus) populate(objectMap, "autoProtectionOfDataDisk", a.AutoProtectionOfDataDisk) populate(objectMap, "automationAccountArmId", a.AutomationAccountArmID) @@ -1506,7 +1506,7 @@ func (a *A2AReplicationIntentDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2AReprotectInput. func (a A2AReprotectInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "A2A" populate(objectMap, "policyId", a.PolicyID) populate(objectMap, "recoveryAvailabilitySetId", a.RecoveryAvailabilitySetID) @@ -1557,7 +1557,7 @@ func (a *A2AReprotectInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2ASwitchProtectionInput. func (a A2ASwitchProtectionInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskEncryptionInfo", a.DiskEncryptionInfo) objectMap["instanceType"] = "A2A" populate(objectMap, "policyId", a.PolicyID) @@ -1636,7 +1636,7 @@ func (a *A2ASwitchProtectionInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2ATestFailoverInput. func (a A2ATestFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "cloudServiceCreationOption", a.CloudServiceCreationOption) objectMap["instanceType"] = "A2A" populate(objectMap, "recoveryPointId", a.RecoveryPointID) @@ -1671,7 +1671,7 @@ func (a *A2ATestFailoverInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2AUnplannedFailoverInput. func (a A2AUnplannedFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "cloudServiceCreationOption", a.CloudServiceCreationOption) objectMap["instanceType"] = "A2A" populate(objectMap, "recoveryPointId", a.RecoveryPointID) @@ -1706,7 +1706,7 @@ func (a *A2AUnplannedFailoverInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2AUnprotectedDiskDetails. func (a A2AUnprotectedDiskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskAutoProtectionStatus", a.DiskAutoProtectionStatus) populate(objectMap, "diskLunId", a.DiskLunID) return json.Marshal(objectMap) @@ -1737,7 +1737,7 @@ func (a *A2AUnprotectedDiskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2AUpdateContainerMappingInput. func (a A2AUpdateContainerMappingInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "agentAutoUpdateStatus", a.AgentAutoUpdateStatus) populate(objectMap, "automationAccountArmId", a.AutomationAccountArmID) populate(objectMap, "automationAccountAuthenticationType", a.AutomationAccountAuthenticationType) @@ -1776,7 +1776,7 @@ func (a *A2AUpdateContainerMappingInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2AUpdateReplicationProtectedItemInput. func (a A2AUpdateReplicationProtectedItemInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskEncryptionInfo", a.DiskEncryptionInfo) objectMap["instanceType"] = "A2A" populate(objectMap, "managedDiskUpdateDetails", a.ManagedDiskUpdateDetails) @@ -1839,7 +1839,7 @@ func (a *A2AUpdateReplicationProtectedItemInput) UnmarshalJSON(data []byte) erro // MarshalJSON implements the json.Marshaller interface for type A2AVMDiskInputDetails. func (a A2AVMDiskInputDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskUri", a.DiskURI) populate(objectMap, "primaryStagingAzureStorageAccountId", a.PrimaryStagingAzureStorageAccountID) populate(objectMap, "recoveryAzureStorageAccountId", a.RecoveryAzureStorageAccountID) @@ -1874,7 +1874,7 @@ func (a *A2AVMDiskInputDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2AVMManagedDiskInputDetails. func (a A2AVMManagedDiskInputDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskEncryptionInfo", a.DiskEncryptionInfo) populate(objectMap, "diskId", a.DiskID) populate(objectMap, "primaryStagingAzureStorageAccountId", a.PrimaryStagingAzureStorageAccountID) @@ -1925,7 +1925,7 @@ func (a *A2AVMManagedDiskInputDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2AVMManagedDiskUpdateDetails. func (a A2AVMManagedDiskUpdateDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskEncryptionInfo", a.DiskEncryptionInfo) populate(objectMap, "diskId", a.DiskID) populate(objectMap, "failoverDiskName", a.FailoverDiskName) @@ -1972,7 +1972,7 @@ func (a *A2AVMManagedDiskUpdateDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type A2AZoneDetails. func (a A2AZoneDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "source", a.Source) populate(objectMap, "target", a.Target) return json.Marshal(objectMap) @@ -2003,7 +2003,7 @@ func (a *A2AZoneDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ASRTask. func (a ASRTask) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "allowedActions", a.AllowedActions) populate(objectMap, "customDetails", a.CustomDetails) populateTimeRFC3339(objectMap, "endTime", a.EndTime) @@ -2074,7 +2074,7 @@ func (a *ASRTask) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AddDisksInput. func (a AddDisksInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", a.Properties) return json.Marshal(objectMap) } @@ -2101,7 +2101,7 @@ func (a *AddDisksInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AddDisksInputProperties. func (a AddDisksInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "providerSpecificDetails", a.ProviderSpecificDetails) return json.Marshal(objectMap) } @@ -2128,7 +2128,7 @@ func (a *AddDisksInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AddDisksProviderSpecificInput. func (a AddDisksProviderSpecificInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = a.InstanceType return json.Marshal(objectMap) } @@ -2155,7 +2155,7 @@ func (a *AddDisksProviderSpecificInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AddRecoveryServicesProviderInput. func (a AddRecoveryServicesProviderInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", a.Properties) return json.Marshal(objectMap) } @@ -2182,7 +2182,7 @@ func (a *AddRecoveryServicesProviderInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AddRecoveryServicesProviderInputProperties. func (a AddRecoveryServicesProviderInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "authenticationIdentityInput", a.AuthenticationIdentityInput) populate(objectMap, "biosId", a.BiosID) populate(objectMap, "dataPlaneAuthenticationIdentityInput", a.DataPlaneAuthenticationIdentityInput) @@ -2229,7 +2229,7 @@ func (a *AddRecoveryServicesProviderInputProperties) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type AddVCenterRequest. func (a AddVCenterRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", a.Properties) return json.Marshal(objectMap) } @@ -2256,7 +2256,7 @@ func (a *AddVCenterRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AddVCenterRequestProperties. func (a AddVCenterRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "friendlyName", a.FriendlyName) populate(objectMap, "ipAddress", a.IPAddress) populate(objectMap, "port", a.Port) @@ -2299,7 +2299,7 @@ func (a *AddVCenterRequestProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AgentDetails. func (a AgentDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "agentId", a.AgentID) populate(objectMap, "biosId", a.BiosID) populate(objectMap, "disks", a.Disks) @@ -2342,7 +2342,7 @@ func (a *AgentDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AgentDiskDetails. func (a AgentDiskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "capacityInBytes", a.CapacityInBytes) populate(objectMap, "diskId", a.DiskID) populate(objectMap, "diskName", a.DiskName) @@ -2385,7 +2385,7 @@ func (a *AgentDiskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Alert. func (a Alert) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", a.ID) populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) @@ -2428,7 +2428,7 @@ func (a *Alert) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AlertCollection. func (a AlertCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", a.NextLink) populate(objectMap, "value", a.Value) return json.Marshal(objectMap) @@ -2459,7 +2459,7 @@ func (a *AlertCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AlertProperties. func (a AlertProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "customEmailAddresses", a.CustomEmailAddresses) populate(objectMap, "locale", a.Locale) populate(objectMap, "sendToOwners", a.SendToOwners) @@ -2494,7 +2494,7 @@ func (a *AlertProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ApplianceCollection. func (a ApplianceCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", a.NextLink) populate(objectMap, "value", a.Value) return json.Marshal(objectMap) @@ -2525,7 +2525,7 @@ func (a *ApplianceCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ApplianceQueryParameter. func (a ApplianceQueryParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "providerType", a.ProviderType) return json.Marshal(objectMap) } @@ -2552,7 +2552,7 @@ func (a *ApplianceQueryParameter) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ApplianceSpecificDetails. func (a ApplianceSpecificDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = a.InstanceType return json.Marshal(objectMap) } @@ -2579,7 +2579,7 @@ func (a *ApplianceSpecificDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ApplyRecoveryPointInput. func (a ApplyRecoveryPointInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", a.Properties) return json.Marshal(objectMap) } @@ -2606,7 +2606,7 @@ func (a *ApplyRecoveryPointInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ApplyRecoveryPointInputProperties. func (a ApplyRecoveryPointInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "providerSpecificDetails", a.ProviderSpecificDetails) populate(objectMap, "recoveryPointId", a.RecoveryPointID) return json.Marshal(objectMap) @@ -2637,7 +2637,7 @@ func (a *ApplyRecoveryPointInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ApplyRecoveryPointProviderSpecificInput. func (a ApplyRecoveryPointProviderSpecificInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = a.InstanceType return json.Marshal(objectMap) } @@ -2664,7 +2664,7 @@ func (a *ApplyRecoveryPointProviderSpecificInput) UnmarshalJSON(data []byte) err // MarshalJSON implements the json.Marshaller interface for type AsrJobDetails. func (a AsrJobDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "affectedObjectDetails", a.AffectedObjectDetails) objectMap["instanceType"] = "AsrJobDetails" return json.Marshal(objectMap) @@ -2695,7 +2695,7 @@ func (a *AsrJobDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AutomationRunbookTaskDetails. func (a AutomationRunbookTaskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "accountName", a.AccountName) populate(objectMap, "cloudServiceName", a.CloudServiceName) objectMap["instanceType"] = "AutomationRunbookTaskDetails" @@ -2758,7 +2758,7 @@ func (a *AutomationRunbookTaskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureFabricCreationInput. func (a AzureFabricCreationInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "Azure" populate(objectMap, "location", a.Location) return json.Marshal(objectMap) @@ -2789,7 +2789,7 @@ func (a *AzureFabricCreationInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureFabricSpecificDetails. func (a AzureFabricSpecificDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "containerIds", a.ContainerIDs) populate(objectMap, "extendedLocations", a.ExtendedLocations) objectMap["instanceType"] = "Azure" @@ -2832,7 +2832,7 @@ func (a *AzureFabricSpecificDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureToAzureCreateNetworkMappingInput. func (a AzureToAzureCreateNetworkMappingInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "AzureToAzure" populate(objectMap, "primaryNetworkId", a.PrimaryNetworkID) return json.Marshal(objectMap) @@ -2863,7 +2863,7 @@ func (a *AzureToAzureCreateNetworkMappingInput) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type AzureToAzureNetworkMappingSettings. func (a AzureToAzureNetworkMappingSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "AzureToAzure" populate(objectMap, "primaryFabricLocation", a.PrimaryFabricLocation) populate(objectMap, "recoveryFabricLocation", a.RecoveryFabricLocation) @@ -2898,7 +2898,7 @@ func (a *AzureToAzureNetworkMappingSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureToAzureUpdateNetworkMappingInput. func (a AzureToAzureUpdateNetworkMappingInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "AzureToAzure" populate(objectMap, "primaryNetworkId", a.PrimaryNetworkID) return json.Marshal(objectMap) @@ -2929,7 +2929,7 @@ func (a *AzureToAzureUpdateNetworkMappingInput) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type AzureToAzureVMSyncedConfigDetails. func (a AzureToAzureVMSyncedConfigDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "inputEndpoints", a.InputEndpoints) populate(objectMap, "tags", a.Tags) return json.Marshal(objectMap) @@ -2960,7 +2960,7 @@ func (a *AzureToAzureVMSyncedConfigDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureVMDiskDetails. func (a AzureVMDiskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "customTargetDiskName", a.CustomTargetDiskName) populate(objectMap, "diskEncryptionSetId", a.DiskEncryptionSetID) populate(objectMap, "diskId", a.DiskID) @@ -3023,7 +3023,7 @@ func (a *AzureVMDiskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ComputeSizeErrorDetails. func (c ComputeSizeErrorDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "message", c.Message) populate(objectMap, "severity", c.Severity) return json.Marshal(objectMap) @@ -3054,7 +3054,7 @@ func (c *ComputeSizeErrorDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ConfigurationSettings. func (c ConfigurationSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = c.InstanceType return json.Marshal(objectMap) } @@ -3081,7 +3081,7 @@ func (c *ConfigurationSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ConfigureAlertRequest. func (c ConfigureAlertRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", c.Properties) return json.Marshal(objectMap) } @@ -3108,7 +3108,7 @@ func (c *ConfigureAlertRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ConfigureAlertRequestProperties. func (c ConfigureAlertRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "customEmailAddresses", c.CustomEmailAddresses) populate(objectMap, "locale", c.Locale) populate(objectMap, "sendToOwners", c.SendToOwners) @@ -3143,7 +3143,7 @@ func (c *ConfigureAlertRequestProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ConsistencyCheckTaskDetails. func (c ConsistencyCheckTaskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "ConsistencyCheckTaskDetails" populate(objectMap, "vmDetails", c.VMDetails) return json.Marshal(objectMap) @@ -3174,7 +3174,7 @@ func (c *ConsistencyCheckTaskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CreateNetworkMappingInput. func (c CreateNetworkMappingInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", c.Properties) return json.Marshal(objectMap) } @@ -3201,7 +3201,7 @@ func (c *CreateNetworkMappingInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CreateNetworkMappingInputProperties. func (c CreateNetworkMappingInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "fabricSpecificDetails", c.FabricSpecificDetails) populate(objectMap, "recoveryFabricName", c.RecoveryFabricName) populate(objectMap, "recoveryNetworkId", c.RecoveryNetworkID) @@ -3236,7 +3236,7 @@ func (c *CreateNetworkMappingInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CreatePolicyInput. func (c CreatePolicyInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", c.Properties) return json.Marshal(objectMap) } @@ -3263,7 +3263,7 @@ func (c *CreatePolicyInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CreatePolicyInputProperties. func (c CreatePolicyInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "providerSpecificInput", c.ProviderSpecificInput) return json.Marshal(objectMap) } @@ -3290,7 +3290,7 @@ func (c *CreatePolicyInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CreateProtectionContainerInput. func (c CreateProtectionContainerInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", c.Properties) return json.Marshal(objectMap) } @@ -3317,7 +3317,7 @@ func (c *CreateProtectionContainerInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CreateProtectionContainerInputProperties. func (c CreateProtectionContainerInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "providerSpecificInput", c.ProviderSpecificInput) return json.Marshal(objectMap) } @@ -3344,7 +3344,7 @@ func (c *CreateProtectionContainerInputProperties) UnmarshalJSON(data []byte) er // MarshalJSON implements the json.Marshaller interface for type CreateProtectionContainerMappingInput. func (c CreateProtectionContainerMappingInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", c.Properties) return json.Marshal(objectMap) } @@ -3371,7 +3371,7 @@ func (c *CreateProtectionContainerMappingInput) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type CreateProtectionContainerMappingInputProperties. func (c CreateProtectionContainerMappingInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "policyId", c.PolicyID) populate(objectMap, "providerSpecificInput", c.ProviderSpecificInput) populate(objectMap, "targetProtectionContainerId", c.TargetProtectionContainerID) @@ -3406,7 +3406,7 @@ func (c *CreateProtectionContainerMappingInputProperties) UnmarshalJSON(data []b // MarshalJSON implements the json.Marshaller interface for type CreateProtectionIntentInput. func (c CreateProtectionIntentInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", c.Properties) return json.Marshal(objectMap) } @@ -3433,7 +3433,7 @@ func (c *CreateProtectionIntentInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CreateProtectionIntentProperties. func (c CreateProtectionIntentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "providerSpecificDetails", c.ProviderSpecificDetails) return json.Marshal(objectMap) } @@ -3460,7 +3460,7 @@ func (c *CreateProtectionIntentProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CreateProtectionIntentProviderSpecificDetails. func (c CreateProtectionIntentProviderSpecificDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = c.InstanceType return json.Marshal(objectMap) } @@ -3487,7 +3487,7 @@ func (c *CreateProtectionIntentProviderSpecificDetails) UnmarshalJSON(data []byt // MarshalJSON implements the json.Marshaller interface for type CreateRecoveryPlanInput. func (c CreateRecoveryPlanInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", c.Properties) return json.Marshal(objectMap) } @@ -3514,7 +3514,7 @@ func (c *CreateRecoveryPlanInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CreateRecoveryPlanInputProperties. func (c CreateRecoveryPlanInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "failoverDeploymentModel", c.FailoverDeploymentModel) populate(objectMap, "groups", c.Groups) populate(objectMap, "primaryFabricId", c.PrimaryFabricID) @@ -3557,7 +3557,7 @@ func (c *CreateRecoveryPlanInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CriticalJobHistoryDetails. func (c CriticalJobHistoryDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "jobId", c.JobID) populate(objectMap, "jobName", c.JobName) populate(objectMap, "jobStatus", c.JobStatus) @@ -3596,7 +3596,7 @@ func (c *CriticalJobHistoryDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CurrentJobDetails. func (c CurrentJobDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "jobId", c.JobID) populate(objectMap, "jobName", c.JobName) populateTimeRFC3339(objectMap, "startTime", c.StartTime) @@ -3631,7 +3631,7 @@ func (c *CurrentJobDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CurrentScenarioDetails. func (c CurrentScenarioDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "jobId", c.JobID) populate(objectMap, "scenarioName", c.ScenarioName) populateTimeRFC3339(objectMap, "startTime", c.StartTime) @@ -3666,7 +3666,7 @@ func (c *CurrentScenarioDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DataStore. func (d DataStore) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "capacity", d.Capacity) populate(objectMap, "freeSpace", d.FreeSpace) populate(objectMap, "symbolicName", d.SymbolicName) @@ -3709,7 +3709,7 @@ func (d *DataStore) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DisableProtectionInput. func (d DisableProtectionInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", d.Properties) return json.Marshal(objectMap) } @@ -3736,7 +3736,7 @@ func (d *DisableProtectionInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DisableProtectionInputProperties. func (d DisableProtectionInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "disableProtectionReason", d.DisableProtectionReason) populate(objectMap, "replicationProviderInput", d.ReplicationProviderInput) return json.Marshal(objectMap) @@ -3767,7 +3767,7 @@ func (d *DisableProtectionInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DisableProtectionProviderSpecificInput. func (d DisableProtectionProviderSpecificInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = d.InstanceType return json.Marshal(objectMap) } @@ -3794,7 +3794,7 @@ func (d *DisableProtectionProviderSpecificInput) UnmarshalJSON(data []byte) erro // MarshalJSON implements the json.Marshaller interface for type DiscoverProtectableItemRequest. func (d DiscoverProtectableItemRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", d.Properties) return json.Marshal(objectMap) } @@ -3821,7 +3821,7 @@ func (d *DiscoverProtectableItemRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DiscoverProtectableItemRequestProperties. func (d DiscoverProtectableItemRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "friendlyName", d.FriendlyName) populate(objectMap, "ipAddress", d.IPAddress) populate(objectMap, "osType", d.OSType) @@ -3856,7 +3856,7 @@ func (d *DiscoverProtectableItemRequestProperties) UnmarshalJSON(data []byte) er // MarshalJSON implements the json.Marshaller interface for type DiskDetails. func (d DiskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "maxSizeMB", d.MaxSizeMB) populate(objectMap, "vhdId", d.VhdID) populate(objectMap, "vhdName", d.VhdName) @@ -3895,7 +3895,7 @@ func (d *DiskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DiskEncryptionInfo. func (d DiskEncryptionInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskEncryptionKeyInfo", d.DiskEncryptionKeyInfo) populate(objectMap, "keyEncryptionKeyInfo", d.KeyEncryptionKeyInfo) return json.Marshal(objectMap) @@ -3926,7 +3926,7 @@ func (d *DiskEncryptionInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DiskEncryptionKeyInfo. func (d DiskEncryptionKeyInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "keyVaultResourceArmId", d.KeyVaultResourceArmID) populate(objectMap, "secretIdentifier", d.SecretIdentifier) return json.Marshal(objectMap) @@ -3957,7 +3957,7 @@ func (d *DiskEncryptionKeyInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DiskVolumeDetails. func (d DiskVolumeDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "label", d.Label) populate(objectMap, "name", d.Name) return json.Marshal(objectMap) @@ -3988,7 +3988,7 @@ func (d *DiskVolumeDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Display. func (d Display) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "description", d.Description) populate(objectMap, "operation", d.Operation) populate(objectMap, "provider", d.Provider) @@ -4027,7 +4027,7 @@ func (d *Display) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DraDetails. func (d DraDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "biosId", d.BiosID) populate(objectMap, "forwardProtectedItemCount", d.ForwardProtectedItemCount) populate(objectMap, "health", d.Health) @@ -4086,7 +4086,7 @@ func (d *DraDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EnableMigrationInput. func (e EnableMigrationInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", e.Properties) return json.Marshal(objectMap) } @@ -4113,7 +4113,7 @@ func (e *EnableMigrationInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EnableMigrationInputProperties. func (e EnableMigrationInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "policyId", e.PolicyID) populate(objectMap, "providerSpecificDetails", e.ProviderSpecificDetails) return json.Marshal(objectMap) @@ -4144,7 +4144,7 @@ func (e *EnableMigrationInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EnableMigrationProviderSpecificInput. func (e EnableMigrationProviderSpecificInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = e.InstanceType return json.Marshal(objectMap) } @@ -4171,7 +4171,7 @@ func (e *EnableMigrationProviderSpecificInput) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type EnableProtectionInput. func (e EnableProtectionInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", e.Properties) return json.Marshal(objectMap) } @@ -4198,7 +4198,7 @@ func (e *EnableProtectionInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EnableProtectionInputProperties. func (e EnableProtectionInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "policyId", e.PolicyID) populate(objectMap, "protectableItemId", e.ProtectableItemID) populate(objectMap, "providerSpecificDetails", e.ProviderSpecificDetails) @@ -4233,7 +4233,7 @@ func (e *EnableProtectionInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EnableProtectionProviderSpecificInput. func (e EnableProtectionProviderSpecificInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = e.InstanceType return json.Marshal(objectMap) } @@ -4260,7 +4260,7 @@ func (e *EnableProtectionProviderSpecificInput) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type EncryptionDetails. func (e EncryptionDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "kekCertExpiryDate", e.KekCertExpiryDate) populate(objectMap, "kekCertThumbprint", e.KekCertThumbprint) populate(objectMap, "kekState", e.KekState) @@ -4295,7 +4295,7 @@ func (e *EncryptionDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Event. func (e Event) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", e.ID) populate(objectMap, "location", e.Location) populate(objectMap, "name", e.Name) @@ -4338,7 +4338,7 @@ func (e *Event) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EventCollection. func (e EventCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", e.NextLink) populate(objectMap, "value", e.Value) return json.Marshal(objectMap) @@ -4369,7 +4369,7 @@ func (e *EventCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EventProperties. func (e EventProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "affectedObjectCorrelationId", e.AffectedObjectCorrelationID) populate(objectMap, "affectedObjectFriendlyName", e.AffectedObjectFriendlyName) populate(objectMap, "description", e.Description) @@ -4436,7 +4436,7 @@ func (e *EventProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EventProviderSpecificDetails. func (e EventProviderSpecificDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = e.InstanceType return json.Marshal(objectMap) } @@ -4463,7 +4463,7 @@ func (e *EventProviderSpecificDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EventQueryParameter. func (e EventQueryParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "affectedObjectCorrelationId", e.AffectedObjectCorrelationID) populate(objectMap, "affectedObjectFriendlyName", e.AffectedObjectFriendlyName) populateTimeRFC3339(objectMap, "endTime", e.EndTime) @@ -4518,7 +4518,7 @@ func (e *EventQueryParameter) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EventSpecificDetails. func (e EventSpecificDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = e.InstanceType return json.Marshal(objectMap) } @@ -4545,7 +4545,7 @@ func (e *EventSpecificDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ExistingProtectionProfile. func (e ExistingProtectionProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "protectionProfileId", e.ProtectionProfileID) objectMap["resourceType"] = "Existing" return json.Marshal(objectMap) @@ -4576,7 +4576,7 @@ func (e *ExistingProtectionProfile) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ExistingRecoveryAvailabilitySet. func (e ExistingRecoveryAvailabilitySet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "recoveryAvailabilitySetId", e.RecoveryAvailabilitySetID) objectMap["resourceType"] = "Existing" return json.Marshal(objectMap) @@ -4607,7 +4607,7 @@ func (e *ExistingRecoveryAvailabilitySet) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ExistingRecoveryProximityPlacementGroup. func (e ExistingRecoveryProximityPlacementGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "recoveryProximityPlacementGroupId", e.RecoveryProximityPlacementGroupID) objectMap["resourceType"] = "Existing" return json.Marshal(objectMap) @@ -4638,7 +4638,7 @@ func (e *ExistingRecoveryProximityPlacementGroup) UnmarshalJSON(data []byte) err // MarshalJSON implements the json.Marshaller interface for type ExistingRecoveryResourceGroup. func (e ExistingRecoveryResourceGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "recoveryResourceGroupId", e.RecoveryResourceGroupID) objectMap["resourceType"] = "Existing" return json.Marshal(objectMap) @@ -4669,7 +4669,7 @@ func (e *ExistingRecoveryResourceGroup) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ExistingRecoveryVirtualNetwork. func (e ExistingRecoveryVirtualNetwork) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "recoverySubnetName", e.RecoverySubnetName) populate(objectMap, "recoveryVirtualNetworkId", e.RecoveryVirtualNetworkID) objectMap["resourceType"] = "Existing" @@ -4704,7 +4704,7 @@ func (e *ExistingRecoveryVirtualNetwork) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ExistingStorageAccount. func (e ExistingStorageAccount) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "azureStorageAccountId", e.AzureStorageAccountID) objectMap["resourceType"] = "Existing" return json.Marshal(objectMap) @@ -4735,7 +4735,7 @@ func (e *ExistingStorageAccount) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ExportJobDetails. func (e ExportJobDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "affectedObjectDetails", e.AffectedObjectDetails) populate(objectMap, "blobUri", e.BlobURI) objectMap["instanceType"] = "ExportJobDetails" @@ -4774,7 +4774,7 @@ func (e *ExportJobDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ExtendedLocation. func (e ExtendedLocation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", e.Name) populate(objectMap, "type", e.Type) return json.Marshal(objectMap) @@ -4805,7 +4805,7 @@ func (e *ExtendedLocation) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Fabric. func (f Fabric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", f.ID) populate(objectMap, "location", f.Location) populate(objectMap, "name", f.Name) @@ -4848,7 +4848,7 @@ func (f *Fabric) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type FabricCollection. func (f FabricCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", f.NextLink) populate(objectMap, "value", f.Value) return json.Marshal(objectMap) @@ -4879,7 +4879,7 @@ func (f *FabricCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type FabricCreationInput. func (f FabricCreationInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", f.Properties) return json.Marshal(objectMap) } @@ -4906,7 +4906,7 @@ func (f *FabricCreationInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type FabricCreationInputProperties. func (f FabricCreationInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "customDetails", f.CustomDetails) return json.Marshal(objectMap) } @@ -4933,7 +4933,7 @@ func (f *FabricCreationInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type FabricProperties. func (f FabricProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "bcdrState", f.BcdrState) populate(objectMap, "customDetails", f.CustomDetails) populate(objectMap, "encryptionDetails", f.EncryptionDetails) @@ -4988,7 +4988,7 @@ func (f *FabricProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type FabricQueryParameter. func (f FabricQueryParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "biosId", f.BiosID) populate(objectMap, "discoveryType", f.DiscoveryType) populate(objectMap, "fetchAgentDetails", f.FetchAgentDetails) @@ -5035,7 +5035,7 @@ func (f *FabricQueryParameter) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type FabricReplicationGroupTaskDetails. func (f FabricReplicationGroupTaskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "FabricReplicationGroupTaskDetails" populate(objectMap, "jobTask", f.JobTask) populate(objectMap, "skippedReason", f.SkippedReason) @@ -5074,7 +5074,7 @@ func (f *FabricReplicationGroupTaskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type FabricSpecificCreateNetworkMappingInput. func (f FabricSpecificCreateNetworkMappingInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = f.InstanceType return json.Marshal(objectMap) } @@ -5101,7 +5101,7 @@ func (f *FabricSpecificCreateNetworkMappingInput) UnmarshalJSON(data []byte) err // MarshalJSON implements the json.Marshaller interface for type FabricSpecificCreationInput. func (f FabricSpecificCreationInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = f.InstanceType return json.Marshal(objectMap) } @@ -5128,7 +5128,7 @@ func (f *FabricSpecificCreationInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type FabricSpecificDetails. func (f FabricSpecificDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = f.InstanceType return json.Marshal(objectMap) } @@ -5155,7 +5155,7 @@ func (f *FabricSpecificDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type FabricSpecificUpdateNetworkMappingInput. func (f FabricSpecificUpdateNetworkMappingInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = f.InstanceType return json.Marshal(objectMap) } @@ -5182,7 +5182,7 @@ func (f *FabricSpecificUpdateNetworkMappingInput) UnmarshalJSON(data []byte) err // MarshalJSON implements the json.Marshaller interface for type FailoverJobDetails. func (f FailoverJobDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "affectedObjectDetails", f.AffectedObjectDetails) objectMap["instanceType"] = "FailoverJobDetails" populate(objectMap, "protectedItemDetails", f.ProtectedItemDetails) @@ -5217,7 +5217,7 @@ func (f *FailoverJobDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type FailoverProcessServerRequest. func (f FailoverProcessServerRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", f.Properties) return json.Marshal(objectMap) } @@ -5244,7 +5244,7 @@ func (f *FailoverProcessServerRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type FailoverProcessServerRequestProperties. func (f FailoverProcessServerRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "containerName", f.ContainerName) populate(objectMap, "sourceProcessServerId", f.SourceProcessServerID) populate(objectMap, "targetProcessServerId", f.TargetProcessServerID) @@ -5287,7 +5287,7 @@ func (f *FailoverProcessServerRequestProperties) UnmarshalJSON(data []byte) erro // MarshalJSON implements the json.Marshaller interface for type FailoverReplicationProtectedItemDetails. func (f FailoverReplicationProtectedItemDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "friendlyName", f.FriendlyName) populate(objectMap, "name", f.Name) populate(objectMap, "networkConnectionStatus", f.NetworkConnectionStatus) @@ -5346,7 +5346,7 @@ func (f *FailoverReplicationProtectedItemDetails) UnmarshalJSON(data []byte) err // MarshalJSON implements the json.Marshaller interface for type GroupTaskDetails. func (g GroupTaskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "childTasks", g.ChildTasks) objectMap["instanceType"] = g.InstanceType return json.Marshal(objectMap) @@ -5377,7 +5377,7 @@ func (g *GroupTaskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HealthError. func (h HealthError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "creationTimeUtc", h.CreationTimeUTC) populate(objectMap, "customerResolvability", h.CustomerResolvability) populate(objectMap, "entityId", h.EntityID) @@ -5460,7 +5460,7 @@ func (h *HealthError) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HealthErrorSummary. func (h HealthErrorSummary) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "affectedResourceCorrelationIds", h.AffectedResourceCorrelationIDs) populate(objectMap, "affectedResourceSubtype", h.AffectedResourceSubtype) populate(objectMap, "affectedResourceType", h.AffectedResourceType) @@ -5511,7 +5511,7 @@ func (h *HealthErrorSummary) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HyperVHostDetails. func (h HyperVHostDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", h.ID) populate(objectMap, "marsAgentVersion", h.MarsAgentVersion) populate(objectMap, "name", h.Name) @@ -5546,7 +5546,7 @@ func (h *HyperVHostDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HyperVReplica2012EventDetails. func (h HyperVReplica2012EventDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "containerName", h.ContainerName) populate(objectMap, "fabricName", h.FabricName) objectMap["instanceType"] = "HyperVReplica2012" @@ -5589,7 +5589,7 @@ func (h *HyperVReplica2012EventDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HyperVReplica2012R2EventDetails. func (h HyperVReplica2012R2EventDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "containerName", h.ContainerName) populate(objectMap, "fabricName", h.FabricName) objectMap["instanceType"] = "HyperVReplica2012R2" @@ -5632,7 +5632,7 @@ func (h *HyperVReplica2012R2EventDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaAzureApplyRecoveryPointInput. func (h HyperVReplicaAzureApplyRecoveryPointInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "HyperVReplicaAzure" populate(objectMap, "primaryKekCertificatePfx", h.PrimaryKekCertificatePfx) populate(objectMap, "secondaryKekCertificatePfx", h.SecondaryKekCertificatePfx) @@ -5667,7 +5667,7 @@ func (h *HyperVReplicaAzureApplyRecoveryPointInput) UnmarshalJSON(data []byte) e // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaAzureDiskInputDetails. func (h HyperVReplicaAzureDiskInputDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskEncryptionSetId", h.DiskEncryptionSetID) populate(objectMap, "diskId", h.DiskID) populate(objectMap, "diskType", h.DiskType) @@ -5706,7 +5706,7 @@ func (h *HyperVReplicaAzureDiskInputDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaAzureEnableProtectionInput. func (h HyperVReplicaAzureEnableProtectionInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskEncryptionSetId", h.DiskEncryptionSetID) populate(objectMap, "diskType", h.DiskType) populate(objectMap, "disksToInclude", h.DisksToInclude) @@ -5845,7 +5845,7 @@ func (h *HyperVReplicaAzureEnableProtectionInput) UnmarshalJSON(data []byte) err // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaAzureEventDetails. func (h HyperVReplicaAzureEventDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "containerName", h.ContainerName) populate(objectMap, "fabricName", h.FabricName) objectMap["instanceType"] = "HyperVReplicaAzure" @@ -5884,7 +5884,7 @@ func (h *HyperVReplicaAzureEventDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaAzureFailbackProviderInput. func (h HyperVReplicaAzureFailbackProviderInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "dataSyncOption", h.DataSyncOption) objectMap["instanceType"] = "HyperVReplicaAzureFailback" populate(objectMap, "providerIdForAlternateRecovery", h.ProviderIDForAlternateRecovery) @@ -5923,7 +5923,7 @@ func (h *HyperVReplicaAzureFailbackProviderInput) UnmarshalJSON(data []byte) err // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaAzureManagedDiskDetails. func (h HyperVReplicaAzureManagedDiskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskEncryptionSetId", h.DiskEncryptionSetID) populate(objectMap, "diskId", h.DiskID) populate(objectMap, "replicaDiskType", h.ReplicaDiskType) @@ -5962,7 +5962,7 @@ func (h *HyperVReplicaAzureManagedDiskDetails) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaAzurePlannedFailoverProviderInput. func (h HyperVReplicaAzurePlannedFailoverProviderInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "HyperVReplicaAzure" populate(objectMap, "primaryKekCertificatePfx", h.PrimaryKekCertificatePfx) populate(objectMap, "recoveryPointId", h.RecoveryPointID) @@ -6001,7 +6001,7 @@ func (h *HyperVReplicaAzurePlannedFailoverProviderInput) UnmarshalJSON(data []by // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaAzurePolicyDetails. func (h HyperVReplicaAzurePolicyDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "activeStorageAccountId", h.ActiveStorageAccountID) populate(objectMap, "applicationConsistentSnapshotFrequencyInHours", h.ApplicationConsistentSnapshotFrequencyInHours) populate(objectMap, "encryption", h.Encryption) @@ -6052,7 +6052,7 @@ func (h *HyperVReplicaAzurePolicyDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaAzurePolicyInput. func (h HyperVReplicaAzurePolicyInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "applicationConsistentSnapshotFrequencyInHours", h.ApplicationConsistentSnapshotFrequencyInHours) objectMap["instanceType"] = "HyperVReplicaAzure" populate(objectMap, "onlineReplicationStartTime", h.OnlineReplicationStartTime) @@ -6099,7 +6099,7 @@ func (h *HyperVReplicaAzurePolicyInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaAzureReplicationDetails. func (h HyperVReplicaAzureReplicationDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "azureVmDiskDetails", h.AzureVMDiskDetails) populate(objectMap, "enableRdpOnTargetOption", h.EnableRdpOnTargetOption) populate(objectMap, "encryption", h.Encryption) @@ -6258,7 +6258,7 @@ func (h *HyperVReplicaAzureReplicationDetails) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaAzureReprotectInput. func (h HyperVReplicaAzureReprotectInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "hvHostVmId", h.HvHostVMID) objectMap["instanceType"] = "HyperVReplicaAzure" populate(objectMap, "logStorageAccountId", h.LogStorageAccountID) @@ -6309,7 +6309,7 @@ func (h *HyperVReplicaAzureReprotectInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaAzureTestFailoverInput. func (h HyperVReplicaAzureTestFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "HyperVReplicaAzure" populate(objectMap, "primaryKekCertificatePfx", h.PrimaryKekCertificatePfx) populate(objectMap, "recoveryPointId", h.RecoveryPointID) @@ -6348,7 +6348,7 @@ func (h *HyperVReplicaAzureTestFailoverInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaAzureUnplannedFailoverInput. func (h HyperVReplicaAzureUnplannedFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "HyperVReplicaAzure" populate(objectMap, "primaryKekCertificatePfx", h.PrimaryKekCertificatePfx) populate(objectMap, "recoveryPointId", h.RecoveryPointID) @@ -6387,7 +6387,7 @@ func (h *HyperVReplicaAzureUnplannedFailoverInput) UnmarshalJSON(data []byte) er // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaAzureUpdateReplicationProtectedItemInput. func (h HyperVReplicaAzureUpdateReplicationProtectedItemInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskIdToDiskEncryptionMap", h.DiskIDToDiskEncryptionMap) objectMap["instanceType"] = "HyperVReplicaAzure" populate(objectMap, "recoveryAzureV1ResourceGroupId", h.RecoveryAzureV1ResourceGroupID) @@ -6458,7 +6458,7 @@ func (h *HyperVReplicaAzureUpdateReplicationProtectedItemInput) UnmarshalJSON(da // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaBaseEventDetails. func (h HyperVReplicaBaseEventDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "containerName", h.ContainerName) populate(objectMap, "fabricName", h.FabricName) objectMap["instanceType"] = "HyperVReplicaBaseEventDetails" @@ -6501,7 +6501,7 @@ func (h *HyperVReplicaBaseEventDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaBasePolicyDetails. func (h HyperVReplicaBasePolicyDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "allowedAuthenticationType", h.AllowedAuthenticationType) populate(objectMap, "applicationConsistentSnapshotFrequencyInHours", h.ApplicationConsistentSnapshotFrequencyInHours) populate(objectMap, "compression", h.Compression) @@ -6568,7 +6568,7 @@ func (h *HyperVReplicaBasePolicyDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaBaseReplicationDetails. func (h HyperVReplicaBaseReplicationDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "initialReplicationDetails", h.InitialReplicationDetails) objectMap["instanceType"] = "HyperVReplicaBaseReplicationDetails" populateTimeRFC3339(objectMap, "lastReplicatedTime", h.LastReplicatedTime) @@ -6623,7 +6623,7 @@ func (h *HyperVReplicaBaseReplicationDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaBluePolicyDetails. func (h HyperVReplicaBluePolicyDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "allowedAuthenticationType", h.AllowedAuthenticationType) populate(objectMap, "applicationConsistentSnapshotFrequencyInHours", h.ApplicationConsistentSnapshotFrequencyInHours) populate(objectMap, "compression", h.Compression) @@ -6694,7 +6694,7 @@ func (h *HyperVReplicaBluePolicyDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaBluePolicyInput. func (h HyperVReplicaBluePolicyInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "allowedAuthenticationType", h.AllowedAuthenticationType) populate(objectMap, "applicationConsistentSnapshotFrequencyInHours", h.ApplicationConsistentSnapshotFrequencyInHours) populate(objectMap, "compression", h.Compression) @@ -6765,7 +6765,7 @@ func (h *HyperVReplicaBluePolicyInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaBlueReplicationDetails. func (h HyperVReplicaBlueReplicationDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "initialReplicationDetails", h.InitialReplicationDetails) objectMap["instanceType"] = "HyperVReplica2012R2" populateTimeRFC3339(objectMap, "lastReplicatedTime", h.LastReplicatedTime) @@ -6820,7 +6820,7 @@ func (h *HyperVReplicaBlueReplicationDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaPolicyDetails. func (h HyperVReplicaPolicyDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "allowedAuthenticationType", h.AllowedAuthenticationType) populate(objectMap, "applicationConsistentSnapshotFrequencyInHours", h.ApplicationConsistentSnapshotFrequencyInHours) populate(objectMap, "compression", h.Compression) @@ -6887,7 +6887,7 @@ func (h *HyperVReplicaPolicyDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaPolicyInput. func (h HyperVReplicaPolicyInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "allowedAuthenticationType", h.AllowedAuthenticationType) populate(objectMap, "applicationConsistentSnapshotFrequencyInHours", h.ApplicationConsistentSnapshotFrequencyInHours) populate(objectMap, "compression", h.Compression) @@ -6954,7 +6954,7 @@ func (h *HyperVReplicaPolicyInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HyperVReplicaReplicationDetails. func (h HyperVReplicaReplicationDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "initialReplicationDetails", h.InitialReplicationDetails) objectMap["instanceType"] = "HyperVReplica2012" populateTimeRFC3339(objectMap, "lastReplicatedTime", h.LastReplicatedTime) @@ -7009,7 +7009,7 @@ func (h *HyperVReplicaReplicationDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HyperVSiteDetails. func (h HyperVSiteDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "hyperVHosts", h.HyperVHosts) objectMap["instanceType"] = "HyperVSite" return json.Marshal(objectMap) @@ -7040,7 +7040,7 @@ func (h *HyperVSiteDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HyperVVirtualMachineDetails. func (h HyperVVirtualMachineDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskDetails", h.DiskDetails) populate(objectMap, "generation", h.Generation) populate(objectMap, "hasFibreChannelAdapter", h.HasFibreChannelAdapter) @@ -7099,7 +7099,7 @@ func (h *HyperVVirtualMachineDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type IPConfigDetails. func (i IPConfigDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "ipAddressType", i.IPAddressType) populate(objectMap, "isPrimary", i.IsPrimary) populate(objectMap, "isSeletedForFailover", i.IsSeletedForFailover) @@ -7182,7 +7182,7 @@ func (i *IPConfigDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type IPConfigInputDetails. func (i IPConfigInputDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "ipConfigName", i.IPConfigName) populate(objectMap, "isPrimary", i.IsPrimary) populate(objectMap, "isSeletedForFailover", i.IsSeletedForFailover) @@ -7249,7 +7249,7 @@ func (i *IPConfigInputDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type IdentityProviderDetails. func (i IdentityProviderDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "aadAuthority", i.AADAuthority) populate(objectMap, "applicationId", i.ApplicationID) populate(objectMap, "audience", i.Audience) @@ -7292,7 +7292,7 @@ func (i *IdentityProviderDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type IdentityProviderInput. func (i IdentityProviderInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "aadAuthority", i.AADAuthority) populate(objectMap, "applicationId", i.ApplicationID) populate(objectMap, "audience", i.Audience) @@ -7335,7 +7335,7 @@ func (i *IdentityProviderInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageAgentDetails. func (i InMageAgentDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "agentExpiryDate", i.AgentExpiryDate) populate(objectMap, "agentUpdateStatus", i.AgentUpdateStatus) populate(objectMap, "agentVersion", i.AgentVersion) @@ -7374,7 +7374,7 @@ func (i *InMageAgentDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageAzureV2ApplyRecoveryPointInput. func (i InMageAzureV2ApplyRecoveryPointInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "InMageAzureV2" return json.Marshal(objectMap) } @@ -7401,7 +7401,7 @@ func (i *InMageAzureV2ApplyRecoveryPointInput) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type InMageAzureV2DiskInputDetails. func (i InMageAzureV2DiskInputDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskEncryptionSetId", i.DiskEncryptionSetID) populate(objectMap, "diskId", i.DiskID) populate(objectMap, "diskType", i.DiskType) @@ -7440,7 +7440,7 @@ func (i *InMageAzureV2DiskInputDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageAzureV2EnableProtectionInput. func (i InMageAzureV2EnableProtectionInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskEncryptionSetId", i.DiskEncryptionSetID) populate(objectMap, "diskType", i.DiskType) populate(objectMap, "disksToInclude", i.DisksToInclude) @@ -7571,7 +7571,7 @@ func (i *InMageAzureV2EnableProtectionInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageAzureV2EventDetails. func (i InMageAzureV2EventDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "category", i.Category) populate(objectMap, "component", i.Component) populate(objectMap, "correctiveAction", i.CorrectiveAction) @@ -7626,7 +7626,7 @@ func (i *InMageAzureV2EventDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageAzureV2ManagedDiskDetails. func (i InMageAzureV2ManagedDiskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskEncryptionSetId", i.DiskEncryptionSetID) populate(objectMap, "diskId", i.DiskID) populate(objectMap, "replicaDiskType", i.ReplicaDiskType) @@ -7669,7 +7669,7 @@ func (i *InMageAzureV2ManagedDiskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageAzureV2PolicyDetails. func (i InMageAzureV2PolicyDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "appConsistentFrequencyInMinutes", i.AppConsistentFrequencyInMinutes) populate(objectMap, "crashConsistentFrequencyInMinutes", i.CrashConsistentFrequencyInMinutes) objectMap["instanceType"] = "InMageAzureV2" @@ -7716,7 +7716,7 @@ func (i *InMageAzureV2PolicyDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageAzureV2PolicyInput. func (i InMageAzureV2PolicyInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "appConsistentFrequencyInMinutes", i.AppConsistentFrequencyInMinutes) populate(objectMap, "crashConsistentFrequencyInMinutes", i.CrashConsistentFrequencyInMinutes) objectMap["instanceType"] = "InMageAzureV2" @@ -7763,7 +7763,7 @@ func (i *InMageAzureV2PolicyInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageAzureV2ProtectedDiskDetails. func (i InMageAzureV2ProtectedDiskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskCapacityInBytes", i.DiskCapacityInBytes) populate(objectMap, "diskId", i.DiskID) populate(objectMap, "diskName", i.DiskName) @@ -7878,7 +7878,7 @@ func (i *InMageAzureV2ProtectedDiskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageAzureV2RecoveryPointDetails. func (i InMageAzureV2RecoveryPointDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "InMageAzureV2" populate(objectMap, "isMultiVmSyncPoint", i.IsMultiVMSyncPoint) return json.Marshal(objectMap) @@ -7909,7 +7909,7 @@ func (i *InMageAzureV2RecoveryPointDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageAzureV2ReplicationDetails. func (i InMageAzureV2ReplicationDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "agentExpiryDate", i.AgentExpiryDate) populate(objectMap, "agentVersion", i.AgentVersion) populate(objectMap, "azureVMDiskDetails", i.AzureVMDiskDetails) @@ -8204,7 +8204,7 @@ func (i *InMageAzureV2ReplicationDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageAzureV2ReprotectInput. func (i InMageAzureV2ReprotectInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "disksToInclude", i.DisksToInclude) objectMap["instanceType"] = "InMageAzureV2" populate(objectMap, "logStorageAccountId", i.LogStorageAccountID) @@ -8259,7 +8259,7 @@ func (i *InMageAzureV2ReprotectInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageAzureV2SwitchProviderBlockingErrorDetails. func (i InMageAzureV2SwitchProviderBlockingErrorDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "errorCode", i.ErrorCode) populate(objectMap, "errorMessage", i.ErrorMessage) populate(objectMap, "errorMessageParameters", i.ErrorMessageParameters) @@ -8306,7 +8306,7 @@ func (i *InMageAzureV2SwitchProviderBlockingErrorDetails) UnmarshalJSON(data []b // MarshalJSON implements the json.Marshaller interface for type InMageAzureV2SwitchProviderDetails. func (i InMageAzureV2SwitchProviderDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "targetApplianceId", i.TargetApplianceID) populate(objectMap, "targetFabricId", i.TargetFabricID) populate(objectMap, "targetResourceId", i.TargetResourceID) @@ -8345,7 +8345,7 @@ func (i *InMageAzureV2SwitchProviderDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageAzureV2SwitchProviderInput. func (i InMageAzureV2SwitchProviderInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "InMageAzureV2" populate(objectMap, "targetApplianceID", i.TargetApplianceID) populate(objectMap, "targetFabricID", i.TargetFabricID) @@ -8384,7 +8384,7 @@ func (i *InMageAzureV2SwitchProviderInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageAzureV2TestFailoverInput. func (i InMageAzureV2TestFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "InMageAzureV2" populate(objectMap, "recoveryPointId", i.RecoveryPointID) return json.Marshal(objectMap) @@ -8415,7 +8415,7 @@ func (i *InMageAzureV2TestFailoverInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageAzureV2UnplannedFailoverInput. func (i InMageAzureV2UnplannedFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "InMageAzureV2" populate(objectMap, "recoveryPointId", i.RecoveryPointID) return json.Marshal(objectMap) @@ -8446,7 +8446,7 @@ func (i *InMageAzureV2UnplannedFailoverInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageAzureV2UpdateReplicationProtectedItemInput. func (i InMageAzureV2UpdateReplicationProtectedItemInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "InMageAzureV2" populate(objectMap, "recoveryAzureV1ResourceGroupId", i.RecoveryAzureV1ResourceGroupID) populate(objectMap, "recoveryAzureV2ResourceGroupId", i.RecoveryAzureV2ResourceGroupID) @@ -8513,7 +8513,7 @@ func (i *InMageAzureV2UpdateReplicationProtectedItemInput) UnmarshalJSON(data [] // MarshalJSON implements the json.Marshaller interface for type InMageBasePolicyDetails. func (i InMageBasePolicyDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "appConsistentFrequencyInMinutes", i.AppConsistentFrequencyInMinutes) objectMap["instanceType"] = "InMageBasePolicyDetails" populate(objectMap, "multiVmSyncStatus", i.MultiVMSyncStatus) @@ -8556,7 +8556,7 @@ func (i *InMageBasePolicyDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageDisableProtectionProviderSpecificInput. func (i InMageDisableProtectionProviderSpecificInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "InMage" populate(objectMap, "replicaVmDeletionStatus", i.ReplicaVMDeletionStatus) return json.Marshal(objectMap) @@ -8587,7 +8587,7 @@ func (i *InMageDisableProtectionProviderSpecificInput) UnmarshalJSON(data []byte // MarshalJSON implements the json.Marshaller interface for type InMageDiskDetails. func (i InMageDiskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskConfiguration", i.DiskConfiguration) populate(objectMap, "diskId", i.DiskID) populate(objectMap, "diskName", i.DiskName) @@ -8634,7 +8634,7 @@ func (i *InMageDiskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageDiskExclusionInput. func (i InMageDiskExclusionInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskSignatureOptions", i.DiskSignatureOptions) populate(objectMap, "volumeOptions", i.VolumeOptions) return json.Marshal(objectMap) @@ -8665,7 +8665,7 @@ func (i *InMageDiskExclusionInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageDiskSignatureExclusionOptions. func (i InMageDiskSignatureExclusionOptions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskSignature", i.DiskSignature) return json.Marshal(objectMap) } @@ -8692,7 +8692,7 @@ func (i *InMageDiskSignatureExclusionOptions) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageEnableProtectionInput. func (i InMageEnableProtectionInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "datastoreName", i.DatastoreName) populate(objectMap, "diskExclusionInput", i.DiskExclusionInput) populate(objectMap, "disksToInclude", i.DisksToInclude) @@ -8759,7 +8759,7 @@ func (i *InMageEnableProtectionInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageFabricSwitchProviderBlockingErrorDetails. func (i InMageFabricSwitchProviderBlockingErrorDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "errorCode", i.ErrorCode) populate(objectMap, "errorMessage", i.ErrorMessage) populate(objectMap, "errorMessageParameters", i.ErrorMessageParameters) @@ -8806,7 +8806,7 @@ func (i *InMageFabricSwitchProviderBlockingErrorDetails) UnmarshalJSON(data []by // MarshalJSON implements the json.Marshaller interface for type InMagePolicyDetails. func (i InMagePolicyDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "appConsistentFrequencyInMinutes", i.AppConsistentFrequencyInMinutes) objectMap["instanceType"] = "InMage" populate(objectMap, "multiVmSyncStatus", i.MultiVMSyncStatus) @@ -8849,7 +8849,7 @@ func (i *InMagePolicyDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMagePolicyInput. func (i InMagePolicyInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "appConsistentFrequencyInMinutes", i.AppConsistentFrequencyInMinutes) objectMap["instanceType"] = "InMage" populate(objectMap, "multiVmSyncStatus", i.MultiVMSyncStatus) @@ -8892,7 +8892,7 @@ func (i *InMagePolicyInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageProtectedDiskDetails. func (i InMageProtectedDiskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskCapacityInBytes", i.DiskCapacityInBytes) populate(objectMap, "diskId", i.DiskID) populate(objectMap, "diskName", i.DiskName) @@ -9003,7 +9003,7 @@ func (i *InMageProtectedDiskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmAgentUpgradeBlockingErrorDetails. func (i InMageRcmAgentUpgradeBlockingErrorDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "errorCode", i.ErrorCode) populate(objectMap, "errorMessage", i.ErrorMessage) populate(objectMap, "errorMessageParameters", i.ErrorMessageParameters) @@ -9050,7 +9050,7 @@ func (i *InMageRcmAgentUpgradeBlockingErrorDetails) UnmarshalJSON(data []byte) e // MarshalJSON implements the json.Marshaller interface for type InMageRcmApplianceDetails. func (i InMageRcmApplianceDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "dra", i.Dra) populate(objectMap, "fabricArmId", i.FabricArmID) populate(objectMap, "id", i.ID) @@ -9117,7 +9117,7 @@ func (i *InMageRcmApplianceDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmApplianceSpecificDetails. func (i InMageRcmApplianceSpecificDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "appliances", i.Appliances) objectMap["instanceType"] = "InMageRcm" return json.Marshal(objectMap) @@ -9148,7 +9148,7 @@ func (i *InMageRcmApplianceSpecificDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmApplyRecoveryPointInput. func (i InMageRcmApplyRecoveryPointInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "InMageRcm" populate(objectMap, "recoveryPointId", i.RecoveryPointID) return json.Marshal(objectMap) @@ -9179,7 +9179,7 @@ func (i *InMageRcmApplyRecoveryPointInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmDiscoveredProtectedVMDetails. func (i InMageRcmDiscoveredProtectedVMDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "createdTimestamp", i.CreatedTimestamp) populate(objectMap, "datastores", i.Datastores) populate(objectMap, "ipAddresses", i.IPAddresses) @@ -9250,7 +9250,7 @@ func (i *InMageRcmDiscoveredProtectedVMDetails) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type InMageRcmDiskInput. func (i InMageRcmDiskInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskEncryptionSetId", i.DiskEncryptionSetID) populate(objectMap, "diskId", i.DiskID) populate(objectMap, "diskType", i.DiskType) @@ -9289,7 +9289,7 @@ func (i *InMageRcmDiskInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmDisksDefaultInput. func (i InMageRcmDisksDefaultInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskEncryptionSetId", i.DiskEncryptionSetID) populate(objectMap, "diskType", i.DiskType) populate(objectMap, "logStorageAccountId", i.LogStorageAccountID) @@ -9324,7 +9324,7 @@ func (i *InMageRcmDisksDefaultInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmEnableProtectionInput. func (i InMageRcmEnableProtectionInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "disksDefault", i.DisksDefault) populate(objectMap, "disksToInclude", i.DisksToInclude) populate(objectMap, "fabricDiscoveryMachineId", i.FabricDiscoveryMachineID) @@ -9423,7 +9423,7 @@ func (i *InMageRcmEnableProtectionInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmEventDetails. func (i InMageRcmEventDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "applianceName", i.ApplianceName) populate(objectMap, "componentDisplayName", i.ComponentDisplayName) populate(objectMap, "fabricName", i.FabricName) @@ -9482,7 +9482,7 @@ func (i *InMageRcmEventDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmFabricCreationInput. func (i InMageRcmFabricCreationInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "InMageRcm" populate(objectMap, "physicalSiteId", i.PhysicalSiteID) populate(objectMap, "sourceAgentIdentity", i.SourceAgentIdentity) @@ -9521,7 +9521,7 @@ func (i *InMageRcmFabricCreationInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmFabricSpecificDetails. func (i InMageRcmFabricSpecificDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "agentDetails", i.AgentDetails) populate(objectMap, "controlPlaneUri", i.ControlPlaneURI) populate(objectMap, "dataPlaneUri", i.DataPlaneURI) @@ -9612,7 +9612,7 @@ func (i *InMageRcmFabricSpecificDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmFabricSwitchProviderBlockingErrorDetails. func (i InMageRcmFabricSwitchProviderBlockingErrorDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "errorCode", i.ErrorCode) populate(objectMap, "errorMessage", i.ErrorMessage) populate(objectMap, "errorMessageParameters", i.ErrorMessageParameters) @@ -9659,7 +9659,7 @@ func (i *InMageRcmFabricSwitchProviderBlockingErrorDetails) UnmarshalJSON(data [ // MarshalJSON implements the json.Marshaller interface for type InMageRcmFailbackDiscoveredProtectedVMDetails. func (i InMageRcmFailbackDiscoveredProtectedVMDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "createdTimestamp", i.CreatedTimestamp) populate(objectMap, "datastores", i.Datastores) populate(objectMap, "ipAddresses", i.IPAddresses) @@ -9730,7 +9730,7 @@ func (i *InMageRcmFailbackDiscoveredProtectedVMDetails) UnmarshalJSON(data []byt // MarshalJSON implements the json.Marshaller interface for type InMageRcmFailbackEventDetails. func (i InMageRcmFailbackEventDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "applianceName", i.ApplianceName) populate(objectMap, "componentDisplayName", i.ComponentDisplayName) objectMap["instanceType"] = "InMageRcmFailback" @@ -9777,7 +9777,7 @@ func (i *InMageRcmFailbackEventDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmFailbackMobilityAgentDetails. func (i InMageRcmFailbackMobilityAgentDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "agentVersionExpiryDate", i.AgentVersionExpiryDate) populate(objectMap, "driverVersion", i.DriverVersion) populateTimeRFC3339(objectMap, "driverVersionExpiryDate", i.DriverVersionExpiryDate) @@ -9836,7 +9836,7 @@ func (i *InMageRcmFailbackMobilityAgentDetails) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type InMageRcmFailbackNicDetails. func (i InMageRcmFailbackNicDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "adapterType", i.AdapterType) populate(objectMap, "macAddress", i.MacAddress) populate(objectMap, "networkName", i.NetworkName) @@ -9875,7 +9875,7 @@ func (i *InMageRcmFailbackNicDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmFailbackPlannedFailoverProviderInput. func (i InMageRcmFailbackPlannedFailoverProviderInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "InMageRcmFailback" populate(objectMap, "recoveryPointType", i.RecoveryPointType) return json.Marshal(objectMap) @@ -9906,7 +9906,7 @@ func (i *InMageRcmFailbackPlannedFailoverProviderInput) UnmarshalJSON(data []byt // MarshalJSON implements the json.Marshaller interface for type InMageRcmFailbackPolicyCreationInput. func (i InMageRcmFailbackPolicyCreationInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "appConsistentFrequencyInMinutes", i.AppConsistentFrequencyInMinutes) populate(objectMap, "crashConsistentFrequencyInMinutes", i.CrashConsistentFrequencyInMinutes) objectMap["instanceType"] = "InMageRcmFailback" @@ -9941,7 +9941,7 @@ func (i *InMageRcmFailbackPolicyCreationInput) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type InMageRcmFailbackPolicyDetails. func (i InMageRcmFailbackPolicyDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "appConsistentFrequencyInMinutes", i.AppConsistentFrequencyInMinutes) populate(objectMap, "crashConsistentFrequencyInMinutes", i.CrashConsistentFrequencyInMinutes) objectMap["instanceType"] = "InMageRcmFailback" @@ -9976,7 +9976,7 @@ func (i *InMageRcmFailbackPolicyDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmFailbackProtectedDiskDetails. func (i InMageRcmFailbackProtectedDiskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "capacityInBytes", i.CapacityInBytes) populate(objectMap, "dataPendingAtSourceAgentInMB", i.DataPendingAtSourceAgentInMB) populate(objectMap, "dataPendingInLogDataStoreInMB", i.DataPendingInLogDataStoreInMB) @@ -10043,7 +10043,7 @@ func (i *InMageRcmFailbackProtectedDiskDetails) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type InMageRcmFailbackReplicationDetails. func (i InMageRcmFailbackReplicationDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "azureVirtualMachineId", i.AzureVirtualMachineID) populate(objectMap, "discoveredVmDetails", i.DiscoveredVMDetails) populate(objectMap, "initialReplicationProcessedBytes", i.InitialReplicationProcessedBytes) @@ -10186,7 +10186,7 @@ func (i *InMageRcmFailbackReplicationDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmFailbackReprotectInput. func (i InMageRcmFailbackReprotectInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "InMageRcmFailback" populate(objectMap, "policyId", i.PolicyID) populate(objectMap, "processServerId", i.ProcessServerID) @@ -10225,7 +10225,7 @@ func (i *InMageRcmFailbackReprotectInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmFailbackSyncDetails. func (i InMageRcmFailbackSyncDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "last15MinutesTransferredBytes", i.Last15MinutesTransferredBytes) populate(objectMap, "lastDataTransferTimeUtc", i.LastDataTransferTimeUTC) populate(objectMap, "lastRefreshTime", i.LastRefreshTime) @@ -10280,7 +10280,7 @@ func (i *InMageRcmFailbackSyncDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmLastAgentUpgradeErrorDetails. func (i InMageRcmLastAgentUpgradeErrorDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "errorCode", i.ErrorCode) populate(objectMap, "errorMessage", i.ErrorMessage) populate(objectMap, "errorMessageParameters", i.ErrorMessageParameters) @@ -10327,7 +10327,7 @@ func (i *InMageRcmLastAgentUpgradeErrorDetails) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type InMageRcmMobilityAgentDetails. func (i InMageRcmMobilityAgentDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "agentVersionExpiryDate", i.AgentVersionExpiryDate) populate(objectMap, "driverVersion", i.DriverVersion) populateTimeRFC3339(objectMap, "driverVersionExpiryDate", i.DriverVersionExpiryDate) @@ -10390,7 +10390,7 @@ func (i *InMageRcmMobilityAgentDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmNicDetails. func (i InMageRcmNicDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "isPrimaryNic", i.IsPrimaryNic) populate(objectMap, "isSelectedForFailover", i.IsSelectedForFailover) populate(objectMap, "nicId", i.NicID) @@ -10465,7 +10465,7 @@ func (i *InMageRcmNicDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmNicInput. func (i InMageRcmNicInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "isPrimaryNic", i.IsPrimaryNic) populate(objectMap, "isSelectedForFailover", i.IsSelectedForFailover) populate(objectMap, "nicId", i.NicID) @@ -10516,7 +10516,7 @@ func (i *InMageRcmNicInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmPolicyCreationInput. func (i InMageRcmPolicyCreationInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "appConsistentFrequencyInMinutes", i.AppConsistentFrequencyInMinutes) populate(objectMap, "crashConsistentFrequencyInMinutes", i.CrashConsistentFrequencyInMinutes) populate(objectMap, "enableMultiVmSync", i.EnableMultiVMSync) @@ -10559,7 +10559,7 @@ func (i *InMageRcmPolicyCreationInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmPolicyDetails. func (i InMageRcmPolicyDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "appConsistentFrequencyInMinutes", i.AppConsistentFrequencyInMinutes) populate(objectMap, "crashConsistentFrequencyInMinutes", i.CrashConsistentFrequencyInMinutes) populate(objectMap, "enableMultiVmSync", i.EnableMultiVMSync) @@ -10602,7 +10602,7 @@ func (i *InMageRcmPolicyDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmProtectedDiskDetails. func (i InMageRcmProtectedDiskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "capacityInBytes", i.CapacityInBytes) populate(objectMap, "dataPendingAtSourceAgentInMB", i.DataPendingAtSourceAgentInMB) populate(objectMap, "dataPendingInLogDataStoreInMB", i.DataPendingInLogDataStoreInMB) @@ -10685,7 +10685,7 @@ func (i *InMageRcmProtectedDiskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmProtectionContainerMappingDetails. func (i InMageRcmProtectionContainerMappingDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "enableAgentAutoUpgrade", i.EnableAgentAutoUpgrade) objectMap["instanceType"] = "InMageRcm" return json.Marshal(objectMap) @@ -10716,7 +10716,7 @@ func (i *InMageRcmProtectionContainerMappingDetails) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type InMageRcmRecoveryPointDetails. func (i InMageRcmRecoveryPointDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "InMageRcm" populate(objectMap, "isMultiVmSyncPoint", i.IsMultiVMSyncPoint) return json.Marshal(objectMap) @@ -10747,7 +10747,7 @@ func (i *InMageRcmRecoveryPointDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmReplicationDetails. func (i InMageRcmReplicationDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "agentUpgradeAttemptToVersion", i.AgentUpgradeAttemptToVersion) populate(objectMap, "agentUpgradeBlockingErrorDetails", i.AgentUpgradeBlockingErrorDetails) populate(objectMap, "agentUpgradeJobId", i.AgentUpgradeJobID) @@ -10982,7 +10982,7 @@ func (i *InMageRcmReplicationDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmReprotectInput. func (i InMageRcmReprotectInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "datastoreName", i.DatastoreName) objectMap["instanceType"] = "InMageRcm" populate(objectMap, "logStorageAccountId", i.LogStorageAccountID) @@ -11025,7 +11025,7 @@ func (i *InMageRcmReprotectInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmSyncDetails. func (i InMageRcmSyncDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "last15MinutesTransferredBytes", i.Last15MinutesTransferredBytes) populate(objectMap, "lastDataTransferTimeUtc", i.LastDataTransferTimeUTC) populate(objectMap, "lastRefreshTime", i.LastRefreshTime) @@ -11080,7 +11080,7 @@ func (i *InMageRcmSyncDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmTestFailoverInput. func (i InMageRcmTestFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "InMageRcm" populate(objectMap, "networkId", i.NetworkID) populate(objectMap, "recoveryPointId", i.RecoveryPointID) @@ -11115,7 +11115,7 @@ func (i *InMageRcmTestFailoverInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmUnplannedFailoverInput. func (i InMageRcmUnplannedFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "InMageRcm" populate(objectMap, "performShutdown", i.PerformShutdown) populate(objectMap, "recoveryPointId", i.RecoveryPointID) @@ -11150,7 +11150,7 @@ func (i *InMageRcmUnplannedFailoverInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageRcmUpdateApplianceForReplicationProtectedItemInput. func (i InMageRcmUpdateApplianceForReplicationProtectedItemInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "InMageRcm" populate(objectMap, "runAsAccountId", i.RunAsAccountID) return json.Marshal(objectMap) @@ -11181,7 +11181,7 @@ func (i *InMageRcmUpdateApplianceForReplicationProtectedItemInput) UnmarshalJSON // MarshalJSON implements the json.Marshaller interface for type InMageRcmUpdateContainerMappingInput. func (i InMageRcmUpdateContainerMappingInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "enableAgentAutoUpgrade", i.EnableAgentAutoUpgrade) objectMap["instanceType"] = "InMageRcm" return json.Marshal(objectMap) @@ -11212,7 +11212,7 @@ func (i *InMageRcmUpdateContainerMappingInput) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type InMageRcmUpdateReplicationProtectedItemInput. func (i InMageRcmUpdateReplicationProtectedItemInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "InMageRcm" populate(objectMap, "licenseType", i.LicenseType) populate(objectMap, "targetAvailabilitySetId", i.TargetAvailabilitySetID) @@ -11283,7 +11283,7 @@ func (i *InMageRcmUpdateReplicationProtectedItemInput) UnmarshalJSON(data []byte // MarshalJSON implements the json.Marshaller interface for type InMageReplicationDetails. func (i InMageReplicationDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "activeSiteType", i.ActiveSiteType) populate(objectMap, "agentDetails", i.AgentDetails) populate(objectMap, "azureStorageAccountId", i.AzureStorageAccountID) @@ -11470,7 +11470,7 @@ func (i *InMageReplicationDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageReprotectInput. func (i InMageReprotectInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "datastoreName", i.DatastoreName) populate(objectMap, "diskExclusionInput", i.DiskExclusionInput) populate(objectMap, "disksToInclude", i.DisksToInclude) @@ -11529,7 +11529,7 @@ func (i *InMageReprotectInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageTestFailoverInput. func (i InMageTestFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "InMage" populate(objectMap, "recoveryPointId", i.RecoveryPointID) populate(objectMap, "recoveryPointType", i.RecoveryPointType) @@ -11564,7 +11564,7 @@ func (i *InMageTestFailoverInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageUnplannedFailoverInput. func (i InMageUnplannedFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "InMage" populate(objectMap, "recoveryPointId", i.RecoveryPointID) populate(objectMap, "recoveryPointType", i.RecoveryPointType) @@ -11599,7 +11599,7 @@ func (i *InMageUnplannedFailoverInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InMageVolumeExclusionOptions. func (i InMageVolumeExclusionOptions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "onlyExcludeIfSingleVolume", i.OnlyExcludeIfSingleVolume) populate(objectMap, "volumeLabel", i.VolumeLabel) return json.Marshal(objectMap) @@ -11630,7 +11630,7 @@ func (i *InMageVolumeExclusionOptions) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InconsistentVMDetails. func (i InconsistentVMDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "cloudName", i.CloudName) populate(objectMap, "details", i.Details) populate(objectMap, "errorIds", i.ErrorIDs) @@ -11669,7 +11669,7 @@ func (i *InconsistentVMDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InitialReplicationDetails. func (i InitialReplicationDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "initialReplicationProgressPercentage", i.InitialReplicationProgressPercentage) populate(objectMap, "initialReplicationType", i.InitialReplicationType) return json.Marshal(objectMap) @@ -11700,7 +11700,7 @@ func (i *InitialReplicationDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InlineWorkflowTaskDetails. func (i InlineWorkflowTaskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "childTasks", i.ChildTasks) objectMap["instanceType"] = "InlineWorkflowTaskDetails" populate(objectMap, "workflowIds", i.WorkflowIDs) @@ -11735,7 +11735,7 @@ func (i *InlineWorkflowTaskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InnerHealthError. func (i InnerHealthError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "creationTimeUtc", i.CreationTimeUTC) populate(objectMap, "customerResolvability", i.CustomerResolvability) populate(objectMap, "entityId", i.EntityID) @@ -11814,7 +11814,7 @@ func (i *InnerHealthError) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InputEndpoint. func (i InputEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "endpointName", i.EndpointName) populate(objectMap, "privatePort", i.PrivatePort) populate(objectMap, "protocol", i.Protocol) @@ -11853,7 +11853,7 @@ func (i *InputEndpoint) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Job. func (j Job) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", j.ID) populate(objectMap, "location", j.Location) populate(objectMap, "name", j.Name) @@ -11896,7 +11896,7 @@ func (j *Job) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type JobCollection. func (j JobCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", j.NextLink) populate(objectMap, "value", j.Value) return json.Marshal(objectMap) @@ -11927,7 +11927,7 @@ func (j *JobCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type JobDetails. func (j JobDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "affectedObjectDetails", j.AffectedObjectDetails) objectMap["instanceType"] = j.InstanceType return json.Marshal(objectMap) @@ -11958,7 +11958,7 @@ func (j *JobDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type JobEntity. func (j JobEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "jobFriendlyName", j.JobFriendlyName) populate(objectMap, "jobId", j.JobID) populate(objectMap, "jobScenarioName", j.JobScenarioName) @@ -12005,7 +12005,7 @@ func (j *JobEntity) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type JobErrorDetails. func (j JobErrorDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "creationTime", j.CreationTime) populate(objectMap, "errorLevel", j.ErrorLevel) populate(objectMap, "providerErrorDetails", j.ProviderErrorDetails) @@ -12048,7 +12048,7 @@ func (j *JobErrorDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type JobProperties. func (j JobProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "activityId", j.ActivityID) populate(objectMap, "allowedActions", j.AllowedActions) populate(objectMap, "customDetails", j.CustomDetails) @@ -12127,7 +12127,7 @@ func (j *JobProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type JobQueryParameter. func (j JobQueryParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "affectedObjectTypes", j.AffectedObjectTypes) populate(objectMap, "endTime", j.EndTime) populate(objectMap, "fabricId", j.FabricID) @@ -12182,7 +12182,7 @@ func (j *JobQueryParameter) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type JobStatusEventDetails. func (j JobStatusEventDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "affectedObjectType", j.AffectedObjectType) objectMap["instanceType"] = "JobStatus" populate(objectMap, "jobFriendlyName", j.JobFriendlyName) @@ -12225,7 +12225,7 @@ func (j *JobStatusEventDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type JobTaskDetails. func (j JobTaskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "JobTaskDetails" populate(objectMap, "jobTask", j.JobTask) return json.Marshal(objectMap) @@ -12256,7 +12256,7 @@ func (j *JobTaskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type KeyEncryptionKeyInfo. func (k KeyEncryptionKeyInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "keyIdentifier", k.KeyIdentifier) populate(objectMap, "keyVaultResourceArmId", k.KeyVaultResourceArmID) return json.Marshal(objectMap) @@ -12287,7 +12287,7 @@ func (k *KeyEncryptionKeyInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LogicalNetwork. func (l LogicalNetwork) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", l.ID) populate(objectMap, "location", l.Location) populate(objectMap, "name", l.Name) @@ -12330,7 +12330,7 @@ func (l *LogicalNetwork) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LogicalNetworkCollection. func (l LogicalNetworkCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", l.NextLink) populate(objectMap, "value", l.Value) return json.Marshal(objectMap) @@ -12361,7 +12361,7 @@ func (l *LogicalNetworkCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LogicalNetworkProperties. func (l LogicalNetworkProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "friendlyName", l.FriendlyName) populate(objectMap, "logicalNetworkDefinitionsStatus", l.LogicalNetworkDefinitionsStatus) populate(objectMap, "logicalNetworkUsage", l.LogicalNetworkUsage) @@ -12400,7 +12400,7 @@ func (l *LogicalNetworkProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ManualActionTaskDetails. func (m ManualActionTaskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "ManualActionTaskDetails" populate(objectMap, "instructions", m.Instructions) populate(objectMap, "name", m.Name) @@ -12439,7 +12439,7 @@ func (m *ManualActionTaskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MarsAgentDetails. func (m MarsAgentDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "biosId", m.BiosID) populate(objectMap, "fabricObjectId", m.FabricObjectID) populate(objectMap, "fqdn", m.Fqdn) @@ -12498,7 +12498,7 @@ func (m *MarsAgentDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MasterTargetServer. func (m MasterTargetServer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "agentExpiryDate", m.AgentExpiryDate) populate(objectMap, "agentVersion", m.AgentVersion) populate(objectMap, "agentVersionDetails", m.AgentVersionDetails) @@ -12593,7 +12593,7 @@ func (m *MasterTargetServer) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MigrateInput. func (m MigrateInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", m.Properties) return json.Marshal(objectMap) } @@ -12620,7 +12620,7 @@ func (m *MigrateInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MigrateInputProperties. func (m MigrateInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "providerSpecificDetails", m.ProviderSpecificDetails) return json.Marshal(objectMap) } @@ -12647,7 +12647,7 @@ func (m *MigrateInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MigrateProviderSpecificInput. func (m MigrateProviderSpecificInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = m.InstanceType return json.Marshal(objectMap) } @@ -12674,7 +12674,7 @@ func (m *MigrateProviderSpecificInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MigrationItem. func (m MigrationItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", m.ID) populate(objectMap, "location", m.Location) populate(objectMap, "name", m.Name) @@ -12717,7 +12717,7 @@ func (m *MigrationItem) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MigrationItemCollection. func (m MigrationItemCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", m.NextLink) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) @@ -12748,7 +12748,7 @@ func (m *MigrationItemCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MigrationItemProperties. func (m MigrationItemProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "allowedOperations", m.AllowedOperations) populate(objectMap, "criticalJobHistory", m.CriticalJobHistory) populate(objectMap, "currentJob", m.CurrentJob) @@ -12851,7 +12851,7 @@ func (m *MigrationItemProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MigrationItemsQueryParameter. func (m MigrationItemsQueryParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "instanceType", m.InstanceType) populate(objectMap, "sourceContainerName", m.SourceContainerName) populate(objectMap, "sourceFabricName", m.SourceFabricName) @@ -12886,7 +12886,7 @@ func (m *MigrationItemsQueryParameter) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MigrationProviderSpecificSettings. func (m MigrationProviderSpecificSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = m.InstanceType return json.Marshal(objectMap) } @@ -12913,7 +12913,7 @@ func (m *MigrationProviderSpecificSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MigrationRecoveryPoint. func (m MigrationRecoveryPoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", m.ID) populate(objectMap, "location", m.Location) populate(objectMap, "name", m.Name) @@ -12956,7 +12956,7 @@ func (m *MigrationRecoveryPoint) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MigrationRecoveryPointCollection. func (m MigrationRecoveryPointCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", m.NextLink) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) @@ -12987,7 +12987,7 @@ func (m *MigrationRecoveryPointCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MigrationRecoveryPointProperties. func (m MigrationRecoveryPointProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "recoveryPointTime", m.RecoveryPointTime) populate(objectMap, "recoveryPointType", m.RecoveryPointType) return json.Marshal(objectMap) @@ -13018,7 +13018,7 @@ func (m *MigrationRecoveryPointProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MobilityServiceUpdate. func (m MobilityServiceUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "osType", m.OSType) populate(objectMap, "rebootStatus", m.RebootStatus) populate(objectMap, "version", m.Version) @@ -13053,7 +13053,7 @@ func (m *MobilityServiceUpdate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Network. func (n Network) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", n.ID) populate(objectMap, "location", n.Location) populate(objectMap, "name", n.Name) @@ -13096,7 +13096,7 @@ func (n *Network) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NetworkCollection. func (n NetworkCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", n.NextLink) populate(objectMap, "value", n.Value) return json.Marshal(objectMap) @@ -13127,7 +13127,7 @@ func (n *NetworkCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NetworkMapping. func (n NetworkMapping) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", n.ID) populate(objectMap, "location", n.Location) populate(objectMap, "name", n.Name) @@ -13170,7 +13170,7 @@ func (n *NetworkMapping) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NetworkMappingCollection. func (n NetworkMappingCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", n.NextLink) populate(objectMap, "value", n.Value) return json.Marshal(objectMap) @@ -13201,7 +13201,7 @@ func (n *NetworkMappingCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NetworkMappingFabricSpecificSettings. func (n NetworkMappingFabricSpecificSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = n.InstanceType return json.Marshal(objectMap) } @@ -13228,7 +13228,7 @@ func (n *NetworkMappingFabricSpecificSettings) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type NetworkMappingProperties. func (n NetworkMappingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "fabricSpecificSettings", n.FabricSpecificSettings) populate(objectMap, "primaryFabricFriendlyName", n.PrimaryFabricFriendlyName) populate(objectMap, "primaryNetworkFriendlyName", n.PrimaryNetworkFriendlyName) @@ -13287,7 +13287,7 @@ func (n *NetworkMappingProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NetworkProperties. func (n NetworkProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "fabricType", n.FabricType) populate(objectMap, "friendlyName", n.FriendlyName) populate(objectMap, "networkType", n.NetworkType) @@ -13326,7 +13326,7 @@ func (n *NetworkProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NewProtectionProfile. func (n NewProtectionProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "appConsistentFrequencyInMinutes", n.AppConsistentFrequencyInMinutes) populate(objectMap, "crashConsistentFrequencyInMinutes", n.CrashConsistentFrequencyInMinutes) populate(objectMap, "multiVmSyncStatus", n.MultiVMSyncStatus) @@ -13373,7 +13373,7 @@ func (n *NewProtectionProfile) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NewRecoveryVirtualNetwork. func (n NewRecoveryVirtualNetwork) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "recoveryVirtualNetworkName", n.RecoveryVirtualNetworkName) populate(objectMap, "recoveryVirtualNetworkResourceGroupName", n.RecoveryVirtualNetworkResourceGroupName) objectMap["resourceType"] = "New" @@ -13408,7 +13408,7 @@ func (n *NewRecoveryVirtualNetwork) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OSDetails. func (o OSDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "osEdition", o.OSEdition) populate(objectMap, "oSMajorVersion", o.OSMajorVersion) populate(objectMap, "oSMinorVersion", o.OSMinorVersion) @@ -13455,7 +13455,7 @@ func (o *OSDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OSDiskDetails. func (o OSDiskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "osType", o.OSType) populate(objectMap, "osVhdId", o.OSVhdID) populate(objectMap, "vhdName", o.VhdName) @@ -13490,7 +13490,7 @@ func (o *OSDiskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OSVersionWrapper. func (o OSVersionWrapper) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "servicePack", o.ServicePack) populate(objectMap, "version", o.Version) return json.Marshal(objectMap) @@ -13521,7 +13521,7 @@ func (o *OSVersionWrapper) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OperationsDiscovery. func (o OperationsDiscovery) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "display", o.Display) populate(objectMap, "name", o.Name) populate(objectMap, "origin", o.Origin) @@ -13560,7 +13560,7 @@ func (o *OperationsDiscovery) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OperationsDiscoveryCollection. func (o OperationsDiscoveryCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", o.NextLink) populate(objectMap, "value", o.Value) return json.Marshal(objectMap) @@ -13591,7 +13591,7 @@ func (o *OperationsDiscoveryCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PauseReplicationInput. func (p PauseReplicationInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", p.Properties) return json.Marshal(objectMap) } @@ -13618,7 +13618,7 @@ func (p *PauseReplicationInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PauseReplicationInputProperties. func (p PauseReplicationInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "instanceType", p.InstanceType) return json.Marshal(objectMap) } @@ -13645,7 +13645,7 @@ func (p *PauseReplicationInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PlannedFailoverInput. func (p PlannedFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", p.Properties) return json.Marshal(objectMap) } @@ -13672,7 +13672,7 @@ func (p *PlannedFailoverInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PlannedFailoverInputProperties. func (p PlannedFailoverInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "failoverDirection", p.FailoverDirection) populate(objectMap, "providerSpecificDetails", p.ProviderSpecificDetails) return json.Marshal(objectMap) @@ -13703,7 +13703,7 @@ func (p *PlannedFailoverInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PlannedFailoverProviderSpecificFailoverInput. func (p PlannedFailoverProviderSpecificFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = p.InstanceType return json.Marshal(objectMap) } @@ -13730,7 +13730,7 @@ func (p *PlannedFailoverProviderSpecificFailoverInput) UnmarshalJSON(data []byte // MarshalJSON implements the json.Marshaller interface for type Policy. func (p Policy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "location", p.Location) populate(objectMap, "name", p.Name) @@ -13773,7 +13773,7 @@ func (p *Policy) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PolicyCollection. func (p PolicyCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", p.NextLink) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) @@ -13804,7 +13804,7 @@ func (p *PolicyCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PolicyProperties. func (p PolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "friendlyName", p.FriendlyName) populate(objectMap, "providerSpecificDetails", p.ProviderSpecificDetails) return json.Marshal(objectMap) @@ -13835,7 +13835,7 @@ func (p *PolicyProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PolicyProviderSpecificDetails. func (p PolicyProviderSpecificDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = p.InstanceType return json.Marshal(objectMap) } @@ -13862,7 +13862,7 @@ func (p *PolicyProviderSpecificDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PolicyProviderSpecificInput. func (p PolicyProviderSpecificInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = p.InstanceType return json.Marshal(objectMap) } @@ -13889,7 +13889,7 @@ func (p *PolicyProviderSpecificInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProcessServer. func (p ProcessServer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "agentExpiryDate", p.AgentExpiryDate) populate(objectMap, "agentVersion", p.AgentVersion) populate(objectMap, "agentVersionDetails", p.AgentVersionDetails) @@ -14056,7 +14056,7 @@ func (p *ProcessServer) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProcessServerDetails. func (p ProcessServerDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "availableMemoryInBytes", p.AvailableMemoryInBytes) populate(objectMap, "availableSpaceInBytes", p.AvailableSpaceInBytes) populate(objectMap, "biosId", p.BiosID) @@ -14195,7 +14195,7 @@ func (p *ProcessServerDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProtectableItem. func (p ProtectableItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "location", p.Location) populate(objectMap, "name", p.Name) @@ -14238,7 +14238,7 @@ func (p *ProtectableItem) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProtectableItemCollection. func (p ProtectableItemCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", p.NextLink) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) @@ -14269,7 +14269,7 @@ func (p *ProtectableItemCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProtectableItemProperties. func (p ProtectableItemProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "customDetails", p.CustomDetails) populate(objectMap, "friendlyName", p.FriendlyName) populate(objectMap, "protectionReadinessErrors", p.ProtectionReadinessErrors) @@ -14320,7 +14320,7 @@ func (p *ProtectableItemProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProtectableItemQueryParameter. func (p ProtectableItemQueryParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "state", p.State) return json.Marshal(objectMap) } @@ -14347,7 +14347,7 @@ func (p *ProtectableItemQueryParameter) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProtectedItemsQueryParameter. func (p ProtectedItemsQueryParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "fabricObjectId", p.FabricObjectID) populate(objectMap, "instanceType", p.InstanceType) populate(objectMap, "multiVmGroupCreateOption", p.MultiVMGroupCreateOption) @@ -14402,7 +14402,7 @@ func (p *ProtectedItemsQueryParameter) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProtectionContainer. func (p ProtectionContainer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "location", p.Location) populate(objectMap, "name", p.Name) @@ -14445,7 +14445,7 @@ func (p *ProtectionContainer) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProtectionContainerCollection. func (p ProtectionContainerCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", p.NextLink) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) @@ -14476,7 +14476,7 @@ func (p *ProtectionContainerCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProtectionContainerFabricSpecificDetails. func (p ProtectionContainerFabricSpecificDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "instanceType", p.InstanceType) return json.Marshal(objectMap) } @@ -14503,7 +14503,7 @@ func (p *ProtectionContainerFabricSpecificDetails) UnmarshalJSON(data []byte) er // MarshalJSON implements the json.Marshaller interface for type ProtectionContainerMapping. func (p ProtectionContainerMapping) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "location", p.Location) populate(objectMap, "name", p.Name) @@ -14546,7 +14546,7 @@ func (p *ProtectionContainerMapping) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProtectionContainerMappingCollection. func (p ProtectionContainerMappingCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", p.NextLink) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) @@ -14577,7 +14577,7 @@ func (p *ProtectionContainerMappingCollection) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type ProtectionContainerMappingProperties. func (p ProtectionContainerMappingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "health", p.Health) populate(objectMap, "healthErrorDetails", p.HealthErrorDetails) populate(objectMap, "policyFriendlyName", p.PolicyFriendlyName) @@ -14644,7 +14644,7 @@ func (p *ProtectionContainerMappingProperties) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type ProtectionContainerMappingProviderSpecificDetails. func (p ProtectionContainerMappingProviderSpecificDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = p.InstanceType return json.Marshal(objectMap) } @@ -14671,7 +14671,7 @@ func (p *ProtectionContainerMappingProviderSpecificDetails) UnmarshalJSON(data [ // MarshalJSON implements the json.Marshaller interface for type ProtectionContainerProperties. func (p ProtectionContainerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "fabricFriendlyName", p.FabricFriendlyName) populate(objectMap, "fabricSpecificDetails", p.FabricSpecificDetails) populate(objectMap, "fabricType", p.FabricType) @@ -14722,7 +14722,7 @@ func (p *ProtectionContainerProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProtectionProfileCustomDetails. func (p ProtectionProfileCustomDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["resourceType"] = p.ResourceType return json.Marshal(objectMap) } @@ -14749,7 +14749,7 @@ func (p *ProtectionProfileCustomDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProviderError. func (p ProviderError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "errorCode", p.ErrorCode) populate(objectMap, "errorId", p.ErrorID) populate(objectMap, "errorMessage", p.ErrorMessage) @@ -14792,7 +14792,7 @@ func (p *ProviderError) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProviderSpecificRecoveryPointDetails. func (p ProviderSpecificRecoveryPointDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = p.InstanceType return json.Marshal(objectMap) } @@ -14819,7 +14819,7 @@ func (p *ProviderSpecificRecoveryPointDetails) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type PushInstallerDetails. func (p PushInstallerDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "biosId", p.BiosID) populate(objectMap, "fabricObjectId", p.FabricObjectID) populate(objectMap, "fqdn", p.Fqdn) @@ -14878,7 +14878,7 @@ func (p *PushInstallerDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RcmProxyDetails. func (r RcmProxyDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "biosId", r.BiosID) populate(objectMap, "clientAuthenticationType", r.ClientAuthenticationType) populate(objectMap, "fabricObjectId", r.FabricObjectID) @@ -14941,7 +14941,7 @@ func (r *RcmProxyDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryAvailabilitySetCustomDetails. func (r RecoveryAvailabilitySetCustomDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["resourceType"] = r.ResourceType return json.Marshal(objectMap) } @@ -14968,7 +14968,7 @@ func (r *RecoveryAvailabilitySetCustomDetails) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type RecoveryPlan. func (r RecoveryPlan) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) @@ -15011,7 +15011,7 @@ func (r *RecoveryPlan) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanA2ADetails. func (r RecoveryPlanA2ADetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "A2A" populate(objectMap, "primaryExtendedLocation", r.PrimaryExtendedLocation) populate(objectMap, "primaryZone", r.PrimaryZone) @@ -15054,7 +15054,7 @@ func (r *RecoveryPlanA2ADetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanA2AFailoverInput. func (r RecoveryPlanA2AFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "cloudServiceCreationOption", r.CloudServiceCreationOption) objectMap["instanceType"] = "A2A" populate(objectMap, "multiVmSyncPointOption", r.MultiVMSyncPointOption) @@ -15093,7 +15093,7 @@ func (r *RecoveryPlanA2AFailoverInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanA2AInput. func (r RecoveryPlanA2AInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "A2A" populate(objectMap, "primaryExtendedLocation", r.PrimaryExtendedLocation) populate(objectMap, "primaryZone", r.PrimaryZone) @@ -15136,7 +15136,7 @@ func (r *RecoveryPlanA2AInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanAction. func (r RecoveryPlanAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "actionName", r.ActionName) populate(objectMap, "customDetails", r.CustomDetails) populate(objectMap, "failoverDirections", r.FailoverDirections) @@ -15175,7 +15175,7 @@ func (r *RecoveryPlanAction) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanActionDetails. func (r RecoveryPlanActionDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = r.InstanceType return json.Marshal(objectMap) } @@ -15202,7 +15202,7 @@ func (r *RecoveryPlanActionDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanAutomationRunbookActionDetails. func (r RecoveryPlanAutomationRunbookActionDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "fabricLocation", r.FabricLocation) objectMap["instanceType"] = "AutomationRunbookActionDetails" populate(objectMap, "runbookId", r.RunbookID) @@ -15241,7 +15241,7 @@ func (r *RecoveryPlanAutomationRunbookActionDetails) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanCollection. func (r RecoveryPlanCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", r.NextLink) populate(objectMap, "value", r.Value) return json.Marshal(objectMap) @@ -15272,7 +15272,7 @@ func (r *RecoveryPlanCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanGroup. func (r RecoveryPlanGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "endGroupActions", r.EndGroupActions) populate(objectMap, "groupType", r.GroupType) populate(objectMap, "replicationProtectedItems", r.ReplicationProtectedItems) @@ -15311,7 +15311,7 @@ func (r *RecoveryPlanGroup) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanGroupTaskDetails. func (r RecoveryPlanGroupTaskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "childTasks", r.ChildTasks) populate(objectMap, "groupId", r.GroupID) objectMap["instanceType"] = "RecoveryPlanGroupTaskDetails" @@ -15354,7 +15354,7 @@ func (r *RecoveryPlanGroupTaskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanHyperVReplicaAzureFailbackInput. func (r RecoveryPlanHyperVReplicaAzureFailbackInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "dataSyncOption", r.DataSyncOption) objectMap["instanceType"] = "HyperVReplicaAzureFailback" populate(objectMap, "recoveryVmCreationOption", r.RecoveryVMCreationOption) @@ -15389,7 +15389,7 @@ func (r *RecoveryPlanHyperVReplicaAzureFailbackInput) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanHyperVReplicaAzureFailoverInput. func (r RecoveryPlanHyperVReplicaAzureFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "HyperVReplicaAzure" populate(objectMap, "primaryKekCertificatePfx", r.PrimaryKekCertificatePfx) populate(objectMap, "recoveryPointType", r.RecoveryPointType) @@ -15428,7 +15428,7 @@ func (r *RecoveryPlanHyperVReplicaAzureFailoverInput) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanInMageAzureV2FailoverInput. func (r RecoveryPlanInMageAzureV2FailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "InMageAzureV2" populate(objectMap, "recoveryPointType", r.RecoveryPointType) populate(objectMap, "useMultiVmSyncPoint", r.UseMultiVMSyncPoint) @@ -15463,7 +15463,7 @@ func (r *RecoveryPlanInMageAzureV2FailoverInput) UnmarshalJSON(data []byte) erro // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanInMageFailoverInput. func (r RecoveryPlanInMageFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "InMage" populate(objectMap, "recoveryPointType", r.RecoveryPointType) return json.Marshal(objectMap) @@ -15494,7 +15494,7 @@ func (r *RecoveryPlanInMageFailoverInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanInMageRcmFailbackFailoverInput. func (r RecoveryPlanInMageRcmFailbackFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "InMageRcmFailback" populate(objectMap, "recoveryPointType", r.RecoveryPointType) populate(objectMap, "useMultiVmSyncPoint", r.UseMultiVMSyncPoint) @@ -15529,7 +15529,7 @@ func (r *RecoveryPlanInMageRcmFailbackFailoverInput) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanInMageRcmFailoverInput. func (r RecoveryPlanInMageRcmFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "InMageRcm" populate(objectMap, "recoveryPointType", r.RecoveryPointType) populate(objectMap, "useMultiVmSyncPoint", r.UseMultiVMSyncPoint) @@ -15564,7 +15564,7 @@ func (r *RecoveryPlanInMageRcmFailoverInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanManualActionDetails. func (r RecoveryPlanManualActionDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "description", r.Description) objectMap["instanceType"] = "ManualActionDetails" return json.Marshal(objectMap) @@ -15595,7 +15595,7 @@ func (r *RecoveryPlanManualActionDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanPlannedFailoverInput. func (r RecoveryPlanPlannedFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", r.Properties) return json.Marshal(objectMap) } @@ -15622,7 +15622,7 @@ func (r *RecoveryPlanPlannedFailoverInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanPlannedFailoverInputProperties. func (r RecoveryPlanPlannedFailoverInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "failoverDirection", r.FailoverDirection) populate(objectMap, "providerSpecificDetails", r.ProviderSpecificDetails) return json.Marshal(objectMap) @@ -15653,7 +15653,7 @@ func (r *RecoveryPlanPlannedFailoverInputProperties) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanProperties. func (r RecoveryPlanProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "allowedOperations", r.AllowedOperations) populate(objectMap, "currentScenario", r.CurrentScenario) populate(objectMap, "currentScenarioStatus", r.CurrentScenarioStatus) @@ -15740,7 +15740,7 @@ func (r *RecoveryPlanProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanProtectedItem. func (r RecoveryPlanProtectedItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "virtualMachineId", r.VirtualMachineID) return json.Marshal(objectMap) @@ -15771,7 +15771,7 @@ func (r *RecoveryPlanProtectedItem) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanProviderSpecificDetails. func (r RecoveryPlanProviderSpecificDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = r.InstanceType return json.Marshal(objectMap) } @@ -15798,7 +15798,7 @@ func (r *RecoveryPlanProviderSpecificDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanProviderSpecificFailoverInput. func (r RecoveryPlanProviderSpecificFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = r.InstanceType return json.Marshal(objectMap) } @@ -15825,7 +15825,7 @@ func (r *RecoveryPlanProviderSpecificFailoverInput) UnmarshalJSON(data []byte) e // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanProviderSpecificInput. func (r RecoveryPlanProviderSpecificInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = r.InstanceType return json.Marshal(objectMap) } @@ -15852,7 +15852,7 @@ func (r *RecoveryPlanProviderSpecificInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanScriptActionDetails. func (r RecoveryPlanScriptActionDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "fabricLocation", r.FabricLocation) objectMap["instanceType"] = "ScriptActionDetails" populate(objectMap, "path", r.Path) @@ -15891,7 +15891,7 @@ func (r *RecoveryPlanScriptActionDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanShutdownGroupTaskDetails. func (r RecoveryPlanShutdownGroupTaskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "childTasks", r.ChildTasks) populate(objectMap, "groupId", r.GroupID) objectMap["instanceType"] = "RecoveryPlanShutdownGroupTaskDetails" @@ -15934,7 +15934,7 @@ func (r *RecoveryPlanShutdownGroupTaskDetails) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanTestFailoverCleanupInput. func (r RecoveryPlanTestFailoverCleanupInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", r.Properties) return json.Marshal(objectMap) } @@ -15961,7 +15961,7 @@ func (r *RecoveryPlanTestFailoverCleanupInput) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanTestFailoverCleanupInputProperties. func (r RecoveryPlanTestFailoverCleanupInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "comments", r.Comments) return json.Marshal(objectMap) } @@ -15988,7 +15988,7 @@ func (r *RecoveryPlanTestFailoverCleanupInputProperties) UnmarshalJSON(data []by // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanTestFailoverInput. func (r RecoveryPlanTestFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", r.Properties) return json.Marshal(objectMap) } @@ -16015,7 +16015,7 @@ func (r *RecoveryPlanTestFailoverInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanTestFailoverInputProperties. func (r RecoveryPlanTestFailoverInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "failoverDirection", r.FailoverDirection) populate(objectMap, "networkId", r.NetworkID) populate(objectMap, "networkType", r.NetworkType) @@ -16054,7 +16054,7 @@ func (r *RecoveryPlanTestFailoverInputProperties) UnmarshalJSON(data []byte) err // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanUnplannedFailoverInput. func (r RecoveryPlanUnplannedFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", r.Properties) return json.Marshal(objectMap) } @@ -16081,7 +16081,7 @@ func (r *RecoveryPlanUnplannedFailoverInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPlanUnplannedFailoverInputProperties. func (r RecoveryPlanUnplannedFailoverInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "failoverDirection", r.FailoverDirection) populate(objectMap, "providerSpecificDetails", r.ProviderSpecificDetails) populate(objectMap, "sourceSiteOperations", r.SourceSiteOperations) @@ -16116,7 +16116,7 @@ func (r *RecoveryPlanUnplannedFailoverInputProperties) UnmarshalJSON(data []byte // MarshalJSON implements the json.Marshaller interface for type RecoveryPoint. func (r RecoveryPoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) @@ -16159,7 +16159,7 @@ func (r *RecoveryPoint) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPointCollection. func (r RecoveryPointCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", r.NextLink) populate(objectMap, "value", r.Value) return json.Marshal(objectMap) @@ -16190,7 +16190,7 @@ func (r *RecoveryPointCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPointProperties. func (r RecoveryPointProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "providerSpecificDetails", r.ProviderSpecificDetails) populateTimeRFC3339(objectMap, "recoveryPointTime", r.RecoveryPointTime) populate(objectMap, "recoveryPointType", r.RecoveryPointType) @@ -16225,7 +16225,7 @@ func (r *RecoveryPointProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryProximityPlacementGroupCustomDetails. func (r RecoveryProximityPlacementGroupCustomDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["resourceType"] = r.ResourceType return json.Marshal(objectMap) } @@ -16252,7 +16252,7 @@ func (r *RecoveryProximityPlacementGroupCustomDetails) UnmarshalJSON(data []byte // MarshalJSON implements the json.Marshaller interface for type RecoveryResourceGroupCustomDetails. func (r RecoveryResourceGroupCustomDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["resourceType"] = r.ResourceType return json.Marshal(objectMap) } @@ -16279,7 +16279,7 @@ func (r *RecoveryResourceGroupCustomDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryServicesProvider. func (r RecoveryServicesProvider) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) @@ -16322,7 +16322,7 @@ func (r *RecoveryServicesProvider) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryServicesProviderCollection. func (r RecoveryServicesProviderCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", r.NextLink) populate(objectMap, "value", r.Value) return json.Marshal(objectMap) @@ -16353,7 +16353,7 @@ func (r *RecoveryServicesProviderCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryServicesProviderProperties. func (r RecoveryServicesProviderProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "allowedScenarios", r.AllowedScenarios) populate(objectMap, "authenticationIdentityDetails", r.AuthenticationIdentityDetails) populate(objectMap, "biosId", r.BiosID) @@ -16456,7 +16456,7 @@ func (r *RecoveryServicesProviderProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryVirtualNetworkCustomDetails. func (r RecoveryVirtualNetworkCustomDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["resourceType"] = r.ResourceType return json.Marshal(objectMap) } @@ -16483,7 +16483,7 @@ func (r *RecoveryVirtualNetworkCustomDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RemoveDisksInput. func (r RemoveDisksInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", r.Properties) return json.Marshal(objectMap) } @@ -16510,7 +16510,7 @@ func (r *RemoveDisksInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RemoveDisksInputProperties. func (r RemoveDisksInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "providerSpecificDetails", r.ProviderSpecificDetails) return json.Marshal(objectMap) } @@ -16537,7 +16537,7 @@ func (r *RemoveDisksInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RemoveDisksProviderSpecificInput. func (r RemoveDisksProviderSpecificInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = r.InstanceType return json.Marshal(objectMap) } @@ -16564,7 +16564,7 @@ func (r *RemoveDisksProviderSpecificInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RemoveProtectionContainerMappingInput. func (r RemoveProtectionContainerMappingInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", r.Properties) return json.Marshal(objectMap) } @@ -16591,7 +16591,7 @@ func (r *RemoveProtectionContainerMappingInput) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type RemoveProtectionContainerMappingInputProperties. func (r RemoveProtectionContainerMappingInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "providerSpecificInput", r.ProviderSpecificInput) return json.Marshal(objectMap) } @@ -16618,7 +16618,7 @@ func (r *RemoveProtectionContainerMappingInputProperties) UnmarshalJSON(data []b // MarshalJSON implements the json.Marshaller interface for type RenewCertificateInput. func (r RenewCertificateInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", r.Properties) return json.Marshal(objectMap) } @@ -16645,7 +16645,7 @@ func (r *RenewCertificateInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RenewCertificateInputProperties. func (r RenewCertificateInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "renewCertificateType", r.RenewCertificateType) return json.Marshal(objectMap) } @@ -16672,7 +16672,7 @@ func (r *RenewCertificateInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ReplicationAgentDetails. func (r ReplicationAgentDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "biosId", r.BiosID) populate(objectMap, "fabricObjectId", r.FabricObjectID) populate(objectMap, "fqdn", r.Fqdn) @@ -16731,7 +16731,7 @@ func (r *ReplicationAgentDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ReplicationAppliance. func (r ReplicationAppliance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", r.Properties) return json.Marshal(objectMap) } @@ -16758,7 +16758,7 @@ func (r *ReplicationAppliance) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ReplicationApplianceProperties. func (r ReplicationApplianceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "providerSpecificDetails", r.ProviderSpecificDetails) return json.Marshal(objectMap) } @@ -16785,7 +16785,7 @@ func (r *ReplicationApplianceProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ReplicationEligibilityResults. func (r ReplicationEligibilityResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) populate(objectMap, "properties", r.Properties) @@ -16824,7 +16824,7 @@ func (r *ReplicationEligibilityResults) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ReplicationEligibilityResultsCollection. func (r ReplicationEligibilityResultsCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } @@ -16851,7 +16851,7 @@ func (r *ReplicationEligibilityResultsCollection) UnmarshalJSON(data []byte) err // MarshalJSON implements the json.Marshaller interface for type ReplicationEligibilityResultsErrorInfo. func (r ReplicationEligibilityResultsErrorInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "code", r.Code) populate(objectMap, "message", r.Message) populate(objectMap, "possibleCauses", r.PossibleCauses) @@ -16894,7 +16894,7 @@ func (r *ReplicationEligibilityResultsErrorInfo) UnmarshalJSON(data []byte) erro // MarshalJSON implements the json.Marshaller interface for type ReplicationEligibilityResultsProperties. func (r ReplicationEligibilityResultsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "clientRequestId", r.ClientRequestID) populate(objectMap, "errors", r.Errors) return json.Marshal(objectMap) @@ -16925,7 +16925,7 @@ func (r *ReplicationEligibilityResultsProperties) UnmarshalJSON(data []byte) err // MarshalJSON implements the json.Marshaller interface for type ReplicationGroupDetails. func (r ReplicationGroupDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "ReplicationGroupDetails" return json.Marshal(objectMap) } @@ -16952,7 +16952,7 @@ func (r *ReplicationGroupDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ReplicationProtectedItem. func (r ReplicationProtectedItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) @@ -16995,7 +16995,7 @@ func (r *ReplicationProtectedItem) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ReplicationProtectedItemCollection. func (r ReplicationProtectedItemCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", r.NextLink) populate(objectMap, "value", r.Value) return json.Marshal(objectMap) @@ -17026,7 +17026,7 @@ func (r *ReplicationProtectedItemCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ReplicationProtectedItemProperties. func (r ReplicationProtectedItemProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "activeLocation", r.ActiveLocation) populate(objectMap, "allowedOperations", r.AllowedOperations) populate(objectMap, "currentScenario", r.CurrentScenario) @@ -17169,7 +17169,7 @@ func (r *ReplicationProtectedItemProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ReplicationProtectionIntent. func (r ReplicationProtectionIntent) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) @@ -17212,7 +17212,7 @@ func (r *ReplicationProtectionIntent) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ReplicationProtectionIntentCollection. func (r ReplicationProtectionIntentCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", r.NextLink) populate(objectMap, "value", r.Value) return json.Marshal(objectMap) @@ -17243,7 +17243,7 @@ func (r *ReplicationProtectionIntentCollection) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type ReplicationProtectionIntentProperties. func (r ReplicationProtectionIntentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "creationTimeUTC", r.CreationTimeUTC) populate(objectMap, "friendlyName", r.FriendlyName) populate(objectMap, "isActive", r.IsActive) @@ -17290,7 +17290,7 @@ func (r *ReplicationProtectionIntentProperties) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type ReplicationProtectionIntentProviderSpecificSettings. func (r ReplicationProtectionIntentProviderSpecificSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = r.InstanceType return json.Marshal(objectMap) } @@ -17317,7 +17317,7 @@ func (r *ReplicationProtectionIntentProviderSpecificSettings) UnmarshalJSON(data // MarshalJSON implements the json.Marshaller interface for type ReplicationProviderContainerUnmappingInput. func (r ReplicationProviderContainerUnmappingInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "instanceType", r.InstanceType) return json.Marshal(objectMap) } @@ -17344,7 +17344,7 @@ func (r *ReplicationProviderContainerUnmappingInput) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type ReplicationProviderSpecificContainerCreationInput. func (r ReplicationProviderSpecificContainerCreationInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = r.InstanceType return json.Marshal(objectMap) } @@ -17371,7 +17371,7 @@ func (r *ReplicationProviderSpecificContainerCreationInput) UnmarshalJSON(data [ // MarshalJSON implements the json.Marshaller interface for type ReplicationProviderSpecificContainerMappingInput. func (r ReplicationProviderSpecificContainerMappingInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = r.InstanceType return json.Marshal(objectMap) } @@ -17398,7 +17398,7 @@ func (r *ReplicationProviderSpecificContainerMappingInput) UnmarshalJSON(data [] // MarshalJSON implements the json.Marshaller interface for type ReplicationProviderSpecificSettings. func (r ReplicationProviderSpecificSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = r.InstanceType return json.Marshal(objectMap) } @@ -17425,7 +17425,7 @@ func (r *ReplicationProviderSpecificSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ReplicationProviderSpecificUpdateContainerMappingInput. func (r ReplicationProviderSpecificUpdateContainerMappingInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = r.InstanceType return json.Marshal(objectMap) } @@ -17452,7 +17452,7 @@ func (r *ReplicationProviderSpecificUpdateContainerMappingInput) UnmarshalJSON(d // MarshalJSON implements the json.Marshaller interface for type ReprotectAgentDetails. func (r ReprotectAgentDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "accessibleDatastores", r.AccessibleDatastores) populate(objectMap, "biosId", r.BiosID) populate(objectMap, "fabricObjectId", r.FabricObjectID) @@ -17527,7 +17527,7 @@ func (r *ReprotectAgentDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResolveHealthError. func (r ResolveHealthError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "healthErrorId", r.HealthErrorID) return json.Marshal(objectMap) } @@ -17554,7 +17554,7 @@ func (r *ResolveHealthError) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResolveHealthInput. func (r ResolveHealthInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", r.Properties) return json.Marshal(objectMap) } @@ -17581,7 +17581,7 @@ func (r *ResolveHealthInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResolveHealthInputProperties. func (r ResolveHealthInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "healthErrors", r.HealthErrors) return json.Marshal(objectMap) } @@ -17608,7 +17608,7 @@ func (r *ResolveHealthInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Resource. func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) @@ -17647,7 +17647,7 @@ func (r *Resource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceHealthSummary. func (r ResourceHealthSummary) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "categorizedResourceCounts", r.CategorizedResourceCounts) populate(objectMap, "issues", r.Issues) populate(objectMap, "resourceCount", r.ResourceCount) @@ -17682,7 +17682,7 @@ func (r *ResourceHealthSummary) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResumeJobParams. func (r ResumeJobParams) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", r.Properties) return json.Marshal(objectMap) } @@ -17709,7 +17709,7 @@ func (r *ResumeJobParams) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResumeJobParamsProperties. func (r ResumeJobParamsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "comments", r.Comments) return json.Marshal(objectMap) } @@ -17736,7 +17736,7 @@ func (r *ResumeJobParamsProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResumeReplicationInput. func (r ResumeReplicationInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", r.Properties) return json.Marshal(objectMap) } @@ -17763,7 +17763,7 @@ func (r *ResumeReplicationInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResumeReplicationInputProperties. func (r ResumeReplicationInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "providerSpecificDetails", r.ProviderSpecificDetails) return json.Marshal(objectMap) } @@ -17790,7 +17790,7 @@ func (r *ResumeReplicationInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResumeReplicationProviderSpecificInput. func (r ResumeReplicationProviderSpecificInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = r.InstanceType return json.Marshal(objectMap) } @@ -17817,7 +17817,7 @@ func (r *ResumeReplicationProviderSpecificInput) UnmarshalJSON(data []byte) erro // MarshalJSON implements the json.Marshaller interface for type ResyncInput. func (r ResyncInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", r.Properties) return json.Marshal(objectMap) } @@ -17844,7 +17844,7 @@ func (r *ResyncInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResyncInputProperties. func (r ResyncInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "providerSpecificDetails", r.ProviderSpecificDetails) return json.Marshal(objectMap) } @@ -17871,7 +17871,7 @@ func (r *ResyncInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResyncProviderSpecificInput. func (r ResyncProviderSpecificInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = r.InstanceType return json.Marshal(objectMap) } @@ -17898,7 +17898,7 @@ func (r *ResyncProviderSpecificInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RetentionVolume. func (r RetentionVolume) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "capacityInBytes", r.CapacityInBytes) populate(objectMap, "freeSpaceInBytes", r.FreeSpaceInBytes) populate(objectMap, "thresholdPercentage", r.ThresholdPercentage) @@ -17937,7 +17937,7 @@ func (r *RetentionVolume) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ReverseReplicationInput. func (r ReverseReplicationInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", r.Properties) return json.Marshal(objectMap) } @@ -17964,7 +17964,7 @@ func (r *ReverseReplicationInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ReverseReplicationInputProperties. func (r ReverseReplicationInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "failoverDirection", r.FailoverDirection) populate(objectMap, "providerSpecificDetails", r.ProviderSpecificDetails) return json.Marshal(objectMap) @@ -17995,7 +17995,7 @@ func (r *ReverseReplicationInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ReverseReplicationProviderSpecificInput. func (r ReverseReplicationProviderSpecificInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = r.InstanceType return json.Marshal(objectMap) } @@ -18022,7 +18022,7 @@ func (r *ReverseReplicationProviderSpecificInput) UnmarshalJSON(data []byte) err // MarshalJSON implements the json.Marshaller interface for type RoleAssignment. func (r RoleAssignment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) populate(objectMap, "principalId", r.PrincipalID) @@ -18065,7 +18065,7 @@ func (r *RoleAssignment) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RunAsAccount. func (r RunAsAccount) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "accountId", r.AccountID) populate(objectMap, "accountName", r.AccountName) return json.Marshal(objectMap) @@ -18096,7 +18096,7 @@ func (r *RunAsAccount) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ScriptActionTaskDetails. func (s ScriptActionTaskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "ScriptActionTaskDetails" populate(objectMap, "isPrimarySideScript", s.IsPrimarySideScript) populate(objectMap, "name", s.Name) @@ -18139,7 +18139,7 @@ func (s *ScriptActionTaskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ServiceError. func (s ServiceError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "activityId", s.ActivityID) populate(objectMap, "code", s.Code) populate(objectMap, "message", s.Message) @@ -18182,7 +18182,7 @@ func (s *ServiceError) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type StorageAccountCustomDetails. func (s StorageAccountCustomDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["resourceType"] = s.ResourceType return json.Marshal(objectMap) } @@ -18209,7 +18209,7 @@ func (s *StorageAccountCustomDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type StorageClassification. func (s StorageClassification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) @@ -18252,7 +18252,7 @@ func (s *StorageClassification) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type StorageClassificationCollection. func (s StorageClassificationCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) @@ -18283,7 +18283,7 @@ func (s *StorageClassificationCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type StorageClassificationMapping. func (s StorageClassificationMapping) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) @@ -18326,7 +18326,7 @@ func (s *StorageClassificationMapping) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type StorageClassificationMappingCollection. func (s StorageClassificationMappingCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) @@ -18357,7 +18357,7 @@ func (s *StorageClassificationMappingCollection) UnmarshalJSON(data []byte) erro // MarshalJSON implements the json.Marshaller interface for type StorageClassificationMappingInput. func (s StorageClassificationMappingInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", s.Properties) return json.Marshal(objectMap) } @@ -18384,7 +18384,7 @@ func (s *StorageClassificationMappingInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type StorageClassificationMappingProperties. func (s StorageClassificationMappingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "targetStorageClassificationId", s.TargetStorageClassificationID) return json.Marshal(objectMap) } @@ -18411,7 +18411,7 @@ func (s *StorageClassificationMappingProperties) UnmarshalJSON(data []byte) erro // MarshalJSON implements the json.Marshaller interface for type StorageClassificationProperties. func (s StorageClassificationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "friendlyName", s.FriendlyName) return json.Marshal(objectMap) } @@ -18438,7 +18438,7 @@ func (s *StorageClassificationProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type StorageMappingInputProperties. func (s StorageMappingInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "targetStorageClassificationId", s.TargetStorageClassificationID) return json.Marshal(objectMap) } @@ -18465,7 +18465,7 @@ func (s *StorageMappingInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Subnet. func (s Subnet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "addressList", s.AddressList) populate(objectMap, "friendlyName", s.FriendlyName) populate(objectMap, "name", s.Name) @@ -18500,7 +18500,7 @@ func (s *Subnet) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SupportedOSDetails. func (s SupportedOSDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "osName", s.OSName) populate(objectMap, "osType", s.OSType) populate(objectMap, "osVersions", s.OSVersions) @@ -18535,7 +18535,7 @@ func (s *SupportedOSDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SupportedOSProperties. func (s SupportedOSProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "supportedOsList", s.SupportedOsList) return json.Marshal(objectMap) } @@ -18562,7 +18562,7 @@ func (s *SupportedOSProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SupportedOSProperty. func (s SupportedOSProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "instanceType", s.InstanceType) populate(objectMap, "supportedOs", s.SupportedOs) return json.Marshal(objectMap) @@ -18593,7 +18593,7 @@ func (s *SupportedOSProperty) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SupportedOperatingSystems. func (s SupportedOperatingSystems) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) @@ -18636,7 +18636,7 @@ func (s *SupportedOperatingSystems) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SwitchProtectionInput. func (s SwitchProtectionInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", s.Properties) return json.Marshal(objectMap) } @@ -18663,7 +18663,7 @@ func (s *SwitchProtectionInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SwitchProtectionInputProperties. func (s SwitchProtectionInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "providerSpecificDetails", s.ProviderSpecificDetails) populate(objectMap, "replicationProtectedItemName", s.ReplicationProtectedItemName) return json.Marshal(objectMap) @@ -18694,7 +18694,7 @@ func (s *SwitchProtectionInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SwitchProtectionJobDetails. func (s SwitchProtectionJobDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "affectedObjectDetails", s.AffectedObjectDetails) objectMap["instanceType"] = "SwitchProtectionJobDetails" populate(objectMap, "newReplicationProtectedItemId", s.NewReplicationProtectedItemID) @@ -18729,7 +18729,7 @@ func (s *SwitchProtectionJobDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SwitchProtectionProviderSpecificInput. func (s SwitchProtectionProviderSpecificInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = s.InstanceType return json.Marshal(objectMap) } @@ -18756,7 +18756,7 @@ func (s *SwitchProtectionProviderSpecificInput) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type SwitchProviderInput. func (s SwitchProviderInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", s.Properties) return json.Marshal(objectMap) } @@ -18783,7 +18783,7 @@ func (s *SwitchProviderInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SwitchProviderInputProperties. func (s SwitchProviderInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "providerSpecificDetails", s.ProviderSpecificDetails) populate(objectMap, "targetInstanceType", s.TargetInstanceType) return json.Marshal(objectMap) @@ -18814,7 +18814,7 @@ func (s *SwitchProviderInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SwitchProviderSpecificInput. func (s SwitchProviderSpecificInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = s.InstanceType return json.Marshal(objectMap) } @@ -18841,7 +18841,7 @@ func (s *SwitchProviderSpecificInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TargetComputeSize. func (t TargetComputeSize) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", t.ID) populate(objectMap, "name", t.Name) populate(objectMap, "properties", t.Properties) @@ -18880,7 +18880,7 @@ func (t *TargetComputeSize) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TargetComputeSizeCollection. func (t TargetComputeSizeCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", t.NextLink) populate(objectMap, "value", t.Value) return json.Marshal(objectMap) @@ -18911,7 +18911,7 @@ func (t *TargetComputeSizeCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TargetComputeSizeProperties. func (t TargetComputeSizeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "cpuCoresCount", t.CPUCoresCount) populate(objectMap, "errors", t.Errors) populate(objectMap, "friendlyName", t.FriendlyName) @@ -18974,7 +18974,7 @@ func (t *TargetComputeSizeProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TaskTypeDetails. func (t TaskTypeDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = t.InstanceType return json.Marshal(objectMap) } @@ -19001,7 +19001,7 @@ func (t *TaskTypeDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TestFailoverCleanupInput. func (t TestFailoverCleanupInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", t.Properties) return json.Marshal(objectMap) } @@ -19028,7 +19028,7 @@ func (t *TestFailoverCleanupInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TestFailoverCleanupInputProperties. func (t TestFailoverCleanupInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "comments", t.Comments) return json.Marshal(objectMap) } @@ -19055,7 +19055,7 @@ func (t *TestFailoverCleanupInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TestFailoverInput. func (t TestFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", t.Properties) return json.Marshal(objectMap) } @@ -19082,7 +19082,7 @@ func (t *TestFailoverInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TestFailoverInputProperties. func (t TestFailoverInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "failoverDirection", t.FailoverDirection) populate(objectMap, "networkId", t.NetworkID) populate(objectMap, "networkType", t.NetworkType) @@ -19121,7 +19121,7 @@ func (t *TestFailoverInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TestFailoverJobDetails. func (t TestFailoverJobDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "affectedObjectDetails", t.AffectedObjectDetails) populate(objectMap, "comments", t.Comments) objectMap["instanceType"] = "TestFailoverJobDetails" @@ -19176,7 +19176,7 @@ func (t *TestFailoverJobDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TestFailoverProviderSpecificInput. func (t TestFailoverProviderSpecificInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = t.InstanceType return json.Marshal(objectMap) } @@ -19203,7 +19203,7 @@ func (t *TestFailoverProviderSpecificInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TestMigrateCleanupInput. func (t TestMigrateCleanupInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", t.Properties) return json.Marshal(objectMap) } @@ -19230,7 +19230,7 @@ func (t *TestMigrateCleanupInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TestMigrateCleanupInputProperties. func (t TestMigrateCleanupInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "comments", t.Comments) return json.Marshal(objectMap) } @@ -19257,7 +19257,7 @@ func (t *TestMigrateCleanupInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TestMigrateInput. func (t TestMigrateInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", t.Properties) return json.Marshal(objectMap) } @@ -19284,7 +19284,7 @@ func (t *TestMigrateInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TestMigrateInputProperties. func (t TestMigrateInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "providerSpecificDetails", t.ProviderSpecificDetails) return json.Marshal(objectMap) } @@ -19311,7 +19311,7 @@ func (t *TestMigrateInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TestMigrateProviderSpecificInput. func (t TestMigrateProviderSpecificInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = t.InstanceType return json.Marshal(objectMap) } @@ -19338,7 +19338,7 @@ func (t *TestMigrateProviderSpecificInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UnplannedFailoverInput. func (u UnplannedFailoverInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", u.Properties) return json.Marshal(objectMap) } @@ -19365,7 +19365,7 @@ func (u *UnplannedFailoverInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UnplannedFailoverInputProperties. func (u UnplannedFailoverInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "failoverDirection", u.FailoverDirection) populate(objectMap, "providerSpecificDetails", u.ProviderSpecificDetails) populate(objectMap, "sourceSiteOperations", u.SourceSiteOperations) @@ -19400,7 +19400,7 @@ func (u *UnplannedFailoverInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UnplannedFailoverProviderSpecificInput. func (u UnplannedFailoverProviderSpecificInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = u.InstanceType return json.Marshal(objectMap) } @@ -19427,7 +19427,7 @@ func (u *UnplannedFailoverProviderSpecificInput) UnmarshalJSON(data []byte) erro // MarshalJSON implements the json.Marshaller interface for type UpdateApplianceForReplicationProtectedItemInput. func (u UpdateApplianceForReplicationProtectedItemInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", u.Properties) return json.Marshal(objectMap) } @@ -19454,7 +19454,7 @@ func (u *UpdateApplianceForReplicationProtectedItemInput) UnmarshalJSON(data []b // MarshalJSON implements the json.Marshaller interface for type UpdateApplianceForReplicationProtectedItemInputProperties. func (u UpdateApplianceForReplicationProtectedItemInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "providerSpecificDetails", u.ProviderSpecificDetails) populate(objectMap, "targetApplianceId", u.TargetApplianceID) return json.Marshal(objectMap) @@ -19485,7 +19485,7 @@ func (u *UpdateApplianceForReplicationProtectedItemInputProperties) UnmarshalJSO // MarshalJSON implements the json.Marshaller interface for type UpdateApplianceForReplicationProtectedItemProviderSpecificInput. func (u UpdateApplianceForReplicationProtectedItemProviderSpecificInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = u.InstanceType return json.Marshal(objectMap) } @@ -19512,7 +19512,7 @@ func (u *UpdateApplianceForReplicationProtectedItemProviderSpecificInput) Unmars // MarshalJSON implements the json.Marshaller interface for type UpdateDiskInput. func (u UpdateDiskInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskId", u.DiskID) populate(objectMap, "targetDiskName", u.TargetDiskName) return json.Marshal(objectMap) @@ -19543,7 +19543,7 @@ func (u *UpdateDiskInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UpdateMigrationItemInput. func (u UpdateMigrationItemInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", u.Properties) return json.Marshal(objectMap) } @@ -19570,7 +19570,7 @@ func (u *UpdateMigrationItemInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UpdateMigrationItemInputProperties. func (u UpdateMigrationItemInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "providerSpecificDetails", u.ProviderSpecificDetails) return json.Marshal(objectMap) } @@ -19597,7 +19597,7 @@ func (u *UpdateMigrationItemInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UpdateMigrationItemProviderSpecificInput. func (u UpdateMigrationItemProviderSpecificInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = u.InstanceType return json.Marshal(objectMap) } @@ -19624,7 +19624,7 @@ func (u *UpdateMigrationItemProviderSpecificInput) UnmarshalJSON(data []byte) er // MarshalJSON implements the json.Marshaller interface for type UpdateMobilityServiceRequest. func (u UpdateMobilityServiceRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", u.Properties) return json.Marshal(objectMap) } @@ -19651,7 +19651,7 @@ func (u *UpdateMobilityServiceRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UpdateMobilityServiceRequestProperties. func (u UpdateMobilityServiceRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "runAsAccountId", u.RunAsAccountID) return json.Marshal(objectMap) } @@ -19678,7 +19678,7 @@ func (u *UpdateMobilityServiceRequestProperties) UnmarshalJSON(data []byte) erro // MarshalJSON implements the json.Marshaller interface for type UpdateNetworkMappingInput. func (u UpdateNetworkMappingInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", u.Properties) return json.Marshal(objectMap) } @@ -19705,7 +19705,7 @@ func (u *UpdateNetworkMappingInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UpdateNetworkMappingInputProperties. func (u UpdateNetworkMappingInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "fabricSpecificDetails", u.FabricSpecificDetails) populate(objectMap, "recoveryFabricName", u.RecoveryFabricName) populate(objectMap, "recoveryNetworkId", u.RecoveryNetworkID) @@ -19740,7 +19740,7 @@ func (u *UpdateNetworkMappingInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UpdatePolicyInput. func (u UpdatePolicyInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", u.Properties) return json.Marshal(objectMap) } @@ -19767,7 +19767,7 @@ func (u *UpdatePolicyInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UpdatePolicyInputProperties. func (u UpdatePolicyInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "replicationProviderSettings", u.ReplicationProviderSettings) return json.Marshal(objectMap) } @@ -19794,7 +19794,7 @@ func (u *UpdatePolicyInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UpdateProtectionContainerMappingInput. func (u UpdateProtectionContainerMappingInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", u.Properties) return json.Marshal(objectMap) } @@ -19821,7 +19821,7 @@ func (u *UpdateProtectionContainerMappingInput) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type UpdateProtectionContainerMappingInputProperties. func (u UpdateProtectionContainerMappingInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "providerSpecificInput", u.ProviderSpecificInput) return json.Marshal(objectMap) } @@ -19848,7 +19848,7 @@ func (u *UpdateProtectionContainerMappingInputProperties) UnmarshalJSON(data []b // MarshalJSON implements the json.Marshaller interface for type UpdateRecoveryPlanInput. func (u UpdateRecoveryPlanInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", u.Properties) return json.Marshal(objectMap) } @@ -19875,7 +19875,7 @@ func (u *UpdateRecoveryPlanInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UpdateRecoveryPlanInputProperties. func (u UpdateRecoveryPlanInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "groups", u.Groups) return json.Marshal(objectMap) } @@ -19902,7 +19902,7 @@ func (u *UpdateRecoveryPlanInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UpdateReplicationProtectedItemInput. func (u UpdateReplicationProtectedItemInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", u.Properties) return json.Marshal(objectMap) } @@ -19929,7 +19929,7 @@ func (u *UpdateReplicationProtectedItemInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UpdateReplicationProtectedItemInputProperties. func (u UpdateReplicationProtectedItemInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "enableRdpOnTargetOption", u.EnableRdpOnTargetOption) populate(objectMap, "licenseType", u.LicenseType) populate(objectMap, "providerSpecificDetails", u.ProviderSpecificDetails) @@ -19992,7 +19992,7 @@ func (u *UpdateReplicationProtectedItemInputProperties) UnmarshalJSON(data []byt // MarshalJSON implements the json.Marshaller interface for type UpdateReplicationProtectedItemProviderInput. func (u UpdateReplicationProtectedItemProviderInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = u.InstanceType return json.Marshal(objectMap) } @@ -20019,7 +20019,7 @@ func (u *UpdateReplicationProtectedItemProviderInput) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type UpdateVCenterRequest. func (u UpdateVCenterRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", u.Properties) return json.Marshal(objectMap) } @@ -20046,7 +20046,7 @@ func (u *UpdateVCenterRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UpdateVCenterRequestProperties. func (u UpdateVCenterRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "friendlyName", u.FriendlyName) populate(objectMap, "ipAddress", u.IPAddress) populate(objectMap, "port", u.Port) @@ -20089,7 +20089,7 @@ func (u *UpdateVCenterRequestProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VCenter. func (v VCenter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", v.ID) populate(objectMap, "location", v.Location) populate(objectMap, "name", v.Name) @@ -20132,7 +20132,7 @@ func (v *VCenter) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VCenterCollection. func (v VCenterCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", v.NextLink) populate(objectMap, "value", v.Value) return json.Marshal(objectMap) @@ -20163,7 +20163,7 @@ func (v *VCenterCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VCenterProperties. func (v VCenterProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "discoveryStatus", v.DiscoveryStatus) populate(objectMap, "fabricArmResourceName", v.FabricArmResourceName) populate(objectMap, "friendlyName", v.FriendlyName) @@ -20230,7 +20230,7 @@ func (v *VCenterProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMNicDetails. func (v VMNicDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "enableAcceleratedNetworkingOnRecovery", v.EnableAcceleratedNetworkingOnRecovery) populate(objectMap, "enableAcceleratedNetworkingOnTfo", v.EnableAcceleratedNetworkingOnTfo) populate(objectMap, "ipConfigs", v.IPConfigs) @@ -20329,7 +20329,7 @@ func (v *VMNicDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMNicInputDetails. func (v VMNicInputDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "enableAcceleratedNetworkingOnRecovery", v.EnableAcceleratedNetworkingOnRecovery) populate(objectMap, "enableAcceleratedNetworkingOnTfo", v.EnableAcceleratedNetworkingOnTfo) populate(objectMap, "ipConfigs", v.IPConfigs) @@ -20408,7 +20408,7 @@ func (v *VMNicInputDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMNicUpdatesTaskDetails. func (v VMNicUpdatesTaskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "VmNicUpdatesTaskDetails" populate(objectMap, "name", v.Name) populate(objectMap, "nicId", v.NicID) @@ -20447,7 +20447,7 @@ func (v *VMNicUpdatesTaskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMwareCbtContainerCreationInput. func (v VMwareCbtContainerCreationInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "VMwareCbt" return json.Marshal(objectMap) } @@ -20474,7 +20474,7 @@ func (v *VMwareCbtContainerCreationInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMwareCbtContainerMappingInput. func (v VMwareCbtContainerMappingInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "VMwareCbt" populate(objectMap, "keyVaultId", v.KeyVaultID) populate(objectMap, "keyVaultUri", v.KeyVaultURI) @@ -20525,7 +20525,7 @@ func (v *VMwareCbtContainerMappingInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMwareCbtDiskInput. func (v VMwareCbtDiskInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskEncryptionSetId", v.DiskEncryptionSetID) populate(objectMap, "diskId", v.DiskID) populate(objectMap, "diskType", v.DiskType) @@ -20572,7 +20572,7 @@ func (v *VMwareCbtDiskInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMwareCbtEnableMigrationInput. func (v VMwareCbtEnableMigrationInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "dataMoverRunAsAccountId", v.DataMoverRunAsAccountID) populate(objectMap, "disksToInclude", v.DisksToInclude) objectMap["instanceType"] = "VMwareCbt" @@ -20691,7 +20691,7 @@ func (v *VMwareCbtEnableMigrationInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMwareCbtEventDetails. func (v VMwareCbtEventDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "VMwareCbt" populate(objectMap, "migrationItemName", v.MigrationItemName) return json.Marshal(objectMap) @@ -20722,7 +20722,7 @@ func (v *VMwareCbtEventDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMwareCbtMigrateInput. func (v VMwareCbtMigrateInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "VMwareCbt" populate(objectMap, "performShutdown", v.PerformShutdown) return json.Marshal(objectMap) @@ -20753,7 +20753,7 @@ func (v *VMwareCbtMigrateInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMwareCbtMigrationDetails. func (v VMwareCbtMigrationDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "dataMoverRunAsAccountId", v.DataMoverRunAsAccountID) populate(objectMap, "firmwareType", v.FirmwareType) populate(objectMap, "initialSeedingProgressPercentage", v.InitialSeedingProgressPercentage) @@ -20932,7 +20932,7 @@ func (v *VMwareCbtMigrationDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMwareCbtNicDetails. func (v VMwareCbtNicDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "isPrimaryNic", v.IsPrimaryNic) populate(objectMap, "isSelectedForMigration", v.IsSelectedForMigration) populate(objectMap, "nicId", v.NicID) @@ -21011,7 +21011,7 @@ func (v *VMwareCbtNicDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMwareCbtNicInput. func (v VMwareCbtNicInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "isPrimaryNic", v.IsPrimaryNic) populate(objectMap, "isSelectedForMigration", v.IsSelectedForMigration) populate(objectMap, "nicId", v.NicID) @@ -21066,7 +21066,7 @@ func (v *VMwareCbtNicInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMwareCbtPolicyCreationInput. func (v VMwareCbtPolicyCreationInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "appConsistentFrequencyInMinutes", v.AppConsistentFrequencyInMinutes) populate(objectMap, "crashConsistentFrequencyInMinutes", v.CrashConsistentFrequencyInMinutes) objectMap["instanceType"] = "VMwareCbt" @@ -21105,7 +21105,7 @@ func (v *VMwareCbtPolicyCreationInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMwareCbtProtectedDiskDetails. func (v VMwareCbtProtectedDiskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "capacityInBytes", v.CapacityInBytes) populate(objectMap, "diskEncryptionSetId", v.DiskEncryptionSetID) populate(objectMap, "diskId", v.DiskID) @@ -21184,7 +21184,7 @@ func (v *VMwareCbtProtectedDiskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMwareCbtProtectionContainerMappingDetails. func (v VMwareCbtProtectionContainerMappingDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "VMwareCbt" populate(objectMap, "keyVaultId", v.KeyVaultID) populate(objectMap, "keyVaultUri", v.KeyVaultURI) @@ -21239,7 +21239,7 @@ func (v *VMwareCbtProtectionContainerMappingDetails) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type VMwareCbtResumeReplicationInput. func (v VMwareCbtResumeReplicationInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "deleteMigrationResources", v.DeleteMigrationResources) objectMap["instanceType"] = "VMwareCbt" return json.Marshal(objectMap) @@ -21270,7 +21270,7 @@ func (v *VMwareCbtResumeReplicationInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMwareCbtResyncInput. func (v VMwareCbtResyncInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "VMwareCbt" populate(objectMap, "skipCbtReset", v.SkipCbtReset) return json.Marshal(objectMap) @@ -21301,7 +21301,7 @@ func (v *VMwareCbtResyncInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMwareCbtTestMigrateInput. func (v VMwareCbtTestMigrateInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "VMwareCbt" populate(objectMap, "networkId", v.NetworkID) populate(objectMap, "recoveryPointId", v.RecoveryPointID) @@ -21340,7 +21340,7 @@ func (v *VMwareCbtTestMigrateInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMwareCbtUpdateDiskInput. func (v VMwareCbtUpdateDiskInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskId", v.DiskID) populate(objectMap, "isOSDisk", v.IsOSDisk) populate(objectMap, "targetDiskName", v.TargetDiskName) @@ -21375,7 +21375,7 @@ func (v *VMwareCbtUpdateDiskInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMwareCbtUpdateMigrationItemInput. func (v VMwareCbtUpdateMigrationItemInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "VMwareCbt" populate(objectMap, "licenseType", v.LicenseType) populate(objectMap, "performAutoResync", v.PerformAutoResync) @@ -21470,7 +21470,7 @@ func (v *VMwareCbtUpdateMigrationItemInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMwareDetails. func (v VMwareDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "agentCount", v.AgentCount) populateTimeRFC3339(objectMap, "agentExpiryDate", v.AgentExpiryDate) populate(objectMap, "agentVersion", v.AgentVersion) @@ -21629,7 +21629,7 @@ func (v *VMwareDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMwareV2FabricCreationInput. func (v VMwareV2FabricCreationInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "VMwareV2" populate(objectMap, "migrationSolutionId", v.MigrationSolutionID) populate(objectMap, "physicalSiteId", v.PhysicalSiteID) @@ -21668,7 +21668,7 @@ func (v *VMwareV2FabricCreationInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMwareV2FabricSpecificDetails. func (v VMwareV2FabricSpecificDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "VMwareV2" populate(objectMap, "migrationSolutionId", v.MigrationSolutionID) populate(objectMap, "physicalSiteId", v.PhysicalSiteID) @@ -21723,7 +21723,7 @@ func (v *VMwareV2FabricSpecificDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMwareVirtualMachineDetails. func (v VMwareVirtualMachineDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "agentGeneratedId", v.AgentGeneratedID) populate(objectMap, "agentInstalled", v.AgentInstalled) populate(objectMap, "agentVersion", v.AgentVersion) @@ -21790,7 +21790,7 @@ func (v *VMwareVirtualMachineDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VaultHealthDetails. func (v VaultHealthDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", v.ID) populate(objectMap, "location", v.Location) populate(objectMap, "name", v.Name) @@ -21833,7 +21833,7 @@ func (v *VaultHealthDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VaultHealthProperties. func (v VaultHealthProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "containersHealth", v.ContainersHealth) populate(objectMap, "fabricsHealth", v.FabricsHealth) populate(objectMap, "protectedItemsHealth", v.ProtectedItemsHealth) @@ -21872,7 +21872,7 @@ func (v *VaultHealthProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VaultSetting. func (v VaultSetting) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", v.ID) populate(objectMap, "location", v.Location) populate(objectMap, "name", v.Name) @@ -21915,7 +21915,7 @@ func (v *VaultSetting) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VaultSettingCollection. func (v VaultSettingCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", v.NextLink) populate(objectMap, "value", v.Value) return json.Marshal(objectMap) @@ -21946,7 +21946,7 @@ func (v *VaultSettingCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VaultSettingCreationInput. func (v VaultSettingCreationInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", v.Properties) return json.Marshal(objectMap) } @@ -21973,7 +21973,7 @@ func (v *VaultSettingCreationInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VaultSettingCreationInputProperties. func (v VaultSettingCreationInputProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "migrationSolutionId", v.MigrationSolutionID) populate(objectMap, "vmwareToAzureProviderType", v.VmwareToAzureProviderType) return json.Marshal(objectMap) @@ -22004,7 +22004,7 @@ func (v *VaultSettingCreationInputProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VaultSettingProperties. func (v VaultSettingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "migrationSolutionId", v.MigrationSolutionID) populate(objectMap, "vmwareToAzureProviderType", v.VmwareToAzureProviderType) return json.Marshal(objectMap) @@ -22035,7 +22035,7 @@ func (v *VaultSettingProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VersionDetails. func (v VersionDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "expiryDate", v.ExpiryDate) populate(objectMap, "status", v.Status) populate(objectMap, "version", v.Version) @@ -22070,7 +22070,7 @@ func (v *VersionDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VirtualMachineTaskDetails. func (v VirtualMachineTaskDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "VirtualMachineTaskDetails" populate(objectMap, "jobTask", v.JobTask) populate(objectMap, "skippedReason", v.SkippedReason) @@ -22109,7 +22109,7 @@ func (v *VirtualMachineTaskDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VmmDetails. func (v VmmDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "VMM" return json.Marshal(objectMap) } @@ -22136,7 +22136,7 @@ func (v *VmmDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VmmToAzureCreateNetworkMappingInput. func (v VmmToAzureCreateNetworkMappingInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "VmmToAzure" return json.Marshal(objectMap) } @@ -22163,7 +22163,7 @@ func (v *VmmToAzureCreateNetworkMappingInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VmmToAzureNetworkMappingSettings. func (v VmmToAzureNetworkMappingSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "VmmToAzure" return json.Marshal(objectMap) } @@ -22190,7 +22190,7 @@ func (v *VmmToAzureNetworkMappingSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VmmToAzureUpdateNetworkMappingInput. func (v VmmToAzureUpdateNetworkMappingInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "VmmToAzure" return json.Marshal(objectMap) } @@ -22217,7 +22217,7 @@ func (v *VmmToAzureUpdateNetworkMappingInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VmmToVmmCreateNetworkMappingInput. func (v VmmToVmmCreateNetworkMappingInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "VmmToVmm" return json.Marshal(objectMap) } @@ -22244,7 +22244,7 @@ func (v *VmmToVmmCreateNetworkMappingInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VmmToVmmNetworkMappingSettings. func (v VmmToVmmNetworkMappingSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "VmmToVmm" return json.Marshal(objectMap) } @@ -22271,7 +22271,7 @@ func (v *VmmToVmmNetworkMappingSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VmmToVmmUpdateNetworkMappingInput. func (v VmmToVmmUpdateNetworkMappingInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["instanceType"] = "VmmToVmm" return json.Marshal(objectMap) } @@ -22298,7 +22298,7 @@ func (v *VmmToVmmUpdateNetworkMappingInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VmmVirtualMachineDetails. func (v VmmVirtualMachineDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskDetails", v.DiskDetails) populate(objectMap, "generation", v.Generation) populate(objectMap, "hasFibreChannelAdapter", v.HasFibreChannelAdapter) @@ -22357,7 +22357,7 @@ func (v *VmmVirtualMachineDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VmwareCbtPolicyDetails. func (v VmwareCbtPolicyDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "appConsistentFrequencyInMinutes", v.AppConsistentFrequencyInMinutes) populate(objectMap, "crashConsistentFrequencyInMinutes", v.CrashConsistentFrequencyInMinutes) objectMap["instanceType"] = "VMwareCbt" @@ -22394,7 +22394,7 @@ func (v *VmwareCbtPolicyDetails) UnmarshalJSON(data []byte) error { return nil } -func populate(m map[string]interface{}, k string, v interface{}) { +func populate(m map[string]any, k string, v any) { if v == nil { return } else if azcore.IsNullValue(v) { @@ -22404,7 +22404,7 @@ func populate(m map[string]interface{}, k string, v interface{}) { } } -func unpopulate(data json.RawMessage, fn string, v interface{}) error { +func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil { return nil } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/operations_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/operations_client.go index fd2a231fb2ad..c297dd38b743 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/operations_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/operations_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,42 +24,32 @@ import ( // OperationsClient contains the methods for the Operations group. // Don't use this type directly, use NewOperationsClient() instead. type OperationsClient struct { - host string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewOperationsClient(resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &OperationsClient{ - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // NewListPager - Operation to return the list of available operations. +// // Generated from API version 2022-10-01 -// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +func (client *OperationsClient) NewListPager(resourceGroupName string, options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ More: func(page OperationsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -70,14 +58,14 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, resourceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return OperationsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return OperationsClientListResponse{}, err } @@ -90,17 +78,17 @@ 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, resourceGroupName string, options *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/operations" - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/operations_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/operations_client_example_test.go index 6bee791fa102..17b253dd9555 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/operations_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/operations_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -13,29 +14,1243 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/Operations_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/Operations_List.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewOperationsClient("resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(nil) + pager := clientFactory.NewOperationsClient().NewListPager("resourceGroupPS1", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.OperationsDiscoveryCollection = armrecoveryservicessiterecovery.OperationsDiscoveryCollection{ + // Value: []*armrecoveryservicessiterecovery.OperationsDiscovery{ + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/vaultTokens/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("The Vault Token operation can be used to get Vault Token for vault level backend operations."), + // Operation: to.Ptr("Vault Token"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Vaults"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/registeredIdentities/write"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("The Register Service Container operation can be used to register a container with Recovery Service."), + // Operation: to.Ptr("Register Service Container"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Vaults"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/registeredIdentities/operationResults/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("The Get Operation Results operation can be used get the operation status and result for the asynchronously submitted operation"), + // Operation: to.Ptr("Get Operation Results"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Vaults"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/registeredIdentities/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("The Get Containers operation can be used get the containers registered for a resource."), + // Operation: to.Ptr("Get Containers"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Vaults"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/registeredIdentities/delete"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("The UnRegister Container operation can be used to unregister a container."), + // Operation: to.Ptr("Unregister Service Container"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Vaults"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/certificates/write"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("The Update Resource Certificate operation updates the resource/vault credential certificate."), + // Operation: to.Ptr("Update Resource Certificate"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Vaults"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationAlertSettings/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Read Any Alerts Settings"), + // Operation: to.Ptr("Read Alerts Settings"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Alerts Settings"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationAlertSettings/write"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Create or Update Any Alerts Settings"), + // Operation: to.Ptr("Create or Update Alerts Settings"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Alerts Settings"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationEvents/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Read Any Events"), + // Operation: to.Ptr("Read Events"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Events"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationNetworks/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Read Any Networks"), + // Operation: to.Ptr("Read Networks"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Networks"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationNetworks/replicationNetworkMappings/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Read Any Network Mappings"), + // Operation: to.Ptr("Read Network Mappings"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Network Mappings"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationNetworks/replicationNetworkMappings/write"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Create or Update Any Network Mappings"), + // Operation: to.Ptr("Create or Update Network Mappings"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Network Mappings"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationNetworks/replicationNetworkMappings/delete"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Delete Any Network Mappings"), + // Operation: to.Ptr("Delete Network Mappings"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Network Mappings"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectableItems/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Read Any Protectable Items"), + // Operation: to.Ptr("Read Protectable Items"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protectable Items"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectionContainerMappings/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Read Any Protection Container Mappings"), + // Operation: to.Ptr("Read Protection Container Mappings"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protection Container Mappings"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectionContainerMappings/write"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Create or Update Any Protection Container Mappings"), + // Operation: to.Ptr("Create or Update Protection Container Mappings"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protection Container Mappings"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectionContainerMappings/remove/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Remove Protection Container Mapping"), + // Operation: to.Ptr("Remove Protection Container Mapping"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protection Container Mappings"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectionContainerMappings/delete"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Delete Any Protection Container Mappings"), + // Operation: to.Ptr("Delete Protection Container Mappings"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protection Container Mappings"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems/recoveryPoints/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Read Any Replication Recovery Points"), + // Operation: to.Ptr("Read Replication Recovery Points"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Replication Recovery Points"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Read Any Protected Items"), + // Operation: to.Ptr("Read Protected Items"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protected Items"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems/write"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Create or Update Any Protected Items"), + // Operation: to.Ptr("Create or Update Protected Items"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protected Items"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems/delete"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Delete Any Protected Items"), + // Operation: to.Ptr("Delete Protected Items"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protected Items"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems/remove/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Remove Protected Item"), + // Operation: to.Ptr("Remove Protected Item"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protected Items"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems/plannedFailover/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Planned Failover"), + // Operation: to.Ptr("Planned Failover"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protected Items"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems/unplannedFailover/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Failover"), + // Operation: to.Ptr("Failover"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protected Items"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems/testFailover/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Test Failover"), + // Operation: to.Ptr("Test Failover"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protected Items"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems/testFailoverCleanup/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Test Failover Cleanup"), + // Operation: to.Ptr("Test Failover Cleanup"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protected Items"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems/failoverCommit/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Failover Commit"), + // Operation: to.Ptr("Failover Commit"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protected Items"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems/reProtect/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("ReProtect Protected Item"), + // Operation: to.Ptr("ReProtect Protected Item"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protected Items"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems/updateMobilityService/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Update Mobility Service"), + // Operation: to.Ptr("Update Mobility Service"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protected Items"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems/repairReplication/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Repair replication"), + // Operation: to.Ptr("Repair replication"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protected Items"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems/applyRecoveryPoint/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Apply Recovery Point"), + // Operation: to.Ptr("Apply Recovery Point"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protected Items"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationJobs/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Read Any Jobs"), + // Operation: to.Ptr("Read Jobs"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Jobs"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationJobs/cancel/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Cancel Job"), + // Operation: to.Ptr("Cancel Job"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Jobs"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationJobs/restart/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Restart job"), + // Operation: to.Ptr("Restart job"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Jobs"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationJobs/resume/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Resume Job"), + // Operation: to.Ptr("Resume Job"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Jobs"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Read Any Protection Containers"), + // Operation: to.Ptr("Read Protection Containers"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protection Containers"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/discoverProtectableItem/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Discover Protectable Item"), + // Operation: to.Ptr("Discover Protectable Item"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protection Containers"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/write"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Create or Update Any Protection Containers"), + // Operation: to.Ptr("Create or Update Protection Containers"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protection Containers"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/remove/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Remove Protection Container"), + // Operation: to.Ptr("Remove Protection Container"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protection Containers"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/switchprotection/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Switch Protection Container"), + // Operation: to.Ptr("Switch Protection Container"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Protection Containers"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationPolicies/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Read Any Policies"), + // Operation: to.Ptr("Read Policies"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Policies"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationPolicies/write"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Create or Update Any Policies"), + // Operation: to.Ptr("Create or Update Policies"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Policies"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationPolicies/delete"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Delete Any Policies"), + // Operation: to.Ptr("Delete Policies"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Policies"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationRecoveryPlans/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Read Any Recovery Plans"), + // Operation: to.Ptr("Read Recovery Plans"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Recovery Plans"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationRecoveryPlans/write"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Create or Update Any Recovery Plans"), + // Operation: to.Ptr("Create or Update Recovery Plans"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Recovery Plans"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationRecoveryPlans/delete"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Delete Any Recovery Plans"), + // Operation: to.Ptr("Delete Recovery Plans"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Recovery Plans"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationRecoveryPlans/plannedFailover/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Planned Failover Recovery Plan"), + // Operation: to.Ptr("Planned Failover Recovery Plan"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Recovery Plans"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationRecoveryPlans/unplannedFailover/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Failover Recovery Plan"), + // Operation: to.Ptr("Failover Recovery Plan"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Recovery Plans"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationRecoveryPlans/testFailover/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Test Failover Recovery Plan"), + // Operation: to.Ptr("Test Failover Recovery Plan"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Recovery Plans"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationRecoveryPlans/testFailoverCleanup/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Test Failover Cleanup Recovery Plan"), + // Operation: to.Ptr("Test Failover Cleanup Recovery Plan"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Recovery Plans"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationRecoveryPlans/failoverCommit/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Failover Commit Recovery Plan"), + // Operation: to.Ptr("Failover Commit Recovery Plan"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Recovery Plans"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationRecoveryPlans/reProtect/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("ReProtect Recovery Plan"), + // Operation: to.Ptr("ReProtect Recovery Plan"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Recovery Plans"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationRecoveryServicesProviders/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Read Any Recovery Services Providers"), + // Operation: to.Ptr("Read Recovery Services Providers"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Recovery Services Providers"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationRecoveryServicesProviders/remove/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Remove Recovery Services Provider"), + // Operation: to.Ptr("Remove Recovery Services Provider"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Recovery Services Providers"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationRecoveryServicesProviders/delete"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Delete Any Recovery Services Providers"), + // Operation: to.Ptr("Delete Recovery Services Providers"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Recovery Services Providers"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationRecoveryServicesProviders/refreshProvider/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Refresh Provider"), + // Operation: to.Ptr("Refresh Provider"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Recovery Services Providers"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Read Any Fabrics"), + // Operation: to.Ptr("Read Fabrics"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Fabrics"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/write"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Create or Update Any Fabrics"), + // Operation: to.Ptr("Create or Update Fabrics"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Fabrics"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/remove/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Remove Fabric"), + // Operation: to.Ptr("Remove Fabric"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Fabrics"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/checkConsistency/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Checks Consistency of the Fabric"), + // Operation: to.Ptr("Checks Consistency of the Fabric"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Fabrics"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/delete"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Delete Any Fabrics"), + // Operation: to.Ptr("Delete Fabrics"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Fabrics"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/renewcertificate/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Renew Certificate for Fabric"), + // Operation: to.Ptr("Renew Certificate for Fabric"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Fabrics"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/deployProcessServerImage/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Deploy Process Server Image"), + // Operation: to.Ptr("Deploy Process Server Image"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Fabrics"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/reassociateGateway/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Reassociate Gateway"), + // Operation: to.Ptr("Reassociate Gateway"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Fabrics"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationStorageClassifications/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Read Any Storage Classifications"), + // Operation: to.Ptr("Read Storage Classifications"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Storage Classifications"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationStorageClassifications/replicationStorageClassificationMappings/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Read Any Storage Classification Mappings"), + // Operation: to.Ptr("Read Storage Classification Mappings"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Storage Classification Mappings"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationStorageClassifications/replicationStorageClassificationMappings/write"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Create or Update Any Storage Classification Mappings"), + // Operation: to.Ptr("Create or Update Storage Classification Mappings"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Storage Classification Mappings"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationStorageClassifications/replicationStorageClassificationMappings/delete"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Delete Any Storage Classification Mappings"), + // Operation: to.Ptr("Delete Storage Classification Mappings"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Storage Classification Mappings"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/usages/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Read Any Vault Usages"), + // Operation: to.Ptr("Read Vault Usages"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Vault Usages"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationvCenters/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Read Any Jobs"), + // Operation: to.Ptr("Read Jobs"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Jobs"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationvCenters/write"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Create or Update Any Jobs"), + // Operation: to.Ptr("Create or Update Jobs"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Jobs"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationvCenters/delete"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Delete Any Jobs"), + // Operation: to.Ptr("Delete Jobs"), + // Provider: to.Ptr("Microsoft Recovery Services"), + // Resource: to.Ptr("Jobs"), + // }, + // Origin: to.Ptr("user,system"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/usages/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Returns usage details for a Recovery Services Vault."), + // Operation: to.Ptr("Recovery Services Vault usage details."), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Vault Usage"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupUsageSummaries/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Returns summaries for Protected Items and Protected Servers for a Recovery Services ."), + // Operation: to.Ptr("Recovery Services Protected Items and Protected Servers usage summaries details."), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Backup Usages Summaries"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/storageConfig/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Returns Storage Configuration for Recovery Services Vault."), + // Operation: to.Ptr("Get Resource Storage Config"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Vault Storage Config"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/storageConfig/write"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Updates Storage Configuration for Recovery Services Vault."), + // Operation: to.Ptr("Write Resource Storage Config"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Vault Storage Config"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupconfig/vaultconfig/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Returns Configuration for Recovery Services Vault."), + // Operation: to.Ptr("Get Resource Config"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Vault Config"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupconfig/vaultconfig/write"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Updates Configuration for Recovery Services Vault."), + // Operation: to.Ptr("Update Resource Config"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Vault Config"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/tokenInfo/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Returns token information for Recovery Services Vault."), + // Operation: to.Ptr("Get Vault Token Info"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Token Info"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupSecurityPIN/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Returns Security PIN Information for Recovery Services Vault."), + // Operation: to.Ptr("Get Security PIN Info"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("SecurityPINInfo"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupManagementMetaData/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Returns Backup Management Metadata for Recovery Services Vault."), + // Operation: to.Ptr("Get Backup Management Metadata"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Backup Management Metadata"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupOperationResults/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Returns Backup Operation Result for Recovery Services Vault."), + // Operation: to.Ptr("Get Backup Operation Result"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Backup Operation Results"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupOperations/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Returns Backup Operation Status for Recovery Services Vault."), + // Operation: to.Ptr("Get Backup Operation Status"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Backup Operation Status"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupJobs/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Returns all Job Objects"), + // Operation: to.Ptr("Get Jobs"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Backup Jobs"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupJobs/cancel/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Cancel the Job"), + // Operation: to.Ptr("Cancel Jobs"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Backup Jobs"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupJobsExport/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Export Jobs"), + // Operation: to.Ptr("Export Jobs"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Export Backup Jobs"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupJobs/operationResults/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Returns the Result of Job Operation."), + // Operation: to.Ptr("Get Job Operation Result"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Backup Jobs Operation Results"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupJobsExport/operationResults/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Returns the Result of Export Job Operation."), + // Operation: to.Ptr("Get Export Job Operation Result"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Export Backup Jobs Operation Results"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupFabrics/protectionContainers/protectedItems/recoveryPoints/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Get Recovery Points for Protected Items."), + // Operation: to.Ptr("Get Recovery Points"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Recovery Points"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupFabrics/protectionContainers/protectedItems/recoveryPoints/restore/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Restore Recovery Points for Protected Items."), + // Operation: to.Ptr("Restore Recovery Points"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Recovery Points"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupFabrics/protectionContainers/protectedItems/recoveryPoints/provisionInstantItemRecovery/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Provision Instant Item Recovery for Protected Item"), + // Operation: to.Ptr("Provision Instant Item Recovery for Protected Item"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Recovery Points"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupFabrics/protectionContainers/protectedItems/recoveryPoints/revokeInstantItemRecovery/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Revoke Instant Item Recovery for Protected Item"), + // Operation: to.Ptr("Revoke Instant Item Recovery for Protected Item"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Recovery Points"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupPolicies/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Returns all Protection Policies"), + // Operation: to.Ptr("Get Protection Policy"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Backup Policies"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupPolicies/write"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Creates Protection Policy"), + // Operation: to.Ptr("Create Protection Policy"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Backup Policies"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupPolicies/delete"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Delete a Protection Policy"), + // Operation: to.Ptr("Delete Protection Policy"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Backup Policies"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupPolicies/operationResults/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Get Results of Policy Operation."), + // Operation: to.Ptr("Get Policy Operation Results"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Backup Policy Operation Results"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupPolicies/operationStatus/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Get Status of Policy Operation."), + // Operation: to.Ptr("Get Policy Operation Status"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Backup Policy Operation Status"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupFabrics/protectionContainers/protectedItems/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Returns object details of the Protected Item"), + // Operation: to.Ptr("Get Protected Item Details"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Protected Items"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupProtectedItems/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Returns the list of all Protected Items."), + // Operation: to.Ptr("Get All Protected Items"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Protected Items"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupFabrics/protectionContainers/protectedItems/write"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Create a backup Protected Item"), + // Operation: to.Ptr("Create Backup Protected Item"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Protected Items"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupFabrics/protectionContainers/protectedItems/delete"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Deletes Protected Item"), + // Operation: to.Ptr("Delete Protected Items"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Protected Items"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupFabrics/protectionContainers/protectedItems/operationResults/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Gets Result of Operation Performed on Protected Items."), + // Operation: to.Ptr("Get Protected Items Operation Results"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Protected Item Operation Results"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupFabrics/protectionContainers/protectedItems/operationStatus/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Returns the status of Operation performed on Protected Items."), + // Operation: to.Ptr("Get Protected Items operation status"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Protected Item Operation Status"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupFabrics/protectionContainers/protectedItems/backup/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Performs Backup for Protected Item."), + // Operation: to.Ptr("Backup Protected Item"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Protected Items"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupProtectableItems/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Returns list of all Protectable Items."), + // Operation: to.Ptr("Get Protectable Items"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Backup Protectable Items"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/refreshContainers/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Refreshes the container list"), + // Operation: to.Ptr("Refresh container"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Refresh Containers"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupFabrics/operationResults/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Returns status of the operation"), + // Operation: to.Ptr("Get Operation Results"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Refresh Containers Operation Results"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupProtectionContainers/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Returns all containers belonging to the subscription"), + // Operation: to.Ptr("Get Containers In Subscription"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Backup Protection Containers"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupFabrics/protectionContainers/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Returns all registered containers"), + // Operation: to.Ptr("Get Registered Container"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Protection Containers"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupFabrics/protectionContainers/operationResults/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Gets result of Operation performed on Protection Container."), + // Operation: to.Ptr("Get Container Operation Results"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Protection Containers Operation Results"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupEngines"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Returns all the backup management servers registered with vault."), + // Operation: to.Ptr("List of backup management servers."), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Backup Engines"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupStatus"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Check Backup Status for Recovery Services Vaults"), + // Operation: to.Ptr("Check Backup Status for Vault"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Backup Status"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/write"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("Create Vault operation creates an Azure resource of type 'vault'"), + // Operation: to.Ptr("Create Vault"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Vaults"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("The Get Vault operation gets an object representing the Azure resource of type 'vault'"), + // Operation: to.Ptr("Get Vault"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Vaults"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/delete"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("The Delete Vault operation deletes the specified Azure resource of type 'vault'"), + // Operation: to.Ptr("Delete Vault"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Vaults"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/extendedInformation/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("The Get Extended Info operation gets an object's Extended Info representing the Azure resource of type ?vault?"), + // Operation: to.Ptr("Get Extended Info"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Vaults"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/extendedInformation/write"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("The Get Extended Info operation gets an object's Extended Info representing the Azure resource of type ?vault?"), + // Operation: to.Ptr("Get Extended Info"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Vaults"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/extendedInformation/delete"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("The Get Extended Info operation gets an object's Extended Info representing the Azure resource of type ?vault?"), + // Operation: to.Ptr("Get Extended Info"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("Vaults"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/locations/allocatedStamp/read"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("GetAllocatedStamp is internal operation used by service"), + // Operation: to.Ptr("Get Allocated Stamp"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("locations/allocatedStamp"), + // }, + // Origin: to.Ptr("user"), + // }, + // { + // Name: to.Ptr("Microsoft.RecoveryServices/locations/allocateStamp/action"), + // Display: &armrecoveryservicessiterecovery.Display{ + // Description: to.Ptr("AllocateStamp is internal operation used by service"), + // Operation: to.Ptr("Allocated Stamp Action"), + // Provider: to.Ptr("Microsoft.RecoveryServices"), + // Resource: to.Ptr("locations/allocateStamp"), + // }, + // Origin: to.Ptr("user"), + // }}, + // } } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/polymorphic_helpers.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/polymorphic_helpers.go index f13634dec6b0..80fbf63cc2b7 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/polymorphic_helpers.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/polymorphic_helpers.go @@ -15,7 +15,7 @@ func unmarshalAddDisksProviderSpecificInputClassification(rawMsg json.RawMessage if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -33,7 +33,7 @@ func unmarshalApplianceSpecificDetailsClassification(rawMsg json.RawMessage) (Ap if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -51,7 +51,7 @@ func unmarshalApplyRecoveryPointProviderSpecificInputClassification(rawMsg json. if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -77,7 +77,7 @@ func unmarshalConfigurationSettingsClassification(rawMsg json.RawMessage) (Confi if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -101,7 +101,7 @@ func unmarshalCreateProtectionIntentProviderSpecificDetailsClassification(rawMsg if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -119,7 +119,7 @@ func unmarshalDisableProtectionProviderSpecificInputClassification(rawMsg json.R if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -137,7 +137,7 @@ func unmarshalEnableMigrationProviderSpecificInputClassification(rawMsg json.Raw if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -155,7 +155,7 @@ func unmarshalEnableProtectionProviderSpecificInputClassification(rawMsg json.Ra if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -183,7 +183,7 @@ func unmarshalEventProviderSpecificDetailsClassification(rawMsg json.RawMessage) if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -217,7 +217,7 @@ func unmarshalEventSpecificDetailsClassification(rawMsg json.RawMessage) (EventS if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -235,7 +235,7 @@ func unmarshalFabricSpecificCreateNetworkMappingInputClassification(rawMsg json. if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -257,7 +257,7 @@ func unmarshalFabricSpecificCreationInputClassification(rawMsg json.RawMessage) if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -279,7 +279,7 @@ func unmarshalFabricSpecificDetailsClassification(rawMsg json.RawMessage) (Fabri if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -307,7 +307,7 @@ func unmarshalFabricSpecificUpdateNetworkMappingInputClassification(rawMsg json. if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -329,7 +329,7 @@ func unmarshalGroupTaskDetailsClassification(rawMsg json.RawMessage) (GroupTaskD if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -351,7 +351,7 @@ func unmarshalJobDetailsClassification(rawMsg json.RawMessage) (JobDetailsClassi if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -377,7 +377,7 @@ func unmarshalMigrateProviderSpecificInputClassification(rawMsg json.RawMessage) if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -395,7 +395,7 @@ func unmarshalMigrationProviderSpecificSettingsClassification(rawMsg json.RawMes if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -413,7 +413,7 @@ func unmarshalNetworkMappingFabricSpecificSettingsClassification(rawMsg json.Raw if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -435,7 +435,7 @@ func unmarshalPlannedFailoverProviderSpecificFailoverInputClassification(rawMsg if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -457,7 +457,7 @@ func unmarshalPolicyProviderSpecificDetailsClassification(rawMsg json.RawMessage if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -495,7 +495,7 @@ func unmarshalPolicyProviderSpecificInputClassification(rawMsg json.RawMessage) if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -531,7 +531,7 @@ func unmarshalProtectionContainerMappingProviderSpecificDetailsClassification(ra if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -553,7 +553,7 @@ func unmarshalProtectionProfileCustomDetailsClassification(rawMsg json.RawMessag if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -573,7 +573,7 @@ func unmarshalProviderSpecificRecoveryPointDetailsClassification(rawMsg json.Raw if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -595,7 +595,7 @@ func unmarshalRecoveryAvailabilitySetCustomDetailsClassification(rawMsg json.Raw if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -613,7 +613,7 @@ func unmarshalRecoveryPlanActionDetailsClassification(rawMsg json.RawMessage) (R if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -635,7 +635,7 @@ func unmarshalRecoveryPlanProviderSpecificDetailsClassification(rawMsg json.RawM if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -672,7 +672,7 @@ func unmarshalRecoveryPlanProviderSpecificFailoverInputClassification(rawMsg jso if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -721,7 +721,7 @@ func unmarshalRecoveryPlanProviderSpecificInputClassification(rawMsg json.RawMes if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -758,7 +758,7 @@ func unmarshalRecoveryProximityPlacementGroupCustomDetailsClassification(rawMsg if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -776,7 +776,7 @@ func unmarshalRecoveryResourceGroupCustomDetailsClassification(rawMsg json.RawMe if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -794,7 +794,7 @@ func unmarshalRecoveryVirtualNetworkCustomDetailsClassification(rawMsg json.RawM if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -814,7 +814,7 @@ func unmarshalRemoveDisksProviderSpecificInputClassification(rawMsg json.RawMess if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -832,7 +832,7 @@ func unmarshalReplicationProtectionIntentProviderSpecificSettingsClassification( if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -850,7 +850,7 @@ func unmarshalReplicationProviderSpecificContainerCreationInputClassification(ra if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -891,7 +891,7 @@ func unmarshalReplicationProviderSpecificContainerMappingInputClassification(raw if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -911,7 +911,7 @@ func unmarshalReplicationProviderSpecificSettingsClassification(rawMsg json.RawM if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -947,7 +947,7 @@ func unmarshalReplicationProviderSpecificUpdateContainerMappingInputClassificati if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -967,7 +967,7 @@ func unmarshalResumeReplicationProviderSpecificInputClassification(rawMsg json.R if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -985,7 +985,7 @@ func unmarshalResyncProviderSpecificInputClassification(rawMsg json.RawMessage) if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -1003,7 +1003,7 @@ func unmarshalReverseReplicationProviderSpecificInputClassification(rawMsg json. if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -1031,7 +1031,7 @@ func unmarshalStorageAccountCustomDetailsClassification(rawMsg json.RawMessage) if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -1049,7 +1049,7 @@ func unmarshalSwitchProtectionProviderSpecificInputClassification(rawMsg json.Ra if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -1067,7 +1067,7 @@ func unmarshalSwitchProviderSpecificInputClassification(rawMsg json.RawMessage) if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -1085,7 +1085,7 @@ func unmarshalTaskTypeDetailsClassification(rawMsg json.RawMessage) (TaskTypeDet if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -1117,7 +1117,7 @@ func unmarshalTestFailoverProviderSpecificInputClassification(rawMsg json.RawMes if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -1143,7 +1143,7 @@ func unmarshalTestMigrateProviderSpecificInputClassification(rawMsg json.RawMess if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -1161,7 +1161,7 @@ func unmarshalUnplannedFailoverProviderSpecificInputClassification(rawMsg json.R if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -1187,7 +1187,7 @@ func unmarshalUpdateApplianceForReplicationProtectedItemProviderSpecificInputCla if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -1205,7 +1205,7 @@ func unmarshalUpdateMigrationItemProviderSpecificInputClassification(rawMsg json if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -1223,7 +1223,7 @@ func unmarshalUpdateReplicationProtectedItemProviderInputClassification(rawMsg j if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/recoverypoints_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/recoverypoints_client.go index 166f0e59d35c..7327eb0deb82 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/recoverypoints_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/recoverypoints_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,55 +24,43 @@ import ( // RecoveryPointsClient contains the methods for the RecoveryPoints group. // Don't use this type directly, use NewRecoveryPointsClient() instead. type RecoveryPointsClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewRecoveryPointsClient creates a new instance of RecoveryPointsClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewRecoveryPointsClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RecoveryPointsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewRecoveryPointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RecoveryPointsClient, error) { + cl, err := arm.NewClient(moduleName+".RecoveryPointsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &RecoveryPointsClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // Get - Get the details of specified recovery point. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - The fabric name. -// protectionContainerName - The protection container name. -// replicatedProtectedItemName - The replication protected item name. -// recoveryPointName - The recovery point name. -// options - RecoveryPointsClientGetOptions contains the optional parameters for the RecoveryPointsClient.Get method. -func (client *RecoveryPointsClient) Get(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, recoveryPointName string, options *RecoveryPointsClientGetOptions) (RecoveryPointsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, recoveryPointName, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - The fabric name. +// - protectionContainerName - The protection container name. +// - replicatedProtectedItemName - The replication protected item name. +// - recoveryPointName - The recovery point name. +// - options - RecoveryPointsClientGetOptions contains the optional parameters for the RecoveryPointsClient.Get method. +func (client *RecoveryPointsClient) Get(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, recoveryPointName string, options *RecoveryPointsClientGetOptions) (RecoveryPointsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, recoveryPointName, options) if err != nil { return RecoveryPointsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return RecoveryPointsClientGetResponse{}, err } @@ -85,16 +71,16 @@ func (client *RecoveryPointsClient) Get(ctx context.Context, fabricName string, } // getCreateRequest creates the Get request. -func (client *RecoveryPointsClient) getCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, recoveryPointName string, options *RecoveryPointsClientGetOptions) (*policy.Request, error) { +func (client *RecoveryPointsClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, recoveryPointName string, options *RecoveryPointsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints/{recoveryPointName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -115,7 +101,7 @@ func (client *RecoveryPointsClient) getCreateRequest(ctx context.Context, fabric return nil, errors.New("parameter recoveryPointName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{recoveryPointName}", url.PathEscape(recoveryPointName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -136,13 +122,16 @@ func (client *RecoveryPointsClient) getHandleResponse(resp *http.Response) (Reco } // NewListByReplicationProtectedItemsPager - Lists the available recovery points for a replication protected item. +// // Generated from API version 2022-10-01 -// fabricName - The fabric name. -// protectionContainerName - The protection container name. -// replicatedProtectedItemName - The replication protected item name. -// options - RecoveryPointsClientListByReplicationProtectedItemsOptions contains the optional parameters for the RecoveryPointsClient.ListByReplicationProtectedItems -// method. -func (client *RecoveryPointsClient) NewListByReplicationProtectedItemsPager(fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *RecoveryPointsClientListByReplicationProtectedItemsOptions) *runtime.Pager[RecoveryPointsClientListByReplicationProtectedItemsResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - The fabric name. +// - protectionContainerName - The protection container name. +// - replicatedProtectedItemName - The replication protected item name. +// - options - RecoveryPointsClientListByReplicationProtectedItemsOptions contains the optional parameters for the RecoveryPointsClient.NewListByReplicationProtectedItemsPager +// method. +func (client *RecoveryPointsClient) NewListByReplicationProtectedItemsPager(resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *RecoveryPointsClientListByReplicationProtectedItemsOptions) *runtime.Pager[RecoveryPointsClientListByReplicationProtectedItemsResponse] { return runtime.NewPager(runtime.PagingHandler[RecoveryPointsClientListByReplicationProtectedItemsResponse]{ More: func(page RecoveryPointsClientListByReplicationProtectedItemsResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -151,14 +140,14 @@ func (client *RecoveryPointsClient) NewListByReplicationProtectedItemsPager(fabr var req *policy.Request var err error if page == nil { - req, err = client.listByReplicationProtectedItemsCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, options) + req, err = client.listByReplicationProtectedItemsCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return RecoveryPointsClientListByReplicationProtectedItemsResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return RecoveryPointsClientListByReplicationProtectedItemsResponse{}, err } @@ -171,16 +160,16 @@ func (client *RecoveryPointsClient) NewListByReplicationProtectedItemsPager(fabr } // listByReplicationProtectedItemsCreateRequest creates the ListByReplicationProtectedItems request. -func (client *RecoveryPointsClient) listByReplicationProtectedItemsCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *RecoveryPointsClientListByReplicationProtectedItemsOptions) (*policy.Request, error) { +func (client *RecoveryPointsClient) listByReplicationProtectedItemsCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *RecoveryPointsClientListByReplicationProtectedItemsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -197,7 +186,7 @@ func (client *RecoveryPointsClient) listByReplicationProtectedItemsCreateRequest return nil, errors.New("parameter replicatedProtectedItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{replicatedProtectedItemName}", url.PathEscape(replicatedProtectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/recoverypoints_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/recoverypoints_client_example_test.go index cf2f087b7fde..aa0e5897518d 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/recoverypoints_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/recoverypoints_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -13,48 +14,80 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/RecoveryPoints_ListByReplicationProtectedItems.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/RecoveryPoints_ListByReplicationProtectedItems.json func ExampleRecoveryPointsClient_NewListByReplicationProtectedItemsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewRecoveryPointsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByReplicationProtectedItemsPager("cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", nil) + pager := clientFactory.NewRecoveryPointsClient().NewListByReplicationProtectedItemsPager("vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.RecoveryPointCollection = armrecoveryservicessiterecovery.RecoveryPointCollection{ + // Value: []*armrecoveryservicessiterecovery.RecoveryPoint{ + // { + // Name: to.Ptr("b22134ea-620c-474b-9fa5-3c1cb47708e3"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems/recoveryPoints"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b/recoveryPoints/b22134ea-620c-474b-9fa5-3c1cb47708e3"), + // Properties: &armrecoveryservicessiterecovery.RecoveryPointProperties{ + // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T06:37:50.8082715Z"); return t}()), + // RecoveryPointType: to.Ptr("CrashConsistent"), + // }, + // }, + // { + // Name: to.Ptr("34cb2d05-e730-4d3f-b96b-a60a5e92acb2"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems/recoveryPoints"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b/recoveryPoints/34cb2d05-e730-4d3f-b96b-a60a5e92acb2"), + // Properties: &armrecoveryservicessiterecovery.RecoveryPointProperties{ + // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T07:37:30.9722019Z"); return t}()), + // RecoveryPointType: to.Ptr("CrashConsistent"), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/RecoveryPoints_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/RecoveryPoints_Get.json func ExampleRecoveryPointsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewRecoveryPointsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", "b22134ea-620c-474b-9fa5-3c1cb47708e3", nil) + res, err := clientFactory.NewRecoveryPointsClient().Get(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", "b22134ea-620c-474b-9fa5-3c1cb47708e3", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RecoveryPoint = armrecoveryservicessiterecovery.RecoveryPoint{ + // Name: to.Ptr("b22134ea-620c-474b-9fa5-3c1cb47708e3"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems/recoveryPoints"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b/recoveryPoints/b22134ea-620c-474b-9fa5-3c1cb47708e3"), + // Properties: &armrecoveryservicessiterecovery.RecoveryPointProperties{ + // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T06:37:50.8082715Z"); return t}()), + // RecoveryPointType: to.Ptr("CrashConsistent"), + // }, + // } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationalertsettings_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationalertsettings_client.go index 32caffa8db00..3c9b7ccddd46 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationalertsettings_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationalertsettings_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,54 +24,42 @@ import ( // ReplicationAlertSettingsClient contains the methods for the ReplicationAlertSettings group. // Don't use this type directly, use NewReplicationAlertSettingsClient() instead. type ReplicationAlertSettingsClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationAlertSettingsClient creates a new instance of ReplicationAlertSettingsClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationAlertSettingsClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationAlertSettingsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationAlertSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationAlertSettingsClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationAlertSettingsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationAlertSettingsClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // Create - Create or update an email notification(alert) configuration. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// alertSettingName - The name of the email notification(alert) configuration. -// request - The input to configure the email notification(alert). -// options - ReplicationAlertSettingsClientCreateOptions contains the optional parameters for the ReplicationAlertSettingsClient.Create -// method. -func (client *ReplicationAlertSettingsClient) Create(ctx context.Context, alertSettingName string, request ConfigureAlertRequest, options *ReplicationAlertSettingsClientCreateOptions) (ReplicationAlertSettingsClientCreateResponse, error) { - req, err := client.createCreateRequest(ctx, alertSettingName, request, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - alertSettingName - The name of the email notification(alert) configuration. +// - request - The input to configure the email notification(alert). +// - options - ReplicationAlertSettingsClientCreateOptions contains the optional parameters for the ReplicationAlertSettingsClient.Create +// method. +func (client *ReplicationAlertSettingsClient) Create(ctx context.Context, resourceName string, resourceGroupName string, alertSettingName string, request ConfigureAlertRequest, options *ReplicationAlertSettingsClientCreateOptions) (ReplicationAlertSettingsClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceName, resourceGroupName, alertSettingName, request, options) if err != nil { return ReplicationAlertSettingsClientCreateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationAlertSettingsClientCreateResponse{}, err } @@ -84,16 +70,16 @@ func (client *ReplicationAlertSettingsClient) Create(ctx context.Context, alertS } // createCreateRequest creates the Create request. -func (client *ReplicationAlertSettingsClient) createCreateRequest(ctx context.Context, alertSettingName string, request ConfigureAlertRequest, options *ReplicationAlertSettingsClientCreateOptions) (*policy.Request, error) { +func (client *ReplicationAlertSettingsClient) createCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, alertSettingName string, request ConfigureAlertRequest, options *ReplicationAlertSettingsClientCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -102,7 +88,7 @@ func (client *ReplicationAlertSettingsClient) createCreateRequest(ctx context.Co return nil, errors.New("parameter alertSettingName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{alertSettingName}", url.PathEscape(alertSettingName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -124,16 +110,19 @@ func (client *ReplicationAlertSettingsClient) createHandleResponse(resp *http.Re // Get - Gets the details of the specified email notification(alert) configuration. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// alertSettingName - The name of the email notification configuration. -// options - ReplicationAlertSettingsClientGetOptions contains the optional parameters for the ReplicationAlertSettingsClient.Get -// method. -func (client *ReplicationAlertSettingsClient) Get(ctx context.Context, alertSettingName string, options *ReplicationAlertSettingsClientGetOptions) (ReplicationAlertSettingsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, alertSettingName, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - alertSettingName - The name of the email notification configuration. +// - options - ReplicationAlertSettingsClientGetOptions contains the optional parameters for the ReplicationAlertSettingsClient.Get +// method. +func (client *ReplicationAlertSettingsClient) Get(ctx context.Context, resourceName string, resourceGroupName string, alertSettingName string, options *ReplicationAlertSettingsClientGetOptions) (ReplicationAlertSettingsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, alertSettingName, options) if err != nil { return ReplicationAlertSettingsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationAlertSettingsClientGetResponse{}, err } @@ -144,16 +133,16 @@ func (client *ReplicationAlertSettingsClient) Get(ctx context.Context, alertSett } // getCreateRequest creates the Get request. -func (client *ReplicationAlertSettingsClient) getCreateRequest(ctx context.Context, alertSettingName string, options *ReplicationAlertSettingsClientGetOptions) (*policy.Request, error) { +func (client *ReplicationAlertSettingsClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, alertSettingName string, options *ReplicationAlertSettingsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -162,7 +151,7 @@ func (client *ReplicationAlertSettingsClient) getCreateRequest(ctx context.Conte return nil, errors.New("parameter alertSettingName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{alertSettingName}", url.PathEscape(alertSettingName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -183,10 +172,13 @@ func (client *ReplicationAlertSettingsClient) getHandleResponse(resp *http.Respo } // NewListPager - Gets the list of email notification(alert) configurations for the vault. +// // Generated from API version 2022-10-01 -// options - ReplicationAlertSettingsClientListOptions contains the optional parameters for the ReplicationAlertSettingsClient.List -// method. -func (client *ReplicationAlertSettingsClient) NewListPager(options *ReplicationAlertSettingsClientListOptions) *runtime.Pager[ReplicationAlertSettingsClientListResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - ReplicationAlertSettingsClientListOptions contains the optional parameters for the ReplicationAlertSettingsClient.NewListPager +// method. +func (client *ReplicationAlertSettingsClient) NewListPager(resourceName string, resourceGroupName string, options *ReplicationAlertSettingsClientListOptions) *runtime.Pager[ReplicationAlertSettingsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationAlertSettingsClientListResponse]{ More: func(page ReplicationAlertSettingsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -195,14 +187,14 @@ func (client *ReplicationAlertSettingsClient) NewListPager(options *ReplicationA var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, resourceName, resourceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationAlertSettingsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationAlertSettingsClientListResponse{}, err } @@ -215,21 +207,21 @@ func (client *ReplicationAlertSettingsClient) NewListPager(options *ReplicationA } // listCreateRequest creates the List request. -func (client *ReplicationAlertSettingsClient) listCreateRequest(ctx context.Context, options *ReplicationAlertSettingsClientListOptions) (*policy.Request, error) { +func (client *ReplicationAlertSettingsClient) listCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationAlertSettingsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationalertsettings_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationalertsettings_client_example_test.go index 49b019d39153..11deaca3ef54 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationalertsettings_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationalertsettings_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -14,64 +15,91 @@ import ( "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/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationAlertSettings_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationAlertSettings_List.json func ExampleReplicationAlertSettingsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationAlertSettingsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(nil) + pager := clientFactory.NewReplicationAlertSettingsClient().NewListPager("vault1", "resourceGroupPS1", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.AlertCollection = armrecoveryservicessiterecovery.AlertCollection{ + // Value: []*armrecoveryservicessiterecovery.Alert{ + // { + // Name: to.Ptr("defaultAlertSetting"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationAlertSettings"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationAlertSettings/defaultAlertSetting"), + // Properties: &armrecoveryservicessiterecovery.AlertProperties{ + // CustomEmailAddresses: []*string{ + // to.Ptr("ronehr@microsoft.com")}, + // Locale: to.Ptr("en-US"), + // SendToOwners: to.Ptr("false"), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationAlertSettings_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationAlertSettings_Get.json func ExampleReplicationAlertSettingsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationAlertSettingsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "defaultAlertSetting", nil) + res, err := clientFactory.NewReplicationAlertSettingsClient().Get(ctx, "vault1", "resourceGroupPS1", "defaultAlertSetting", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Alert = armrecoveryservicessiterecovery.Alert{ + // Name: to.Ptr("defaultAlertSetting"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationAlertSettings"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationAlertSettings/defaultAlertSetting"), + // Properties: &armrecoveryservicessiterecovery.AlertProperties{ + // CustomEmailAddresses: []*string{ + // to.Ptr("ronehr@microsoft.com")}, + // Locale: to.Ptr("en-US"), + // SendToOwners: to.Ptr("false"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationAlertSettings_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationAlertSettings_Create.json func ExampleReplicationAlertSettingsClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationAlertSettingsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Create(ctx, "defaultAlertSetting", armrecoveryservicessiterecovery.ConfigureAlertRequest{ + res, err := clientFactory.NewReplicationAlertSettingsClient().Create(ctx, "vault1", "resourceGroupPS1", "defaultAlertSetting", armrecoveryservicessiterecovery.ConfigureAlertRequest{ Properties: &armrecoveryservicessiterecovery.ConfigureAlertRequestProperties{ CustomEmailAddresses: []*string{ to.Ptr("ronehr@microsoft.com")}, @@ -82,6 +110,18 @@ func ExampleReplicationAlertSettingsClient_Create() { if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Alert = armrecoveryservicessiterecovery.Alert{ + // Name: to.Ptr("defaultAlertSetting"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationAlertSettings"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationAlertSettings/defaultAlertSetting"), + // Properties: &armrecoveryservicessiterecovery.AlertProperties{ + // CustomEmailAddresses: []*string{ + // to.Ptr("ronehr@microsoft.com")}, + // Locale: to.Ptr("en-US"), + // SendToOwners: to.Ptr("false"), + // }, + // } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationappliances_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationappliances_client.go index ad4efddf9791..0d50ab6f5408 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationappliances_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationappliances_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,46 +24,34 @@ import ( // ReplicationAppliancesClient contains the methods for the ReplicationAppliances group. // Don't use this type directly, use NewReplicationAppliancesClient() instead. type ReplicationAppliancesClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationAppliancesClient creates a new instance of ReplicationAppliancesClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationAppliancesClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationAppliancesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationAppliancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationAppliancesClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationAppliancesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationAppliancesClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // NewListPager - Gets the list of Azure Site Recovery appliances for the vault. +// // Generated from API version 2022-10-01 -// options - ReplicationAppliancesClientListOptions contains the optional parameters for the ReplicationAppliancesClient.List -// method. -func (client *ReplicationAppliancesClient) NewListPager(options *ReplicationAppliancesClientListOptions) *runtime.Pager[ReplicationAppliancesClientListResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - ReplicationAppliancesClientListOptions contains the optional parameters for the ReplicationAppliancesClient.NewListPager +// method. +func (client *ReplicationAppliancesClient) NewListPager(resourceName string, resourceGroupName string, options *ReplicationAppliancesClientListOptions) *runtime.Pager[ReplicationAppliancesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationAppliancesClientListResponse]{ More: func(page ReplicationAppliancesClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -74,14 +60,14 @@ func (client *ReplicationAppliancesClient) NewListPager(options *ReplicationAppl var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, resourceName, resourceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationAppliancesClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationAppliancesClientListResponse{}, err } @@ -94,21 +80,21 @@ func (client *ReplicationAppliancesClient) NewListPager(options *ReplicationAppl } // listCreateRequest creates the List request. -func (client *ReplicationAppliancesClient) listCreateRequest(ctx context.Context, options *ReplicationAppliancesClientListOptions) (*policy.Request, error) { +func (client *ReplicationAppliancesClient) listCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationAppliancesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAppliances" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationappliances_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationappliances_client_example_test.go index 94853c867442..bb96903f1569 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationappliances_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationappliances_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -13,29 +14,42 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationAppliances_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationAppliances_List.json func ExampleReplicationAppliancesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationAppliancesClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(&armrecoveryservicessiterecovery.ReplicationAppliancesClientListOptions{Filter: nil}) + pager := clientFactory.NewReplicationAppliancesClient().NewListPager("vault1", "resourceGroupPS1", &armrecoveryservicessiterecovery.ReplicationAppliancesClientListOptions{Filter: nil}) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.ApplianceCollection = armrecoveryservicessiterecovery.ApplianceCollection{ + // Value: []*armrecoveryservicessiterecovery.ReplicationAppliance{ + // { + // Properties: &armrecoveryservicessiterecovery.ReplicationApplianceProperties{ + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.InMageRcmApplianceSpecificDetails{ + // InstanceType: to.Ptr("InMageRcm"), + // Appliances: []*armrecoveryservicessiterecovery.InMageRcmApplianceDetails{ + // }, + // }, + // }, + // }}, + // } } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationeligibilityresults_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationeligibilityresults_client.go index 1d80db2b552d..a312317e7717 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationeligibilityresults_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationeligibilityresults_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,50 +24,40 @@ import ( // ReplicationEligibilityResultsClient contains the methods for the ReplicationEligibilityResults group. // Don't use this type directly, use NewReplicationEligibilityResultsClient() instead. type ReplicationEligibilityResultsClient struct { - host string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationEligibilityResultsClient creates a new instance of ReplicationEligibilityResultsClient with the specified values. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationEligibilityResultsClient(resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationEligibilityResultsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationEligibilityResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationEligibilityResultsClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationEligibilityResultsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationEligibilityResultsClient{ - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // Get - Validates whether a given VM can be protected or not in which case returns list of errors. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// virtualMachineName - Virtual Machine name. -// options - ReplicationEligibilityResultsClientGetOptions contains the optional parameters for the ReplicationEligibilityResultsClient.Get -// method. -func (client *ReplicationEligibilityResultsClient) Get(ctx context.Context, virtualMachineName string, options *ReplicationEligibilityResultsClientGetOptions) (ReplicationEligibilityResultsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, virtualMachineName, options) +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - virtualMachineName - Virtual Machine name. +// - options - ReplicationEligibilityResultsClientGetOptions contains the optional parameters for the ReplicationEligibilityResultsClient.Get +// method. +func (client *ReplicationEligibilityResultsClient) Get(ctx context.Context, resourceGroupName string, virtualMachineName string, options *ReplicationEligibilityResultsClientGetOptions) (ReplicationEligibilityResultsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualMachineName, options) if err != nil { return ReplicationEligibilityResultsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationEligibilityResultsClientGetResponse{}, err } @@ -80,12 +68,12 @@ func (client *ReplicationEligibilityResultsClient) Get(ctx context.Context, virt } // getCreateRequest creates the Get request. -func (client *ReplicationEligibilityResultsClient) getCreateRequest(ctx context.Context, virtualMachineName string, options *ReplicationEligibilityResultsClientGetOptions) (*policy.Request, error) { +func (client *ReplicationEligibilityResultsClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, options *ReplicationEligibilityResultsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default" - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -94,7 +82,7 @@ func (client *ReplicationEligibilityResultsClient) getCreateRequest(ctx context. return nil, errors.New("parameter virtualMachineName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{virtualMachineName}", url.PathEscape(virtualMachineName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -116,16 +104,18 @@ func (client *ReplicationEligibilityResultsClient) getHandleResponse(resp *http. // List - Validates whether a given VM can be protected or not in which case returns list of errors. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// virtualMachineName - Virtual Machine name. -// options - ReplicationEligibilityResultsClientListOptions contains the optional parameters for the ReplicationEligibilityResultsClient.List -// method. -func (client *ReplicationEligibilityResultsClient) List(ctx context.Context, virtualMachineName string, options *ReplicationEligibilityResultsClientListOptions) (ReplicationEligibilityResultsClientListResponse, error) { - req, err := client.listCreateRequest(ctx, virtualMachineName, options) +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - virtualMachineName - Virtual Machine name. +// - options - ReplicationEligibilityResultsClientListOptions contains the optional parameters for the ReplicationEligibilityResultsClient.List +// method. +func (client *ReplicationEligibilityResultsClient) List(ctx context.Context, resourceGroupName string, virtualMachineName string, options *ReplicationEligibilityResultsClientListOptions) (ReplicationEligibilityResultsClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, virtualMachineName, options) if err != nil { return ReplicationEligibilityResultsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationEligibilityResultsClientListResponse{}, err } @@ -136,12 +126,12 @@ func (client *ReplicationEligibilityResultsClient) List(ctx context.Context, vir } // listCreateRequest creates the List request. -func (client *ReplicationEligibilityResultsClient) listCreateRequest(ctx context.Context, virtualMachineName string, options *ReplicationEligibilityResultsClientListOptions) (*policy.Request, error) { +func (client *ReplicationEligibilityResultsClient) listCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineName string, options *ReplicationEligibilityResultsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults" - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -150,7 +140,7 @@ func (client *ReplicationEligibilityResultsClient) listCreateRequest(ctx context return nil, errors.New("parameter virtualMachineName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{virtualMachineName}", url.PathEscape(virtualMachineName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationeligibilityresults_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationeligibilityresults_client_example_test.go index 96e992830e3e..16c4589244dc 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationeligibilityresults_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationeligibilityresults_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -13,43 +14,87 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationEligibilityResults_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationEligibilityResults_List.json func ExampleReplicationEligibilityResultsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationEligibilityResultsClient("testRg1", "d90d145a-4cdd-45a3-b2c4-971d69775278", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.List(ctx, "testVm2", nil) + res, err := clientFactory.NewReplicationEligibilityResultsClient().List(ctx, "testRg1", "testVm2", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReplicationEligibilityResultsCollection = armrecoveryservicessiterecovery.ReplicationEligibilityResultsCollection{ + // Value: []*armrecoveryservicessiterecovery.ReplicationEligibilityResults{ + // { + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.RecoveryServices/replicationEligibilityResults"), + // ID: to.Ptr("/subscriptions/d90d145a-4cdd-45a3-b2c4-971d69775278/resourceGroups/testRg1/providers/Microsoft.Compute/virtualMachines/testVm2/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default"), + // Properties: &armrecoveryservicessiterecovery.ReplicationEligibilityResultsProperties{ + // ClientRequestID: to.Ptr("a62c81df-e26e-47ea-ab4b-f1fcc1e5b135"), + // Errors: []*armrecoveryservicessiterecovery.ReplicationEligibilityResultsErrorInfo{ + // { + // Code: to.Ptr("AzureVmIsNotInDesiredProvisioningState"), + // Message: to.Ptr("Azure virtual machine with Id (/subscriptions/d90d145a-4cdd-45a3-b2c4-971d69775278/resourceGroups/testRg1/providers/Microsoft.Compute/virtualMachines/testVm2) is with provisioning state 'failed'. To enable replication, VM's provisioning state should be 'succeeded'."), + // PossibleCauses: to.Ptr("Virtual machine is not in desired state."), + // RecommendedAction: to.Ptr("\n Ensure that the VM's provisioning state is 'succeeded'.\n Refer to https://aka.ms/a2a-vm-state-issues to troubleshoot VM provisioning state issues.\n "), + // Status: to.Ptr("Error"), + // }, + // { + // Code: to.Ptr("AzureVmIsNotInDesiredPowerState"), + // Message: to.Ptr("Azure virtual machine with Id (/subscriptions/d90d145a-4cdd-45a3-b2c4-971d69775278/resourceGroups/testRg1/providers/Microsoft.Compute/virtualMachines/testVm2) is with power status 'deallocated'. To enable replication, VM's power status should be 'running'."), + // PossibleCauses: to.Ptr("Virtual machine is not in desired state."), + // RecommendedAction: to.Ptr("\n Ensure that the VM's power status is 'running'.\n You can check the power status in 'VM > Settings > Properties > Status' in Azure portal.\n "), + // Status: to.Ptr("Error"), + // }}, + // }, + // }}, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationEligibilityResults_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationEligibilityResults_Get.json func ExampleReplicationEligibilityResultsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationEligibilityResultsClient("testRg1", "d90d145a-4cdd-45a3-b2c4-971d69775278", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "testVm1", nil) + res, err := clientFactory.NewReplicationEligibilityResultsClient().Get(ctx, "testRg1", "testVm1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReplicationEligibilityResults = armrecoveryservicessiterecovery.ReplicationEligibilityResults{ + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.RecoveryServices/replicationEligibilityResults"), + // ID: to.Ptr("/subscriptions/d90d145a-4cdd-45a3-b2c4-971d69775278/resourceGroups/testRg1/providers/Microsoft.Compute/virtualMachines/testVm1/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default"), + // Properties: &armrecoveryservicessiterecovery.ReplicationEligibilityResultsProperties{ + // ClientRequestID: to.Ptr("7d72ade7-b9f7-4d9b-8a19-15d9728c6190"), + // Errors: []*armrecoveryservicessiterecovery.ReplicationEligibilityResultsErrorInfo{ + // { + // Code: to.Ptr("A2AOperatingSystemNotSupported"), + // Message: to.Ptr("The A2A operation could not be completed as the virtual machine is running OS 'ubuntu' with version '18.04' which is not supported for replication."), + // PossibleCauses: to.Ptr("OS version not supported."), + // RecommendedAction: to.Ptr("The virtual machine is running unsupported Operating system. Refer to the documentation for supported OS versions - https://aka.ms/a2a-os-support-matrix."), + // Status: to.Ptr("Error"), + // }}, + // }, + // } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationevents_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationevents_client.go index 7073f1927f21..60bf8da01066 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationevents_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationevents_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,52 +24,40 @@ import ( // ReplicationEventsClient contains the methods for the ReplicationEvents group. // Don't use this type directly, use NewReplicationEventsClient() instead. type ReplicationEventsClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationEventsClient creates a new instance of ReplicationEventsClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationEventsClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationEventsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationEventsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationEventsClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationEventsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationEventsClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // Get - The operation to get the details of an Azure Site recovery event. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// eventName - The name of the Azure Site Recovery event. -// options - ReplicationEventsClientGetOptions contains the optional parameters for the ReplicationEventsClient.Get method. -func (client *ReplicationEventsClient) Get(ctx context.Context, eventName string, options *ReplicationEventsClientGetOptions) (ReplicationEventsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, eventName, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - eventName - The name of the Azure Site Recovery event. +// - options - ReplicationEventsClientGetOptions contains the optional parameters for the ReplicationEventsClient.Get method. +func (client *ReplicationEventsClient) Get(ctx context.Context, resourceName string, resourceGroupName string, eventName string, options *ReplicationEventsClientGetOptions) (ReplicationEventsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, eventName, options) if err != nil { return ReplicationEventsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationEventsClientGetResponse{}, err } @@ -82,16 +68,16 @@ func (client *ReplicationEventsClient) Get(ctx context.Context, eventName string } // getCreateRequest creates the Get request. -func (client *ReplicationEventsClient) getCreateRequest(ctx context.Context, eventName string, options *ReplicationEventsClientGetOptions) (*policy.Request, error) { +func (client *ReplicationEventsClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, eventName string, options *ReplicationEventsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents/{eventName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -100,7 +86,7 @@ func (client *ReplicationEventsClient) getCreateRequest(ctx context.Context, eve return nil, errors.New("parameter eventName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{eventName}", url.PathEscape(eventName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -121,9 +107,13 @@ func (client *ReplicationEventsClient) getHandleResponse(resp *http.Response) (R } // NewListPager - Gets the list of Azure Site Recovery events for the vault. +// // Generated from API version 2022-10-01 -// options - ReplicationEventsClientListOptions contains the optional parameters for the ReplicationEventsClient.List method. -func (client *ReplicationEventsClient) NewListPager(options *ReplicationEventsClientListOptions) *runtime.Pager[ReplicationEventsClientListResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - ReplicationEventsClientListOptions contains the optional parameters for the ReplicationEventsClient.NewListPager +// method. +func (client *ReplicationEventsClient) NewListPager(resourceName string, resourceGroupName string, options *ReplicationEventsClientListOptions) *runtime.Pager[ReplicationEventsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationEventsClientListResponse]{ More: func(page ReplicationEventsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -132,14 +122,14 @@ func (client *ReplicationEventsClient) NewListPager(options *ReplicationEventsCl var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, resourceName, resourceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationEventsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationEventsClientListResponse{}, err } @@ -152,21 +142,21 @@ func (client *ReplicationEventsClient) NewListPager(options *ReplicationEventsCl } // listCreateRequest creates the List request. -func (client *ReplicationEventsClient) listCreateRequest(ctx context.Context, options *ReplicationEventsClientListOptions) (*policy.Request, error) { +func (client *ReplicationEventsClient) listCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationEventsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationevents_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationevents_client_example_test.go index 50e6b45ff451..e88d7b16cab8 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationevents_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationevents_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -13,48 +14,124 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationEvents_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationEvents_List.json func ExampleReplicationEventsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationEventsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(&armrecoveryservicessiterecovery.ReplicationEventsClientListOptions{Filter: nil}) + pager := clientFactory.NewReplicationEventsClient().NewListPager("vault1", "resourceGroupPS1", &armrecoveryservicessiterecovery.ReplicationEventsClientListOptions{Filter: nil}) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.EventCollection = armrecoveryservicessiterecovery.EventCollection{ + // Value: []*armrecoveryservicessiterecovery.Event{ + // { + // Name: to.Ptr("JobStatusMonitoringEvent;9091989892524070155_4ed6f1a6-9b6d-4048-9079-1307dd24b814"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationEvents"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationEvents/JobStatusMonitoringEvent;9091989892524070155_4ed6f1a6-9b6d-4048-9079-1307dd24b814"), + // Properties: &armrecoveryservicessiterecovery.EventProperties{ + // Description: to.Ptr("TestFailover - Failed"), + // AffectedObjectFriendlyName: to.Ptr("vm1"), + // EventCode: to.Ptr("d32574f6-f59e-4545-b5ac-bc88d545f089"), + // EventSpecificDetails: &armrecoveryservicessiterecovery.JobStatusEventDetails{ + // InstanceType: to.Ptr("JobStatus"), + // }, + // EventType: to.Ptr("JobStatus"), + // FabricID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1"), + // HealthErrors: []*armrecoveryservicessiterecovery.HealthError{ + // { + // ErrorCode: to.Ptr("499"), + // ErrorMessage: to.Ptr("An internal error occurred."), + // PossibleCauses: to.Ptr("The operation failed due to an internal error."), + // RecommendedAction: to.Ptr("Retry the last action. If the issue persists, contact Support."), + // }}, + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzureEventDetails{ + // InstanceType: to.Ptr("HyperVReplicaAzure"), + // }, + // Severity: to.Ptr("Critical"), + // TimeOfOccurrence: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-02T16:00:33.0705652Z"); return t}()), + // }, + // }, + // { + // Name: to.Ptr("VmMonitoringEvent;9091989947769704276_516de684-0079-48f7-b44b-882923268654"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationEvents"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationEvents/VmMonitoringEvent;9091989947769704276_516de684-0079-48f7-b44b-882923268654"), + // Properties: &armrecoveryservicessiterecovery.EventProperties{ + // Description: to.Ptr("Virtual machine health is OK"), + // AffectedObjectFriendlyName: to.Ptr("vm1"), + // EventCode: to.Ptr("d9a07b07-c7b5-49ca-ab6c-6926596dfe47"), + // EventSpecificDetails: &armrecoveryservicessiterecovery.JobStatusEventDetails{ + // InstanceType: to.Ptr("JobStatus"), + // }, + // EventType: to.Ptr("VmHealth"), + // FabricID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1"), + // HealthErrors: []*armrecoveryservicessiterecovery.HealthError{ + // }, + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzureEventDetails{ + // InstanceType: to.Ptr("HyperVReplicaAzure"), + // }, + // Severity: to.Ptr("OK"), + // TimeOfOccurrence: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-02T14:28:28.5071531Z"); return t}()), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationEvents_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationEvents_Get.json func ExampleReplicationEventsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationEventsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "654b71d0-b2ce-4e6e-a861-98528d4bd375", nil) + res, err := clientFactory.NewReplicationEventsClient().Get(ctx, "vault1", "resourceGroupPS1", "654b71d0-b2ce-4e6e-a861-98528d4bd375", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Event = armrecoveryservicessiterecovery.Event{ + // Name: to.Ptr("VmMonitoringEvent;9091989947769704276_516de684-0079-48f7-b44b-882923268654"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationEvents"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationEvents/VmMonitoringEvent;9091989947769704276_516de684-0079-48f7-b44b-882923268654"), + // Properties: &armrecoveryservicessiterecovery.EventProperties{ + // Description: to.Ptr("Virtual machine health is OK"), + // AffectedObjectFriendlyName: to.Ptr("vm1"), + // EventCode: to.Ptr("d9a07b07-c7b5-49ca-ab6c-6926596dfe47"), + // EventSpecificDetails: &armrecoveryservicessiterecovery.JobStatusEventDetails{ + // InstanceType: to.Ptr("JobStatus"), + // }, + // EventType: to.Ptr("VmHealth"), + // FabricID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1"), + // HealthErrors: []*armrecoveryservicessiterecovery.HealthError{ + // }, + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzureEventDetails{ + // InstanceType: to.Ptr("HyperVReplicaAzure"), + // }, + // Severity: to.Ptr("OK"), + // TimeOfOccurrence: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-02T14:28:28.5071531Z"); return t}()), + // }, + // } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationfabrics_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationfabrics_client.go index 82c2d2af8521..a1b52415248b 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationfabrics_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationfabrics_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,68 +24,57 @@ import ( // ReplicationFabricsClient contains the methods for the ReplicationFabrics group. // Don't use this type directly, use NewReplicationFabricsClient() instead. type ReplicationFabricsClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationFabricsClient creates a new instance of ReplicationFabricsClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationFabricsClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationFabricsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationFabricsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationFabricsClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationFabricsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationFabricsClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // BeginCheckConsistency - The operation to perform a consistency check on the fabric. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// options - ReplicationFabricsClientBeginCheckConsistencyOptions contains the optional parameters for the ReplicationFabricsClient.BeginCheckConsistency -// method. -func (client *ReplicationFabricsClient) BeginCheckConsistency(ctx context.Context, fabricName string, options *ReplicationFabricsClientBeginCheckConsistencyOptions) (*runtime.Poller[ReplicationFabricsClientCheckConsistencyResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - options - ReplicationFabricsClientBeginCheckConsistencyOptions contains the optional parameters for the ReplicationFabricsClient.BeginCheckConsistency +// method. +func (client *ReplicationFabricsClient) BeginCheckConsistency(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, options *ReplicationFabricsClientBeginCheckConsistencyOptions) (*runtime.Poller[ReplicationFabricsClientCheckConsistencyResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.checkConsistency(ctx, fabricName, options) + resp, err := client.checkConsistency(ctx, resourceName, resourceGroupName, fabricName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationFabricsClientCheckConsistencyResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationFabricsClientCheckConsistencyResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationFabricsClientCheckConsistencyResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationFabricsClientCheckConsistencyResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // CheckConsistency - The operation to perform a consistency check on the fabric. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationFabricsClient) checkConsistency(ctx context.Context, fabricName string, options *ReplicationFabricsClientBeginCheckConsistencyOptions) (*http.Response, error) { - req, err := client.checkConsistencyCreateRequest(ctx, fabricName, options) +func (client *ReplicationFabricsClient) checkConsistency(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, options *ReplicationFabricsClientBeginCheckConsistencyOptions) (*http.Response, error) { + req, err := client.checkConsistencyCreateRequest(ctx, resourceName, resourceGroupName, fabricName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -98,16 +85,16 @@ func (client *ReplicationFabricsClient) checkConsistency(ctx context.Context, fa } // checkConsistencyCreateRequest creates the CheckConsistency request. -func (client *ReplicationFabricsClient) checkConsistencyCreateRequest(ctx context.Context, fabricName string, options *ReplicationFabricsClientBeginCheckConsistencyOptions) (*policy.Request, error) { +func (client *ReplicationFabricsClient) checkConsistencyCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, options *ReplicationFabricsClientBeginCheckConsistencyOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/checkConsistency" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -116,7 +103,7 @@ func (client *ReplicationFabricsClient) checkConsistencyCreateRequest(ctx contex return nil, errors.New("parameter fabricName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -129,32 +116,36 @@ func (client *ReplicationFabricsClient) checkConsistencyCreateRequest(ctx contex // BeginCreate - The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Name of the ASR fabric. -// input - Fabric creation input. -// options - ReplicationFabricsClientBeginCreateOptions contains the optional parameters for the ReplicationFabricsClient.BeginCreate -// method. -func (client *ReplicationFabricsClient) BeginCreate(ctx context.Context, fabricName string, input FabricCreationInput, options *ReplicationFabricsClientBeginCreateOptions) (*runtime.Poller[ReplicationFabricsClientCreateResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Name of the ASR fabric. +// - input - Fabric creation input. +// - options - ReplicationFabricsClientBeginCreateOptions contains the optional parameters for the ReplicationFabricsClient.BeginCreate +// method. +func (client *ReplicationFabricsClient) BeginCreate(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, input FabricCreationInput, options *ReplicationFabricsClientBeginCreateOptions) (*runtime.Poller[ReplicationFabricsClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, fabricName, input, options) + resp, err := client.create(ctx, resourceName, resourceGroupName, fabricName, input, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationFabricsClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationFabricsClientCreateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationFabricsClientCreateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationFabricsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Create - The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationFabricsClient) create(ctx context.Context, fabricName string, input FabricCreationInput, options *ReplicationFabricsClientBeginCreateOptions) (*http.Response, error) { - req, err := client.createCreateRequest(ctx, fabricName, input, options) +func (client *ReplicationFabricsClient) create(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, input FabricCreationInput, options *ReplicationFabricsClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceName, resourceGroupName, fabricName, input, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -165,16 +156,16 @@ func (client *ReplicationFabricsClient) create(ctx context.Context, fabricName s } // createCreateRequest creates the Create request. -func (client *ReplicationFabricsClient) createCreateRequest(ctx context.Context, fabricName string, input FabricCreationInput, options *ReplicationFabricsClientBeginCreateOptions) (*policy.Request, error) { +func (client *ReplicationFabricsClient) createCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, input FabricCreationInput, options *ReplicationFabricsClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -183,7 +174,7 @@ func (client *ReplicationFabricsClient) createCreateRequest(ctx context.Context, return nil, errors.New("parameter fabricName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -196,31 +187,35 @@ func (client *ReplicationFabricsClient) createCreateRequest(ctx context.Context, // BeginDelete - The operation to delete or remove an Azure Site Recovery fabric. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - ASR fabric to delete. -// options - ReplicationFabricsClientBeginDeleteOptions contains the optional parameters for the ReplicationFabricsClient.BeginDelete -// method. -func (client *ReplicationFabricsClient) BeginDelete(ctx context.Context, fabricName string, options *ReplicationFabricsClientBeginDeleteOptions) (*runtime.Poller[ReplicationFabricsClientDeleteResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - ASR fabric to delete. +// - options - ReplicationFabricsClientBeginDeleteOptions contains the optional parameters for the ReplicationFabricsClient.BeginDelete +// method. +func (client *ReplicationFabricsClient) BeginDelete(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, options *ReplicationFabricsClientBeginDeleteOptions) (*runtime.Poller[ReplicationFabricsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, fabricName, options) + resp, err := client.deleteOperation(ctx, resourceName, resourceGroupName, fabricName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationFabricsClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationFabricsClientDeleteResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationFabricsClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationFabricsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - The operation to delete or remove an Azure Site Recovery fabric. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationFabricsClient) deleteOperation(ctx context.Context, fabricName string, options *ReplicationFabricsClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, fabricName, options) +func (client *ReplicationFabricsClient) deleteOperation(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, options *ReplicationFabricsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceName, resourceGroupName, fabricName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -231,16 +226,16 @@ func (client *ReplicationFabricsClient) deleteOperation(ctx context.Context, fab } // deleteCreateRequest creates the Delete request. -func (client *ReplicationFabricsClient) deleteCreateRequest(ctx context.Context, fabricName string, options *ReplicationFabricsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ReplicationFabricsClient) deleteCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, options *ReplicationFabricsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/remove" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -249,7 +244,7 @@ func (client *ReplicationFabricsClient) deleteCreateRequest(ctx context.Context, return nil, errors.New("parameter fabricName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -261,15 +256,18 @@ func (client *ReplicationFabricsClient) deleteCreateRequest(ctx context.Context, // Get - Gets the details of an Azure Site Recovery fabric. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// options - ReplicationFabricsClientGetOptions contains the optional parameters for the ReplicationFabricsClient.Get method. -func (client *ReplicationFabricsClient) Get(ctx context.Context, fabricName string, options *ReplicationFabricsClientGetOptions) (ReplicationFabricsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, fabricName, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - options - ReplicationFabricsClientGetOptions contains the optional parameters for the ReplicationFabricsClient.Get method. +func (client *ReplicationFabricsClient) Get(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, options *ReplicationFabricsClientGetOptions) (ReplicationFabricsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, fabricName, options) if err != nil { return ReplicationFabricsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationFabricsClientGetResponse{}, err } @@ -280,16 +278,16 @@ func (client *ReplicationFabricsClient) Get(ctx context.Context, fabricName stri } // getCreateRequest creates the Get request. -func (client *ReplicationFabricsClient) getCreateRequest(ctx context.Context, fabricName string, options *ReplicationFabricsClientGetOptions) (*policy.Request, error) { +func (client *ReplicationFabricsClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, options *ReplicationFabricsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -298,7 +296,7 @@ func (client *ReplicationFabricsClient) getCreateRequest(ctx context.Context, fa return nil, errors.New("parameter fabricName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -322,9 +320,13 @@ func (client *ReplicationFabricsClient) getHandleResponse(resp *http.Response) ( } // NewListPager - Gets a list of the Azure Site Recovery fabrics in the vault. +// // Generated from API version 2022-10-01 -// options - ReplicationFabricsClientListOptions contains the optional parameters for the ReplicationFabricsClient.List method. -func (client *ReplicationFabricsClient) NewListPager(options *ReplicationFabricsClientListOptions) *runtime.Pager[ReplicationFabricsClientListResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - ReplicationFabricsClientListOptions contains the optional parameters for the ReplicationFabricsClient.NewListPager +// method. +func (client *ReplicationFabricsClient) NewListPager(resourceName string, resourceGroupName string, options *ReplicationFabricsClientListOptions) *runtime.Pager[ReplicationFabricsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationFabricsClientListResponse]{ More: func(page ReplicationFabricsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -333,14 +335,14 @@ func (client *ReplicationFabricsClient) NewListPager(options *ReplicationFabrics var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, resourceName, resourceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationFabricsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationFabricsClientListResponse{}, err } @@ -353,21 +355,21 @@ func (client *ReplicationFabricsClient) NewListPager(options *ReplicationFabrics } // listCreateRequest creates the List request. -func (client *ReplicationFabricsClient) listCreateRequest(ctx context.Context, options *ReplicationFabricsClientListOptions) (*policy.Request, error) { +func (client *ReplicationFabricsClient) listCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationFabricsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -389,31 +391,35 @@ func (client *ReplicationFabricsClient) listHandleResponse(resp *http.Response) // BeginMigrateToAAD - The operation to migrate an Azure Site Recovery fabric to AAD. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - ASR fabric to migrate. -// options - ReplicationFabricsClientBeginMigrateToAADOptions contains the optional parameters for the ReplicationFabricsClient.BeginMigrateToAAD -// method. -func (client *ReplicationFabricsClient) BeginMigrateToAAD(ctx context.Context, fabricName string, options *ReplicationFabricsClientBeginMigrateToAADOptions) (*runtime.Poller[ReplicationFabricsClientMigrateToAADResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - ASR fabric to migrate. +// - options - ReplicationFabricsClientBeginMigrateToAADOptions contains the optional parameters for the ReplicationFabricsClient.BeginMigrateToAAD +// method. +func (client *ReplicationFabricsClient) BeginMigrateToAAD(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, options *ReplicationFabricsClientBeginMigrateToAADOptions) (*runtime.Poller[ReplicationFabricsClientMigrateToAADResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.migrateToAAD(ctx, fabricName, options) + resp, err := client.migrateToAAD(ctx, resourceName, resourceGroupName, fabricName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationFabricsClientMigrateToAADResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationFabricsClientMigrateToAADResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationFabricsClientMigrateToAADResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationFabricsClientMigrateToAADResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // MigrateToAAD - The operation to migrate an Azure Site Recovery fabric to AAD. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationFabricsClient) migrateToAAD(ctx context.Context, fabricName string, options *ReplicationFabricsClientBeginMigrateToAADOptions) (*http.Response, error) { - req, err := client.migrateToAADCreateRequest(ctx, fabricName, options) +func (client *ReplicationFabricsClient) migrateToAAD(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, options *ReplicationFabricsClientBeginMigrateToAADOptions) (*http.Response, error) { + req, err := client.migrateToAADCreateRequest(ctx, resourceName, resourceGroupName, fabricName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -424,16 +430,16 @@ func (client *ReplicationFabricsClient) migrateToAAD(ctx context.Context, fabric } // migrateToAADCreateRequest creates the MigrateToAAD request. -func (client *ReplicationFabricsClient) migrateToAADCreateRequest(ctx context.Context, fabricName string, options *ReplicationFabricsClientBeginMigrateToAADOptions) (*policy.Request, error) { +func (client *ReplicationFabricsClient) migrateToAADCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, options *ReplicationFabricsClientBeginMigrateToAADOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/migratetoaad" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -442,7 +448,7 @@ func (client *ReplicationFabricsClient) migrateToAADCreateRequest(ctx context.Co return nil, errors.New("parameter fabricName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -454,31 +460,35 @@ func (client *ReplicationFabricsClient) migrateToAADCreateRequest(ctx context.Co // BeginPurge - The operation to purge(force delete) an Azure Site Recovery fabric. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - ASR fabric to purge. -// options - ReplicationFabricsClientBeginPurgeOptions contains the optional parameters for the ReplicationFabricsClient.BeginPurge -// method. -func (client *ReplicationFabricsClient) BeginPurge(ctx context.Context, fabricName string, options *ReplicationFabricsClientBeginPurgeOptions) (*runtime.Poller[ReplicationFabricsClientPurgeResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - ASR fabric to purge. +// - options - ReplicationFabricsClientBeginPurgeOptions contains the optional parameters for the ReplicationFabricsClient.BeginPurge +// method. +func (client *ReplicationFabricsClient) BeginPurge(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, options *ReplicationFabricsClientBeginPurgeOptions) (*runtime.Poller[ReplicationFabricsClientPurgeResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.purge(ctx, fabricName, options) + resp, err := client.purge(ctx, resourceName, resourceGroupName, fabricName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationFabricsClientPurgeResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationFabricsClientPurgeResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationFabricsClientPurgeResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationFabricsClientPurgeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Purge - The operation to purge(force delete) an Azure Site Recovery fabric. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationFabricsClient) purge(ctx context.Context, fabricName string, options *ReplicationFabricsClientBeginPurgeOptions) (*http.Response, error) { - req, err := client.purgeCreateRequest(ctx, fabricName, options) +func (client *ReplicationFabricsClient) purge(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, options *ReplicationFabricsClientBeginPurgeOptions) (*http.Response, error) { + req, err := client.purgeCreateRequest(ctx, resourceName, resourceGroupName, fabricName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -489,16 +499,16 @@ func (client *ReplicationFabricsClient) purge(ctx context.Context, fabricName st } // purgeCreateRequest creates the Purge request. -func (client *ReplicationFabricsClient) purgeCreateRequest(ctx context.Context, fabricName string, options *ReplicationFabricsClientBeginPurgeOptions) (*policy.Request, error) { +func (client *ReplicationFabricsClient) purgeCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, options *ReplicationFabricsClientBeginPurgeOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -507,7 +517,7 @@ func (client *ReplicationFabricsClient) purgeCreateRequest(ctx context.Context, return nil, errors.New("parameter fabricName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -519,32 +529,36 @@ func (client *ReplicationFabricsClient) purgeCreateRequest(ctx context.Context, // BeginReassociateGateway - The operation to move replications from a process server to another process server. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - The name of the fabric containing the process server. -// failoverProcessServerRequest - The input to the failover process server operation. -// options - ReplicationFabricsClientBeginReassociateGatewayOptions contains the optional parameters for the ReplicationFabricsClient.BeginReassociateGateway -// method. -func (client *ReplicationFabricsClient) BeginReassociateGateway(ctx context.Context, fabricName string, failoverProcessServerRequest FailoverProcessServerRequest, options *ReplicationFabricsClientBeginReassociateGatewayOptions) (*runtime.Poller[ReplicationFabricsClientReassociateGatewayResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - The name of the fabric containing the process server. +// - failoverProcessServerRequest - The input to the failover process server operation. +// - options - ReplicationFabricsClientBeginReassociateGatewayOptions contains the optional parameters for the ReplicationFabricsClient.BeginReassociateGateway +// method. +func (client *ReplicationFabricsClient) BeginReassociateGateway(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, failoverProcessServerRequest FailoverProcessServerRequest, options *ReplicationFabricsClientBeginReassociateGatewayOptions) (*runtime.Poller[ReplicationFabricsClientReassociateGatewayResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.reassociateGateway(ctx, fabricName, failoverProcessServerRequest, options) + resp, err := client.reassociateGateway(ctx, resourceName, resourceGroupName, fabricName, failoverProcessServerRequest, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationFabricsClientReassociateGatewayResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationFabricsClientReassociateGatewayResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationFabricsClientReassociateGatewayResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationFabricsClientReassociateGatewayResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // ReassociateGateway - The operation to move replications from a process server to another process server. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationFabricsClient) reassociateGateway(ctx context.Context, fabricName string, failoverProcessServerRequest FailoverProcessServerRequest, options *ReplicationFabricsClientBeginReassociateGatewayOptions) (*http.Response, error) { - req, err := client.reassociateGatewayCreateRequest(ctx, fabricName, failoverProcessServerRequest, options) +func (client *ReplicationFabricsClient) reassociateGateway(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, failoverProcessServerRequest FailoverProcessServerRequest, options *ReplicationFabricsClientBeginReassociateGatewayOptions) (*http.Response, error) { + req, err := client.reassociateGatewayCreateRequest(ctx, resourceName, resourceGroupName, fabricName, failoverProcessServerRequest, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -555,16 +569,16 @@ func (client *ReplicationFabricsClient) reassociateGateway(ctx context.Context, } // reassociateGatewayCreateRequest creates the ReassociateGateway request. -func (client *ReplicationFabricsClient) reassociateGatewayCreateRequest(ctx context.Context, fabricName string, failoverProcessServerRequest FailoverProcessServerRequest, options *ReplicationFabricsClientBeginReassociateGatewayOptions) (*policy.Request, error) { +func (client *ReplicationFabricsClient) reassociateGatewayCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, failoverProcessServerRequest FailoverProcessServerRequest, options *ReplicationFabricsClientBeginReassociateGatewayOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/reassociateGateway" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -573,7 +587,7 @@ func (client *ReplicationFabricsClient) reassociateGatewayCreateRequest(ctx cont return nil, errors.New("parameter fabricName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -586,32 +600,36 @@ func (client *ReplicationFabricsClient) reassociateGatewayCreateRequest(ctx cont // BeginRenewCertificate - Renews the connection certificate for the ASR replication fabric. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - fabric name to renew certs for. -// renewCertificate - Renew certificate input. -// options - ReplicationFabricsClientBeginRenewCertificateOptions contains the optional parameters for the ReplicationFabricsClient.BeginRenewCertificate -// method. -func (client *ReplicationFabricsClient) BeginRenewCertificate(ctx context.Context, fabricName string, renewCertificate RenewCertificateInput, options *ReplicationFabricsClientBeginRenewCertificateOptions) (*runtime.Poller[ReplicationFabricsClientRenewCertificateResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - fabric name to renew certs for. +// - renewCertificate - Renew certificate input. +// - options - ReplicationFabricsClientBeginRenewCertificateOptions contains the optional parameters for the ReplicationFabricsClient.BeginRenewCertificate +// method. +func (client *ReplicationFabricsClient) BeginRenewCertificate(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, renewCertificate RenewCertificateInput, options *ReplicationFabricsClientBeginRenewCertificateOptions) (*runtime.Poller[ReplicationFabricsClientRenewCertificateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.renewCertificate(ctx, fabricName, renewCertificate, options) + resp, err := client.renewCertificate(ctx, resourceName, resourceGroupName, fabricName, renewCertificate, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationFabricsClientRenewCertificateResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationFabricsClientRenewCertificateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationFabricsClientRenewCertificateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationFabricsClientRenewCertificateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // RenewCertificate - Renews the connection certificate for the ASR replication fabric. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationFabricsClient) renewCertificate(ctx context.Context, fabricName string, renewCertificate RenewCertificateInput, options *ReplicationFabricsClientBeginRenewCertificateOptions) (*http.Response, error) { - req, err := client.renewCertificateCreateRequest(ctx, fabricName, renewCertificate, options) +func (client *ReplicationFabricsClient) renewCertificate(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, renewCertificate RenewCertificateInput, options *ReplicationFabricsClientBeginRenewCertificateOptions) (*http.Response, error) { + req, err := client.renewCertificateCreateRequest(ctx, resourceName, resourceGroupName, fabricName, renewCertificate, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -622,16 +640,16 @@ func (client *ReplicationFabricsClient) renewCertificate(ctx context.Context, fa } // renewCertificateCreateRequest creates the RenewCertificate request. -func (client *ReplicationFabricsClient) renewCertificateCreateRequest(ctx context.Context, fabricName string, renewCertificate RenewCertificateInput, options *ReplicationFabricsClientBeginRenewCertificateOptions) (*policy.Request, error) { +func (client *ReplicationFabricsClient) renewCertificateCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, renewCertificate RenewCertificateInput, options *ReplicationFabricsClientBeginRenewCertificateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -640,7 +658,7 @@ func (client *ReplicationFabricsClient) renewCertificateCreateRequest(ctx contex return nil, errors.New("parameter fabricName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationfabrics_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationfabrics_client_example_test.go index 2135ecd60a78..3be6ff31209c 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationfabrics_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationfabrics_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -14,64 +15,113 @@ import ( "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/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_List.json func ExampleReplicationFabricsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationFabricsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(nil) + pager := clientFactory.NewReplicationFabricsClient().NewListPager("vault1", "resourceGroupPS1", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.FabricCollection = armrecoveryservicessiterecovery.FabricCollection{ + // Value: []*armrecoveryservicessiterecovery.Fabric{ + // { + // Name: to.Ptr("cloud1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1"), + // Properties: &armrecoveryservicessiterecovery.FabricProperties{ + // BcdrState: to.Ptr("Valid"), + // CustomDetails: &armrecoveryservicessiterecovery.HyperVSiteDetails{ + // InstanceType: to.Ptr("HyperVSite"), + // }, + // EncryptionDetails: &armrecoveryservicessiterecovery.EncryptionDetails{ + // KekState: to.Ptr("None"), + // }, + // FriendlyName: to.Ptr("cloud1"), + // Health: to.Ptr("Normal"), + // HealthErrorDetails: []*armrecoveryservicessiterecovery.HealthError{ + // }, + // InternalIdentifier: to.Ptr("6d224fc6-f326-5d35-96de-fbf51efb3179"), + // RolloverEncryptionDetails: &armrecoveryservicessiterecovery.EncryptionDetails{ + // KekState: to.Ptr("None"), + // }, + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_Get.json func ExampleReplicationFabricsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationFabricsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "cloud1", &armrecoveryservicessiterecovery.ReplicationFabricsClientGetOptions{Filter: nil}) + res, err := clientFactory.NewReplicationFabricsClient().Get(ctx, "vault1", "resourceGroupPS1", "cloud1", &armrecoveryservicessiterecovery.ReplicationFabricsClientGetOptions{Filter: nil}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Fabric = armrecoveryservicessiterecovery.Fabric{ + // Name: to.Ptr("cloud1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1"), + // Properties: &armrecoveryservicessiterecovery.FabricProperties{ + // BcdrState: to.Ptr("Valid"), + // CustomDetails: &armrecoveryservicessiterecovery.HyperVSiteDetails{ + // InstanceType: to.Ptr("HyperVSite"), + // }, + // EncryptionDetails: &armrecoveryservicessiterecovery.EncryptionDetails{ + // KekState: to.Ptr("None"), + // }, + // FriendlyName: to.Ptr("cloud1"), + // Health: to.Ptr("Normal"), + // HealthErrorDetails: []*armrecoveryservicessiterecovery.HealthError{ + // }, + // InternalIdentifier: to.Ptr("6d224fc6-f326-5d35-96de-fbf51efb3179"), + // RolloverEncryptionDetails: &armrecoveryservicessiterecovery.EncryptionDetails{ + // KekState: to.Ptr("None"), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_Create.json func ExampleReplicationFabricsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationFabricsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreate(ctx, "cloud1", armrecoveryservicessiterecovery.FabricCreationInput{ + poller, err := clientFactory.NewReplicationFabricsClient().BeginCreate(ctx, "vault1", "resourceGroupPS1", "cloud1", armrecoveryservicessiterecovery.FabricCreationInput{ Properties: &armrecoveryservicessiterecovery.FabricCreationInputProperties{ CustomDetails: &armrecoveryservicessiterecovery.FabricSpecificCreationInput{ InstanceType: to.Ptr("FabricSpecificCreationInput"), @@ -85,22 +135,45 @@ func ExampleReplicationFabricsClient_BeginCreate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Fabric = armrecoveryservicessiterecovery.Fabric{ + // Name: to.Ptr("cloud1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1"), + // Properties: &armrecoveryservicessiterecovery.FabricProperties{ + // BcdrState: to.Ptr("Valid"), + // CustomDetails: &armrecoveryservicessiterecovery.HyperVSiteDetails{ + // InstanceType: to.Ptr("HyperVSite"), + // }, + // EncryptionDetails: &armrecoveryservicessiterecovery.EncryptionDetails{ + // KekState: to.Ptr("None"), + // }, + // FriendlyName: to.Ptr("cloud1"), + // Health: to.Ptr("Normal"), + // HealthErrorDetails: []*armrecoveryservicessiterecovery.HealthError{ + // }, + // InternalIdentifier: to.Ptr("6d224fc6-f326-5d35-96de-fbf51efb3179"), + // RolloverEncryptionDetails: &armrecoveryservicessiterecovery.EncryptionDetails{ + // KekState: to.Ptr("None"), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_Purge.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_Purge.json func ExampleReplicationFabricsClient_BeginPurge() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationFabricsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginPurge(ctx, "cloud1", nil) + poller, err := clientFactory.NewReplicationFabricsClient().BeginPurge(ctx, "vault1", "resourceGroupPS1", "cloud1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -110,18 +183,18 @@ func ExampleReplicationFabricsClient_BeginPurge() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_CheckConsistency.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_CheckConsistency.json func ExampleReplicationFabricsClient_BeginCheckConsistency() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationFabricsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCheckConsistency(ctx, "cloud1", nil) + poller, err := clientFactory.NewReplicationFabricsClient().BeginCheckConsistency(ctx, "vault1", "resourceGroupPS1", "cloud1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -129,22 +202,45 @@ func ExampleReplicationFabricsClient_BeginCheckConsistency() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Fabric = armrecoveryservicessiterecovery.Fabric{ + // Name: to.Ptr("cloud1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1"), + // Properties: &armrecoveryservicessiterecovery.FabricProperties{ + // BcdrState: to.Ptr("Valid"), + // CustomDetails: &armrecoveryservicessiterecovery.HyperVSiteDetails{ + // InstanceType: to.Ptr("HyperVSite"), + // }, + // EncryptionDetails: &armrecoveryservicessiterecovery.EncryptionDetails{ + // KekState: to.Ptr("None"), + // }, + // FriendlyName: to.Ptr("cloud1"), + // Health: to.Ptr("Normal"), + // HealthErrorDetails: []*armrecoveryservicessiterecovery.HealthError{ + // }, + // InternalIdentifier: to.Ptr("6d224fc6-f326-5d35-96de-fbf51efb3179"), + // RolloverEncryptionDetails: &armrecoveryservicessiterecovery.EncryptionDetails{ + // KekState: to.Ptr("None"), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_MigrateToAad.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_MigrateToAad.json func ExampleReplicationFabricsClient_BeginMigrateToAAD() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationFabricsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginMigrateToAAD(ctx, "cloud1", nil) + poller, err := clientFactory.NewReplicationFabricsClient().BeginMigrateToAAD(ctx, "vault1", "resourceGroupPS1", "cloud1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -154,18 +250,18 @@ func ExampleReplicationFabricsClient_BeginMigrateToAAD() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_ReassociateGateway.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_ReassociateGateway.json func ExampleReplicationFabricsClient_BeginReassociateGateway() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationFabricsClient("MadhaviVault", "MadhaviVRG", "7c943c1b-5122-4097-90c8-861411bdd574", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginReassociateGateway(ctx, "GRACE-V2A-1", armrecoveryservicessiterecovery.FailoverProcessServerRequest{ + poller, err := clientFactory.NewReplicationFabricsClient().BeginReassociateGateway(ctx, "MadhaviVault", "MadhaviVRG", "GRACE-V2A-1", armrecoveryservicessiterecovery.FailoverProcessServerRequest{ Properties: &armrecoveryservicessiterecovery.FailoverProcessServerRequestProperties{ ContainerName: to.Ptr("cloud_1f3c15af-2256-4568-9e06-e1ef4f728f75"), SourceProcessServerID: to.Ptr("AFA0EC54-1894-4E44-9CAB02DB8854B117"), @@ -183,22 +279,45 @@ func ExampleReplicationFabricsClient_BeginReassociateGateway() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Fabric = armrecoveryservicessiterecovery.Fabric{ + // Name: to.Ptr("bc15edf300344660d9c2965f5d9225593d99734f6580613c997033abc3512a56"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics"), + // ID: to.Ptr("/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/MadhaviVRG/providers/Microsoft.RecoveryServices/vaults/MadhaviVault/replicationFabrics/bc15edf300344660d9c2965f5d9225593d99734f6580613c997033abc3512a56"), + // Properties: &armrecoveryservicessiterecovery.FabricProperties{ + // BcdrState: to.Ptr("Valid"), + // CustomDetails: &armrecoveryservicessiterecovery.VMwareDetails{ + // InstanceType: to.Ptr("VMware"), + // }, + // EncryptionDetails: &armrecoveryservicessiterecovery.EncryptionDetails{ + // KekState: to.Ptr("None"), + // }, + // FriendlyName: to.Ptr("GRACE-V2A-1"), + // Health: to.Ptr("Normal"), + // HealthErrorDetails: []*armrecoveryservicessiterecovery.HealthError{ + // }, + // InternalIdentifier: to.Ptr("1f3c15af-2256-4568-9e06-e1ef4f728f75"), + // RolloverEncryptionDetails: &armrecoveryservicessiterecovery.EncryptionDetails{ + // KekState: to.Ptr("None"), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_Delete.json func ExampleReplicationFabricsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationFabricsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, "cloud1", nil) + poller, err := clientFactory.NewReplicationFabricsClient().BeginDelete(ctx, "vault1", "resourceGroupPS1", "cloud1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -208,18 +327,18 @@ func ExampleReplicationFabricsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_RenewCertificate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_RenewCertificate.json func ExampleReplicationFabricsClient_BeginRenewCertificate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationFabricsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginRenewCertificate(ctx, "cloud1", armrecoveryservicessiterecovery.RenewCertificateInput{ + poller, err := clientFactory.NewReplicationFabricsClient().BeginRenewCertificate(ctx, "vault1", "resourceGroupPS1", "cloud1", armrecoveryservicessiterecovery.RenewCertificateInput{ Properties: &armrecoveryservicessiterecovery.RenewCertificateInputProperties{ RenewCertificateType: to.Ptr("Cloud"), }, @@ -231,6 +350,29 @@ func ExampleReplicationFabricsClient_BeginRenewCertificate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Fabric = armrecoveryservicessiterecovery.Fabric{ + // Name: to.Ptr("cloud1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1"), + // Properties: &armrecoveryservicessiterecovery.FabricProperties{ + // BcdrState: to.Ptr("Valid"), + // CustomDetails: &armrecoveryservicessiterecovery.HyperVSiteDetails{ + // InstanceType: to.Ptr("HyperVSite"), + // }, + // EncryptionDetails: &armrecoveryservicessiterecovery.EncryptionDetails{ + // KekState: to.Ptr("None"), + // }, + // FriendlyName: to.Ptr("cloud1"), + // Health: to.Ptr("Normal"), + // HealthErrorDetails: []*armrecoveryservicessiterecovery.HealthError{ + // }, + // InternalIdentifier: to.Ptr("6d224fc6-f326-5d35-96de-fbf51efb3179"), + // RolloverEncryptionDetails: &armrecoveryservicessiterecovery.EncryptionDetails{ + // KekState: to.Ptr("None"), + // }, + // }, + // } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationjobs_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationjobs_client.go index b4f3c129259e..8b6376f64c60 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationjobs_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationjobs_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,68 +24,57 @@ import ( // ReplicationJobsClient contains the methods for the ReplicationJobs group. // Don't use this type directly, use NewReplicationJobsClient() instead. type ReplicationJobsClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationJobsClient creates a new instance of ReplicationJobsClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationJobsClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationJobsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationJobsClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationJobsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationJobsClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // BeginCancel - The operation to cancel an Azure Site Recovery job. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// jobName - Job identifier. -// options - ReplicationJobsClientBeginCancelOptions contains the optional parameters for the ReplicationJobsClient.BeginCancel -// method. -func (client *ReplicationJobsClient) BeginCancel(ctx context.Context, jobName string, options *ReplicationJobsClientBeginCancelOptions) (*runtime.Poller[ReplicationJobsClientCancelResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - jobName - Job identifier. +// - options - ReplicationJobsClientBeginCancelOptions contains the optional parameters for the ReplicationJobsClient.BeginCancel +// method. +func (client *ReplicationJobsClient) BeginCancel(ctx context.Context, resourceName string, resourceGroupName string, jobName string, options *ReplicationJobsClientBeginCancelOptions) (*runtime.Poller[ReplicationJobsClientCancelResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.cancel(ctx, jobName, options) + resp, err := client.cancel(ctx, resourceName, resourceGroupName, jobName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationJobsClientCancelResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationJobsClientCancelResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationJobsClientCancelResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationJobsClientCancelResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Cancel - The operation to cancel an Azure Site Recovery job. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationJobsClient) cancel(ctx context.Context, jobName string, options *ReplicationJobsClientBeginCancelOptions) (*http.Response, error) { - req, err := client.cancelCreateRequest(ctx, jobName, options) +func (client *ReplicationJobsClient) cancel(ctx context.Context, resourceName string, resourceGroupName string, jobName string, options *ReplicationJobsClientBeginCancelOptions) (*http.Response, error) { + req, err := client.cancelCreateRequest(ctx, resourceName, resourceGroupName, jobName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -98,16 +85,16 @@ func (client *ReplicationJobsClient) cancel(ctx context.Context, jobName string, } // cancelCreateRequest creates the Cancel request. -func (client *ReplicationJobsClient) cancelCreateRequest(ctx context.Context, jobName string, options *ReplicationJobsClientBeginCancelOptions) (*policy.Request, error) { +func (client *ReplicationJobsClient) cancelCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, jobName string, options *ReplicationJobsClientBeginCancelOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/cancel" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -116,7 +103,7 @@ func (client *ReplicationJobsClient) cancelCreateRequest(ctx context.Context, jo return nil, errors.New("parameter jobName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -129,31 +116,35 @@ func (client *ReplicationJobsClient) cancelCreateRequest(ctx context.Context, jo // BeginExport - The operation to export the details of the Azure Site Recovery jobs of the vault. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// jobQueryParameter - job query filter. -// options - ReplicationJobsClientBeginExportOptions contains the optional parameters for the ReplicationJobsClient.BeginExport -// method. -func (client *ReplicationJobsClient) BeginExport(ctx context.Context, jobQueryParameter JobQueryParameter, options *ReplicationJobsClientBeginExportOptions) (*runtime.Poller[ReplicationJobsClientExportResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - jobQueryParameter - job query filter. +// - options - ReplicationJobsClientBeginExportOptions contains the optional parameters for the ReplicationJobsClient.BeginExport +// method. +func (client *ReplicationJobsClient) BeginExport(ctx context.Context, resourceName string, resourceGroupName string, jobQueryParameter JobQueryParameter, options *ReplicationJobsClientBeginExportOptions) (*runtime.Poller[ReplicationJobsClientExportResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.export(ctx, jobQueryParameter, options) + resp, err := client.export(ctx, resourceName, resourceGroupName, jobQueryParameter, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationJobsClientExportResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationJobsClientExportResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationJobsClientExportResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationJobsClientExportResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Export - The operation to export the details of the Azure Site Recovery jobs of the vault. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationJobsClient) export(ctx context.Context, jobQueryParameter JobQueryParameter, options *ReplicationJobsClientBeginExportOptions) (*http.Response, error) { - req, err := client.exportCreateRequest(ctx, jobQueryParameter, options) +func (client *ReplicationJobsClient) export(ctx context.Context, resourceName string, resourceGroupName string, jobQueryParameter JobQueryParameter, options *ReplicationJobsClientBeginExportOptions) (*http.Response, error) { + req, err := client.exportCreateRequest(ctx, resourceName, resourceGroupName, jobQueryParameter, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -164,21 +155,21 @@ func (client *ReplicationJobsClient) export(ctx context.Context, jobQueryParamet } // exportCreateRequest creates the Export request. -func (client *ReplicationJobsClient) exportCreateRequest(ctx context.Context, jobQueryParameter JobQueryParameter, options *ReplicationJobsClientBeginExportOptions) (*policy.Request, error) { +func (client *ReplicationJobsClient) exportCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, jobQueryParameter JobQueryParameter, options *ReplicationJobsClientBeginExportOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/export" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -191,15 +182,18 @@ func (client *ReplicationJobsClient) exportCreateRequest(ctx context.Context, jo // Get - Get the details of an Azure Site Recovery job. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// jobName - Job identifier. -// options - ReplicationJobsClientGetOptions contains the optional parameters for the ReplicationJobsClient.Get method. -func (client *ReplicationJobsClient) Get(ctx context.Context, jobName string, options *ReplicationJobsClientGetOptions) (ReplicationJobsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, jobName, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - jobName - Job identifier. +// - options - ReplicationJobsClientGetOptions contains the optional parameters for the ReplicationJobsClient.Get method. +func (client *ReplicationJobsClient) Get(ctx context.Context, resourceName string, resourceGroupName string, jobName string, options *ReplicationJobsClientGetOptions) (ReplicationJobsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, jobName, options) if err != nil { return ReplicationJobsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationJobsClientGetResponse{}, err } @@ -210,16 +204,16 @@ func (client *ReplicationJobsClient) Get(ctx context.Context, jobName string, op } // getCreateRequest creates the Get request. -func (client *ReplicationJobsClient) getCreateRequest(ctx context.Context, jobName string, options *ReplicationJobsClientGetOptions) (*policy.Request, error) { +func (client *ReplicationJobsClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, jobName string, options *ReplicationJobsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -228,7 +222,7 @@ func (client *ReplicationJobsClient) getCreateRequest(ctx context.Context, jobNa return nil, errors.New("parameter jobName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -249,9 +243,13 @@ func (client *ReplicationJobsClient) getHandleResponse(resp *http.Response) (Rep } // NewListPager - Gets the list of Azure Site Recovery Jobs for the vault. +// // Generated from API version 2022-10-01 -// options - ReplicationJobsClientListOptions contains the optional parameters for the ReplicationJobsClient.List method. -func (client *ReplicationJobsClient) NewListPager(options *ReplicationJobsClientListOptions) *runtime.Pager[ReplicationJobsClientListResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - ReplicationJobsClientListOptions contains the optional parameters for the ReplicationJobsClient.NewListPager +// method. +func (client *ReplicationJobsClient) NewListPager(resourceName string, resourceGroupName string, options *ReplicationJobsClientListOptions) *runtime.Pager[ReplicationJobsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationJobsClientListResponse]{ More: func(page ReplicationJobsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -260,14 +258,14 @@ func (client *ReplicationJobsClient) NewListPager(options *ReplicationJobsClient var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, resourceName, resourceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationJobsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationJobsClientListResponse{}, err } @@ -280,21 +278,21 @@ func (client *ReplicationJobsClient) NewListPager(options *ReplicationJobsClient } // listCreateRequest creates the List request. -func (client *ReplicationJobsClient) listCreateRequest(ctx context.Context, options *ReplicationJobsClientListOptions) (*policy.Request, error) { +func (client *ReplicationJobsClient) listCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationJobsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -319,31 +317,35 @@ func (client *ReplicationJobsClient) listHandleResponse(resp *http.Response) (Re // BeginRestart - The operation to restart an Azure Site Recovery job. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// jobName - Job identifier. -// options - ReplicationJobsClientBeginRestartOptions contains the optional parameters for the ReplicationJobsClient.BeginRestart -// method. -func (client *ReplicationJobsClient) BeginRestart(ctx context.Context, jobName string, options *ReplicationJobsClientBeginRestartOptions) (*runtime.Poller[ReplicationJobsClientRestartResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - jobName - Job identifier. +// - options - ReplicationJobsClientBeginRestartOptions contains the optional parameters for the ReplicationJobsClient.BeginRestart +// method. +func (client *ReplicationJobsClient) BeginRestart(ctx context.Context, resourceName string, resourceGroupName string, jobName string, options *ReplicationJobsClientBeginRestartOptions) (*runtime.Poller[ReplicationJobsClientRestartResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.restart(ctx, jobName, options) + resp, err := client.restart(ctx, resourceName, resourceGroupName, jobName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationJobsClientRestartResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationJobsClientRestartResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationJobsClientRestartResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationJobsClientRestartResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Restart - The operation to restart an Azure Site Recovery job. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationJobsClient) restart(ctx context.Context, jobName string, options *ReplicationJobsClientBeginRestartOptions) (*http.Response, error) { - req, err := client.restartCreateRequest(ctx, jobName, options) +func (client *ReplicationJobsClient) restart(ctx context.Context, resourceName string, resourceGroupName string, jobName string, options *ReplicationJobsClientBeginRestartOptions) (*http.Response, error) { + req, err := client.restartCreateRequest(ctx, resourceName, resourceGroupName, jobName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -354,16 +356,16 @@ func (client *ReplicationJobsClient) restart(ctx context.Context, jobName string } // restartCreateRequest creates the Restart request. -func (client *ReplicationJobsClient) restartCreateRequest(ctx context.Context, jobName string, options *ReplicationJobsClientBeginRestartOptions) (*policy.Request, error) { +func (client *ReplicationJobsClient) restartCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, jobName string, options *ReplicationJobsClientBeginRestartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/restart" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -372,7 +374,7 @@ func (client *ReplicationJobsClient) restartCreateRequest(ctx context.Context, j return nil, errors.New("parameter jobName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -385,32 +387,36 @@ func (client *ReplicationJobsClient) restartCreateRequest(ctx context.Context, j // BeginResume - The operation to resume an Azure Site Recovery job. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// jobName - Job identifier. -// resumeJobParams - Resume rob comments. -// options - ReplicationJobsClientBeginResumeOptions contains the optional parameters for the ReplicationJobsClient.BeginResume -// method. -func (client *ReplicationJobsClient) BeginResume(ctx context.Context, jobName string, resumeJobParams ResumeJobParams, options *ReplicationJobsClientBeginResumeOptions) (*runtime.Poller[ReplicationJobsClientResumeResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - jobName - Job identifier. +// - resumeJobParams - Resume rob comments. +// - options - ReplicationJobsClientBeginResumeOptions contains the optional parameters for the ReplicationJobsClient.BeginResume +// method. +func (client *ReplicationJobsClient) BeginResume(ctx context.Context, resourceName string, resourceGroupName string, jobName string, resumeJobParams ResumeJobParams, options *ReplicationJobsClientBeginResumeOptions) (*runtime.Poller[ReplicationJobsClientResumeResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.resume(ctx, jobName, resumeJobParams, options) + resp, err := client.resume(ctx, resourceName, resourceGroupName, jobName, resumeJobParams, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationJobsClientResumeResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationJobsClientResumeResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationJobsClientResumeResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationJobsClientResumeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Resume - The operation to resume an Azure Site Recovery job. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationJobsClient) resume(ctx context.Context, jobName string, resumeJobParams ResumeJobParams, options *ReplicationJobsClientBeginResumeOptions) (*http.Response, error) { - req, err := client.resumeCreateRequest(ctx, jobName, resumeJobParams, options) +func (client *ReplicationJobsClient) resume(ctx context.Context, resourceName string, resourceGroupName string, jobName string, resumeJobParams ResumeJobParams, options *ReplicationJobsClientBeginResumeOptions) (*http.Response, error) { + req, err := client.resumeCreateRequest(ctx, resourceName, resourceGroupName, jobName, resumeJobParams, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -421,16 +427,16 @@ func (client *ReplicationJobsClient) resume(ctx context.Context, jobName string, } // resumeCreateRequest creates the Resume request. -func (client *ReplicationJobsClient) resumeCreateRequest(ctx context.Context, jobName string, resumeJobParams ResumeJobParams, options *ReplicationJobsClientBeginResumeOptions) (*policy.Request, error) { +func (client *ReplicationJobsClient) resumeCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, jobName string, resumeJobParams ResumeJobParams, options *ReplicationJobsClientBeginResumeOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/resume" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -439,7 +445,7 @@ func (client *ReplicationJobsClient) resumeCreateRequest(ctx context.Context, jo return nil, errors.New("parameter jobName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationjobs_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationjobs_client_example_test.go index dce27be495d7..13b8886ce6f3 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationjobs_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationjobs_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -14,64 +15,180 @@ import ( "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/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_List.json func ExampleReplicationJobsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationJobsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(&armrecoveryservicessiterecovery.ReplicationJobsClientListOptions{Filter: nil}) + pager := clientFactory.NewReplicationJobsClient().NewListPager("vault1", "resourceGroupPS1", &armrecoveryservicessiterecovery.ReplicationJobsClientListOptions{Filter: nil}) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.JobCollection = armrecoveryservicessiterecovery.JobCollection{ + // Value: []*armrecoveryservicessiterecovery.Job{ + // { + // Name: to.Ptr("1557d73f-6244-491e-8f0b-d300f752240b"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/1557d73f-6244-491e-8f0b-d300f752240b"), + // Properties: &armrecoveryservicessiterecovery.JobProperties{ + // AllowedActions: []*string{ + // }, + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T12:46:11Z"); return t}()), + // Errors: []*armrecoveryservicessiterecovery.JobErrorDetails{ + // }, + // FriendlyName: to.Ptr("Create replication policy"), + // ScenarioName: to.Ptr("AddProtectionProfile"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T12:46:04.641851Z"); return t}()), + // State: to.Ptr("Succeeded"), + // StateDescription: to.Ptr("Completed"), + // TargetInstanceType: to.Ptr("ProtectionProfile"), + // TargetObjectID: to.Ptr("af095a1e-1f1b-5365-87c9-99162ebcfaf0"), + // TargetObjectName: to.Ptr("protectionprofile1"), + // Tasks: []*armrecoveryservicessiterecovery.ASRTask{ + // }, + // }, + // }, + // { + // Name: to.Ptr("0236416a-7573-4913-a4a1-6a286fbb1ceb"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/0236416a-7573-4913-a4a1-6a286fbb1ceb"), + // Properties: &armrecoveryservicessiterecovery.JobProperties{ + // AllowedActions: []*string{ + // }, + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-02T14:07:21Z"); return t}()), + // Errors: []*armrecoveryservicessiterecovery.JobErrorDetails{ + // }, + // FriendlyName: to.Ptr("Register the Azure Site Recovery Provider"), + // ScenarioName: to.Ptr("RegisterDra"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-02T14:07:19.2784338Z"); return t}()), + // State: to.Ptr("Succeeded"), + // StateDescription: to.Ptr("Completed"), + // TargetInstanceType: to.Ptr("Server"), + // TargetObjectID: to.Ptr("6d224fc6-f326-5d35-96de-fbf51efb3179"), + // TargetObjectName: to.Ptr("CP-B3L40406-12.ntdev.corp.microsoft.com"), + // Tasks: []*armrecoveryservicessiterecovery.ASRTask{ + // }, + // }, + // }, + // { + // Name: to.Ptr("2438d560-80f0-420b-839e-5c8ee0af90a1"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/2438d560-80f0-420b-839e-5c8ee0af90a1"), + // Properties: &armrecoveryservicessiterecovery.JobProperties{ + // AllowedActions: []*string{ + // }, + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-02T05:56:16Z"); return t}()), + // Errors: []*armrecoveryservicessiterecovery.JobErrorDetails{ + // }, + // FriendlyName: to.Ptr("Create a site"), + // ScenarioName: to.Ptr("CreateSite"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-02T05:56:14.569095Z"); return t}()), + // State: to.Ptr("Succeeded"), + // StateDescription: to.Ptr("Completed"), + // TargetInstanceType: to.Ptr("Server"), + // TargetObjectID: to.Ptr("6d224fc6-f326-5d35-96de-fbf51efb3179"), + // TargetObjectName: to.Ptr("cloud1"), + // Tasks: []*armrecoveryservicessiterecovery.ASRTask{ + // }, + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_Get.json func ExampleReplicationJobsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationJobsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "58776d0b-3141-48b2-a377-9ad863eb160d", nil) + res, err := clientFactory.NewReplicationJobsClient().Get(ctx, "vault1", "resourceGroupPS1", "58776d0b-3141-48b2-a377-9ad863eb160d", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Job = armrecoveryservicessiterecovery.Job{ + // Name: to.Ptr("32ea4b9e-de62-49a1-b062-7864d5c3b897"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/32ea4b9e-de62-49a1-b062-7864d5c3b897"), + // Properties: &armrecoveryservicessiterecovery.JobProperties{ + // ActivityID: to.Ptr("fc8e9c8f-0e76-4b6b-8e7e-d37c1b31eba0 ActivityId: c506b6ba-0711-411e-8b09-1f3f4dcb824b"), + // AllowedActions: []*string{ + // }, + // CustomDetails: &armrecoveryservicessiterecovery.AsrJobDetails{ + // AffectedObjectDetails: map[string]*string{ + // "PrimaryFabricProviderId": to.Ptr("HyperVSite"), + // "PrimaryVmmId": to.Ptr("6d224fc6-f326-5d35-96de-fbf51efb3179"), + // "PrimaryVmmName": to.Ptr("cloud1"), + // "RecoveryFabricProviderId": to.Ptr("Azure"), + // "RecoveryVmmId": to.Ptr("21a9403c-6ec1-44f2-b744-b4e50b792387"), + // }, + // InstanceType: to.Ptr("AsrJobDetails"), + // }, + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T11:25:57Z"); return t}()), + // Errors: []*armrecoveryservicessiterecovery.JobErrorDetails{ + // }, + // FriendlyName: to.Ptr("Delete a recovery plan"), + // ScenarioName: to.Ptr("DeleteRecoveryPlan"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T11:25:56.800358Z"); return t}()), + // State: to.Ptr("Succeeded"), + // StateDescription: to.Ptr("Completed"), + // TargetInstanceType: to.Ptr("RecoveryPlan"), + // TargetObjectID: to.Ptr("966c33bb-66e7-4567-9786-f80b0694f5f9"), + // TargetObjectName: to.Ptr("RPtest1"), + // Tasks: []*armrecoveryservicessiterecovery.ASRTask{ + // { + // Name: to.Ptr("DeleteRecoveryPlanTask"), + // AllowedActions: []*string{ + // }, + // CustomDetails: &armrecoveryservicessiterecovery.ManualActionTaskDetails{ + // InstanceType: to.Ptr("ManualActionTaskDetails"), + // }, + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T11:25:57.318574Z"); return t}()), + // Errors: []*armrecoveryservicessiterecovery.JobErrorDetails{ + // }, + // FriendlyName: to.Ptr("Delete a recovery plan task"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T11:25:57.3029434Z"); return t}()), + // State: to.Ptr("Succeeded"), + // StateDescription: to.Ptr("Completed"), + // TaskID: to.Ptr("763326a2-01c9-4257-b2a1-0aac56465014"), + // TaskType: to.Ptr("TaskDetails"), + // }}, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_Cancel.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_Cancel.json func ExampleReplicationJobsClient_BeginCancel() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationJobsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCancel(ctx, "2653c648-fc72-4316-86f3-fdf8eaa0066b", nil) + poller, err := clientFactory.NewReplicationJobsClient().BeginCancel(ctx, "vault1", "resourceGroupPS1", "2653c648-fc72-4316-86f3-fdf8eaa0066b", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -79,22 +196,64 @@ func ExampleReplicationJobsClient_BeginCancel() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Job = armrecoveryservicessiterecovery.Job{ + // Name: to.Ptr("2653c648-fc72-4316-86f3-fdf8eaa0066b"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/2653c648-fc72-4316-86f3-fdf8eaa0066b"), + // Properties: &armrecoveryservicessiterecovery.JobProperties{ + // ActivityID: to.Ptr("bfbbf6dd-9cbb-4cbc-98a6-faecc8891579 ActivityId: 07cc35ca-b63f-4e42-83c9-81ae0191c322"), + // AllowedActions: []*string{ + // }, + // CustomDetails: &armrecoveryservicessiterecovery.AsrJobDetails{ + // AffectedObjectDetails: map[string]*string{ + // "PrimaryCloudId": to.Ptr("cloud_6d224fc6-f326-5d35-96de-fbf51efb3179"), + // "PrimaryCloudName": to.Ptr("cloud1"), + // "PrimaryFabricProviderId": to.Ptr("HyperVSite"), + // "PrimaryVmId": to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // "PrimaryVmName": to.Ptr("vm1"), + // "PrimaryVmmId": to.Ptr("6d224fc6-f326-5d35-96de-fbf51efb3179"), + // "PrimaryVmmName": to.Ptr("cloud1"), + // "ProtectionProfileId": to.Ptr("af095a1e-1f1b-5365-87c9-99162ebcfaf0"), + // "RecoveryCloudId": to.Ptr("d38048d4-b460-4791-8ece-108395ee8478"), + // "RecoveryCloudName": to.Ptr("Microsoft Azure"), + // "RecoveryFabricProviderId": to.Ptr("Azure"), + // "RecoveryVmId": to.Ptr(""), + // "RecoveryVmName": to.Ptr("vm1"), + // "RecoveryVmmId": to.Ptr("21a9403c-6ec1-44f2-b744-b4e50b792387"), + // "RecoveryVmmName": to.Ptr("Microsoft Azure"), + // }, + // InstanceType: to.Ptr("AsrJobDetails"), + // }, + // Errors: []*armrecoveryservicessiterecovery.JobErrorDetails{ + // }, + // FriendlyName: to.Ptr("Planned failover"), + // ScenarioName: to.Ptr("PlannedFailover"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-03T06:16:06.3235186Z"); return t}()), + // State: to.Ptr("Cancelling"), + // StateDescription: to.Ptr("Cancelling"), + // TargetInstanceType: to.Ptr("ProtectionEntity"), + // TargetObjectID: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // TargetObjectName: to.Ptr("vm1"), + // Tasks: []*armrecoveryservicessiterecovery.ASRTask{ + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_Restart.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_Restart.json func ExampleReplicationJobsClient_BeginRestart() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationJobsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginRestart(ctx, "0664564c-353e-401a-ab0c-722257c10e25", nil) + poller, err := clientFactory.NewReplicationJobsClient().BeginRestart(ctx, "vault1", "resourceGroupPS1", "0664564c-353e-401a-ab0c-722257c10e25", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -102,22 +261,66 @@ func ExampleReplicationJobsClient_BeginRestart() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Job = armrecoveryservicessiterecovery.Job{ + // Name: to.Ptr("42c7d13b-790c-4609-8e0b-0936f1c5e5fb"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/42c7d13b-790c-4609-8e0b-0936f1c5e5fb"), + // Properties: &armrecoveryservicessiterecovery.JobProperties{ + // ActivityID: to.Ptr("2443a5b4-e675-499f-8983-4126ea0e232c ActivityId: 2a776896-5e56-470b-af55-3c981283c4bc"), + // AllowedActions: []*string{ + // }, + // CustomDetails: &armrecoveryservicessiterecovery.AsrJobDetails{ + // AffectedObjectDetails: map[string]*string{ + // }, + // InstanceType: to.Ptr("AsrJobDetails"), + // }, + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-03T10:45:14Z"); return t}()), + // Errors: []*armrecoveryservicessiterecovery.JobErrorDetails{ + // }, + // FriendlyName: to.Ptr("Restart job"), + // ScenarioName: to.Ptr("RestartJob"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-03T10:45:12.1320757Z"); return t}()), + // State: to.Ptr("Succeeded"), + // StateDescription: to.Ptr("Completed"), + // TargetInstanceType: to.Ptr("ProtectionEntity"), + // TargetObjectID: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // TargetObjectName: to.Ptr("vm1"), + // Tasks: []*armrecoveryservicessiterecovery.ASRTask{ + // { + // Name: to.Ptr("RemediateTask"), + // AllowedActions: []*string{ + // }, + // CustomDetails: &armrecoveryservicessiterecovery.ManualActionTaskDetails{ + // InstanceType: to.Ptr("ManualActionTaskDetails"), + // }, + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-03T10:45:13.6458467Z"); return t}()), + // Errors: []*armrecoveryservicessiterecovery.JobErrorDetails{ + // }, + // FriendlyName: to.Ptr("Restarting job"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-03T10:45:13.5677237Z"); return t}()), + // State: to.Ptr("Succeeded"), + // StateDescription: to.Ptr("Completed"), + // TaskID: to.Ptr("RemediateWfTask"), + // TaskType: to.Ptr("TaskDetails"), + // }}, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_Resume.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_Resume.json func ExampleReplicationJobsClient_BeginResume() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationJobsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginResume(ctx, "58776d0b-3141-48b2-a377-9ad863eb160d", armrecoveryservicessiterecovery.ResumeJobParams{ + poller, err := clientFactory.NewReplicationJobsClient().BeginResume(ctx, "vault1", "resourceGroupPS1", "58776d0b-3141-48b2-a377-9ad863eb160d", armrecoveryservicessiterecovery.ResumeJobParams{ Properties: &armrecoveryservicessiterecovery.ResumeJobParamsProperties{ Comments: to.Ptr(" "), }, @@ -129,22 +332,80 @@ func ExampleReplicationJobsClient_BeginResume() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Job = armrecoveryservicessiterecovery.Job{ + // Name: to.Ptr("58776d0b-3141-48b2-a377-9ad863eb160d"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/58776d0b-3141-48b2-a377-9ad863eb160d"), + // Properties: &armrecoveryservicessiterecovery.JobProperties{ + // ActivityID: to.Ptr("1b808dfe-0451-44ac-894c-c7270711cd8c ActivityId: 9f6f849e-922a-43ec-a7a6-0be45fc85c56"), + // AllowedActions: []*string{ + // to.Ptr("Cancel"), + // to.Ptr("Resume")}, + // CustomDetails: &armrecoveryservicessiterecovery.TestFailoverJobDetails{ + // AffectedObjectDetails: map[string]*string{ + // "PrimaryCloudId": to.Ptr("cloud_6d224fc6-f326-5d35-96de-fbf51efb3179"), + // "PrimaryCloudName": to.Ptr("cloud1"), + // "PrimaryFabricProviderId": to.Ptr("HyperVSite"), + // "PrimaryVmId": to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // "PrimaryVmName": to.Ptr("vm1"), + // "PrimaryVmmId": to.Ptr("6d224fc6-f326-5d35-96de-fbf51efb3179"), + // "PrimaryVmmName": to.Ptr("cloud1"), + // "ProtectionProfileId": to.Ptr("af095a1e-1f1b-5365-87c9-99162ebcfaf0"), + // "RecoveryCloudId": to.Ptr("d38048d4-b460-4791-8ece-108395ee8478"), + // "RecoveryCloudName": to.Ptr("Microsoft Azure"), + // "RecoveryFabricProviderId": to.Ptr("Azure"), + // "RecoveryVmId": to.Ptr(""), + // "RecoveryVmName": to.Ptr("vm1"), + // "RecoveryVmmId": to.Ptr("21a9403c-6ec1-44f2-b744-b4e50b792387"), + // "RecoveryVmmName": to.Ptr("Microsoft Azure"), + // }, + // InstanceType: to.Ptr("TestFailoverJobDetails"), + // Comments: to.Ptr(" "), + // NetworkFriendlyName: to.Ptr("vnetavrai"), + // NetworkName: to.Ptr("vnetavrai"), + // NetworkType: to.Ptr("VmNetworkAsInput"), + // ProtectedItemDetails: []*armrecoveryservicessiterecovery.FailoverReplicationProtectedItemDetails{ + // { + // Name: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // FriendlyName: to.Ptr("vm1"), + // NetworkConnectionStatus: to.Ptr("Connected"), + // NetworkFriendlyName: to.Ptr("vnetavrai"), + // Subnet: to.Ptr("Subnet1"), + // TestVMFriendlyName: to.Ptr("vm1-test"), + // TestVMName: to.Ptr("vm1-test"), + // }}, + // TestFailoverStatus: to.Ptr("Completed"), + // }, + // Errors: []*armrecoveryservicessiterecovery.JobErrorDetails{ + // }, + // FriendlyName: to.Ptr("Test failover"), + // ScenarioName: to.Ptr("TestFailover"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-25T09:57:57.0357829Z"); return t}()), + // State: to.Ptr("Suspended"), + // StateDescription: to.Ptr("WaitingForStopTestFailover"), + // TargetInstanceType: to.Ptr("ProtectionEntity"), + // TargetObjectID: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // TargetObjectName: to.Ptr("vm1"), + // Tasks: []*armrecoveryservicessiterecovery.ASRTask{ + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_Export.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_Export.json func ExampleReplicationJobsClient_BeginExport() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationJobsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginExport(ctx, armrecoveryservicessiterecovery.JobQueryParameter{ + poller, err := clientFactory.NewReplicationJobsClient().BeginExport(ctx, "vault1", "resourceGroupPS1", armrecoveryservicessiterecovery.JobQueryParameter{ AffectedObjectTypes: to.Ptr(""), EndTime: to.Ptr("2017-05-04T14:26:51.9161395Z"), JobStatus: to.Ptr(""), @@ -157,6 +418,35 @@ func ExampleReplicationJobsClient_BeginExport() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Job = armrecoveryservicessiterecovery.Job{ + // Name: to.Ptr("37e0fc2b-13f2-4817-aafa-0cd807d46842"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/37e0fc2b-13f2-4817-aafa-0cd807d46842"), + // Properties: &armrecoveryservicessiterecovery.JobProperties{ + // ActivityID: to.Ptr("36841d27-34f6-49ad-b572-e7dc263f100b-2017-05-04 14:26:47Z-Ibz ActivityId: c124df21-7661-4541-b32a-3c723ebbb045"), + // AllowedActions: []*string{ + // }, + // CustomDetails: &armrecoveryservicessiterecovery.ExportJobDetails{ + // AffectedObjectDetails: map[string]*string{ + // }, + // InstanceType: to.Ptr("ExportJobDetails"), + // BlobURI: to.Ptr(""), + // SasToken: to.Ptr(""), + // }, + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-04T14:33:43Z"); return t}()), + // Errors: []*armrecoveryservicessiterecovery.JobErrorDetails{ + // }, + // ScenarioName: to.Ptr("ExportJobs"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-04T14:33:42.2765562Z"); return t}()), + // State: to.Ptr("Succeeded"), + // StateDescription: to.Ptr("Completed"), + // TargetInstanceType: to.Ptr("Other"), + // TargetObjectID: to.Ptr(""), + // TargetObjectName: to.Ptr(""), + // Tasks: []*armrecoveryservicessiterecovery.ASRTask{ + // }, + // }, + // } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationlogicalnetworks_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationlogicalnetworks_client.go index 848ed84b542f..f09fb2d7f5da 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationlogicalnetworks_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationlogicalnetworks_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,54 +24,42 @@ import ( // ReplicationLogicalNetworksClient contains the methods for the ReplicationLogicalNetworks group. // Don't use this type directly, use NewReplicationLogicalNetworksClient() instead. type ReplicationLogicalNetworksClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationLogicalNetworksClient creates a new instance of ReplicationLogicalNetworksClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationLogicalNetworksClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationLogicalNetworksClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationLogicalNetworksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationLogicalNetworksClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationLogicalNetworksClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationLogicalNetworksClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // Get - Gets the details of a logical network. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Server Id. -// logicalNetworkName - Logical network name. -// options - ReplicationLogicalNetworksClientGetOptions contains the optional parameters for the ReplicationLogicalNetworksClient.Get -// method. -func (client *ReplicationLogicalNetworksClient) Get(ctx context.Context, fabricName string, logicalNetworkName string, options *ReplicationLogicalNetworksClientGetOptions) (ReplicationLogicalNetworksClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, fabricName, logicalNetworkName, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Server Id. +// - logicalNetworkName - Logical network name. +// - options - ReplicationLogicalNetworksClientGetOptions contains the optional parameters for the ReplicationLogicalNetworksClient.Get +// method. +func (client *ReplicationLogicalNetworksClient) Get(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, logicalNetworkName string, options *ReplicationLogicalNetworksClientGetOptions) (ReplicationLogicalNetworksClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, fabricName, logicalNetworkName, options) if err != nil { return ReplicationLogicalNetworksClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationLogicalNetworksClientGetResponse{}, err } @@ -84,16 +70,16 @@ func (client *ReplicationLogicalNetworksClient) Get(ctx context.Context, fabricN } // getCreateRequest creates the Get request. -func (client *ReplicationLogicalNetworksClient) getCreateRequest(ctx context.Context, fabricName string, logicalNetworkName string, options *ReplicationLogicalNetworksClientGetOptions) (*policy.Request, error) { +func (client *ReplicationLogicalNetworksClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, logicalNetworkName string, options *ReplicationLogicalNetworksClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks/{logicalNetworkName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -106,7 +92,7 @@ func (client *ReplicationLogicalNetworksClient) getCreateRequest(ctx context.Con return nil, errors.New("parameter logicalNetworkName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{logicalNetworkName}", url.PathEscape(logicalNetworkName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -127,11 +113,14 @@ func (client *ReplicationLogicalNetworksClient) getHandleResponse(resp *http.Res } // NewListByReplicationFabricsPager - Lists all the logical networks of the Azure Site Recovery fabric. +// // Generated from API version 2022-10-01 -// fabricName - Server Id. -// options - ReplicationLogicalNetworksClientListByReplicationFabricsOptions contains the optional parameters for the ReplicationLogicalNetworksClient.ListByReplicationFabrics -// method. -func (client *ReplicationLogicalNetworksClient) NewListByReplicationFabricsPager(fabricName string, options *ReplicationLogicalNetworksClientListByReplicationFabricsOptions) *runtime.Pager[ReplicationLogicalNetworksClientListByReplicationFabricsResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Server Id. +// - options - ReplicationLogicalNetworksClientListByReplicationFabricsOptions contains the optional parameters for the ReplicationLogicalNetworksClient.NewListByReplicationFabricsPager +// method. +func (client *ReplicationLogicalNetworksClient) NewListByReplicationFabricsPager(resourceName string, resourceGroupName string, fabricName string, options *ReplicationLogicalNetworksClientListByReplicationFabricsOptions) *runtime.Pager[ReplicationLogicalNetworksClientListByReplicationFabricsResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationLogicalNetworksClientListByReplicationFabricsResponse]{ More: func(page ReplicationLogicalNetworksClientListByReplicationFabricsResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -140,14 +129,14 @@ func (client *ReplicationLogicalNetworksClient) NewListByReplicationFabricsPager var req *policy.Request var err error if page == nil { - req, err = client.listByReplicationFabricsCreateRequest(ctx, fabricName, options) + req, err = client.listByReplicationFabricsCreateRequest(ctx, resourceName, resourceGroupName, fabricName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationLogicalNetworksClientListByReplicationFabricsResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationLogicalNetworksClientListByReplicationFabricsResponse{}, err } @@ -160,16 +149,16 @@ func (client *ReplicationLogicalNetworksClient) NewListByReplicationFabricsPager } // listByReplicationFabricsCreateRequest creates the ListByReplicationFabrics request. -func (client *ReplicationLogicalNetworksClient) listByReplicationFabricsCreateRequest(ctx context.Context, fabricName string, options *ReplicationLogicalNetworksClientListByReplicationFabricsOptions) (*policy.Request, error) { +func (client *ReplicationLogicalNetworksClient) listByReplicationFabricsCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, options *ReplicationLogicalNetworksClientListByReplicationFabricsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -178,7 +167,7 @@ func (client *ReplicationLogicalNetworksClient) listByReplicationFabricsCreateRe return nil, errors.New("parameter fabricName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationlogicalnetworks_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationlogicalnetworks_client_example_test.go index 948db4666786..c24defa616cc 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationlogicalnetworks_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationlogicalnetworks_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -13,48 +14,86 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationLogicalNetworks_ListByReplicationFabrics.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationLogicalNetworks_ListByReplicationFabrics.json func ExampleReplicationLogicalNetworksClient_NewListByReplicationFabricsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationLogicalNetworksClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByReplicationFabricsPager("cloud1", nil) + pager := clientFactory.NewReplicationLogicalNetworksClient().NewListByReplicationFabricsPager("vault1", "resourceGroupPS1", "cloud1", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.LogicalNetworkCollection = armrecoveryservicessiterecovery.LogicalNetworkCollection{ + // Value: []*armrecoveryservicessiterecovery.LogicalNetwork{ + // { + // Name: to.Ptr("87ab394f-165f-4aa9-bd84-b018500b4509"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationLogicalNetworks"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationLogicalNetworks/53f5a278-ae85-4001-bd5f-f6a02e1f579d"), + // Properties: &armrecoveryservicessiterecovery.LogicalNetworkProperties{ + // FriendlyName: to.Ptr("corp"), + // LogicalNetworkDefinitionsStatus: to.Ptr("LogicalNetworkDefinitionsNotIsolated"), + // LogicalNetworkUsage: to.Ptr("NotUsedAsPrivateNetworkForTestFailover"), + // NetworkVirtualizationStatus: to.Ptr("NetworkVirtualizationNotEnabled"), + // }, + // }, + // { + // Name: to.Ptr("53f5a278-ae85-4001-bd5f-f6a02e1f579d"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationLogicalNetworks"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationLogicalNetworks/87ab394f-165f-4aa9-bd84-b018500b4509"), + // Properties: &armrecoveryservicessiterecovery.LogicalNetworkProperties{ + // FriendlyName: to.Ptr("LN-VLANNetwork-4"), + // LogicalNetworkDefinitionsStatus: to.Ptr("LogicalNetworkDefinitionsIsolated"), + // LogicalNetworkUsage: to.Ptr("NotUsedAsPrivateNetworkForTestFailover"), + // NetworkVirtualizationStatus: to.Ptr("NetworkVirtualizationNotEnabled"), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationLogicalNetworks_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationLogicalNetworks_Get.json func ExampleReplicationLogicalNetworksClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationLogicalNetworksClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "cloud1", "87ab394f-165f-4aa9-bd84-b018500b4509", nil) + res, err := clientFactory.NewReplicationLogicalNetworksClient().Get(ctx, "vault1", "resourceGroupPS1", "cloud1", "87ab394f-165f-4aa9-bd84-b018500b4509", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.LogicalNetwork = armrecoveryservicessiterecovery.LogicalNetwork{ + // Name: to.Ptr("87ab394f-165f-4aa9-bd84-b018500b4509"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationLogicalNetworks"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationLogicalNetworks/53f5a278-ae85-4001-bd5f-f6a02e1f579d"), + // Properties: &armrecoveryservicessiterecovery.LogicalNetworkProperties{ + // FriendlyName: to.Ptr("corp"), + // LogicalNetworkDefinitionsStatus: to.Ptr("LogicalNetworkDefinitionsNotIsolated"), + // LogicalNetworkUsage: to.Ptr("NotUsedAsPrivateNetworkForTestFailover"), + // NetworkVirtualizationStatus: to.Ptr("NetworkVirtualizationNotEnabled"), + // }, + // } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationmigrationitems_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationmigrationitems_client.go index 40d8ef606a0c..abd237d47ba2 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationmigrationitems_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationmigrationitems_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,71 +24,60 @@ import ( // ReplicationMigrationItemsClient contains the methods for the ReplicationMigrationItems group. // Don't use this type directly, use NewReplicationMigrationItemsClient() instead. type ReplicationMigrationItemsClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationMigrationItemsClient creates a new instance of ReplicationMigrationItemsClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationMigrationItemsClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationMigrationItemsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationMigrationItemsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationMigrationItemsClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationMigrationItemsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationMigrationItemsClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // BeginCreate - The operation to create an ASR migration item (enable migration). // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// migrationItemName - Migration item name. -// input - Enable migration input. -// options - ReplicationMigrationItemsClientBeginCreateOptions contains the optional parameters for the ReplicationMigrationItemsClient.BeginCreate -// method. -func (client *ReplicationMigrationItemsClient) BeginCreate(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, input EnableMigrationInput, options *ReplicationMigrationItemsClientBeginCreateOptions) (*runtime.Poller[ReplicationMigrationItemsClientCreateResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - migrationItemName - Migration item name. +// - input - Enable migration input. +// - options - ReplicationMigrationItemsClientBeginCreateOptions contains the optional parameters for the ReplicationMigrationItemsClient.BeginCreate +// method. +func (client *ReplicationMigrationItemsClient) BeginCreate(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, input EnableMigrationInput, options *ReplicationMigrationItemsClientBeginCreateOptions) (*runtime.Poller[ReplicationMigrationItemsClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, fabricName, protectionContainerName, migrationItemName, input, options) + resp, err := client.create(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, migrationItemName, input, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationMigrationItemsClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationMigrationItemsClientCreateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationMigrationItemsClientCreateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationMigrationItemsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Create - The operation to create an ASR migration item (enable migration). // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationMigrationItemsClient) create(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, input EnableMigrationInput, options *ReplicationMigrationItemsClientBeginCreateOptions) (*http.Response, error) { - req, err := client.createCreateRequest(ctx, fabricName, protectionContainerName, migrationItemName, input, options) +func (client *ReplicationMigrationItemsClient) create(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, input EnableMigrationInput, options *ReplicationMigrationItemsClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, migrationItemName, input, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -101,16 +88,16 @@ func (client *ReplicationMigrationItemsClient) create(ctx context.Context, fabri } // createCreateRequest creates the Create request. -func (client *ReplicationMigrationItemsClient) createCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, input EnableMigrationInput, options *ReplicationMigrationItemsClientBeginCreateOptions) (*policy.Request, error) { +func (client *ReplicationMigrationItemsClient) createCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, input EnableMigrationInput, options *ReplicationMigrationItemsClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -127,7 +114,7 @@ func (client *ReplicationMigrationItemsClient) createCreateRequest(ctx context.C return nil, errors.New("parameter migrationItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{migrationItemName}", url.PathEscape(migrationItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -140,33 +127,37 @@ func (client *ReplicationMigrationItemsClient) createCreateRequest(ctx context.C // BeginDelete - The operation to delete an ASR migration item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// migrationItemName - Migration item name. -// options - ReplicationMigrationItemsClientBeginDeleteOptions contains the optional parameters for the ReplicationMigrationItemsClient.BeginDelete -// method. -func (client *ReplicationMigrationItemsClient) BeginDelete(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, options *ReplicationMigrationItemsClientBeginDeleteOptions) (*runtime.Poller[ReplicationMigrationItemsClientDeleteResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - migrationItemName - Migration item name. +// - options - ReplicationMigrationItemsClientBeginDeleteOptions contains the optional parameters for the ReplicationMigrationItemsClient.BeginDelete +// method. +func (client *ReplicationMigrationItemsClient) BeginDelete(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, options *ReplicationMigrationItemsClientBeginDeleteOptions) (*runtime.Poller[ReplicationMigrationItemsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, fabricName, protectionContainerName, migrationItemName, options) + resp, err := client.deleteOperation(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, migrationItemName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationMigrationItemsClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationMigrationItemsClientDeleteResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationMigrationItemsClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationMigrationItemsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - The operation to delete an ASR migration item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationMigrationItemsClient) deleteOperation(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, options *ReplicationMigrationItemsClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, fabricName, protectionContainerName, migrationItemName, options) +func (client *ReplicationMigrationItemsClient) deleteOperation(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, options *ReplicationMigrationItemsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, migrationItemName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -177,16 +168,16 @@ func (client *ReplicationMigrationItemsClient) deleteOperation(ctx context.Conte } // deleteCreateRequest creates the Delete request. -func (client *ReplicationMigrationItemsClient) deleteCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, options *ReplicationMigrationItemsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ReplicationMigrationItemsClient) deleteCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, options *ReplicationMigrationItemsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -203,7 +194,7 @@ func (client *ReplicationMigrationItemsClient) deleteCreateRequest(ctx context.C return nil, errors.New("parameter migrationItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{migrationItemName}", url.PathEscape(migrationItemName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -218,18 +209,21 @@ func (client *ReplicationMigrationItemsClient) deleteCreateRequest(ctx context.C // Get - Gets the details of a migration item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric unique name. -// protectionContainerName - Protection container name. -// migrationItemName - Migration item name. -// options - ReplicationMigrationItemsClientGetOptions contains the optional parameters for the ReplicationMigrationItemsClient.Get -// method. -func (client *ReplicationMigrationItemsClient) Get(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, options *ReplicationMigrationItemsClientGetOptions) (ReplicationMigrationItemsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, fabricName, protectionContainerName, migrationItemName, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric unique name. +// - protectionContainerName - Protection container name. +// - migrationItemName - Migration item name. +// - options - ReplicationMigrationItemsClientGetOptions contains the optional parameters for the ReplicationMigrationItemsClient.Get +// method. +func (client *ReplicationMigrationItemsClient) Get(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, options *ReplicationMigrationItemsClientGetOptions) (ReplicationMigrationItemsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, migrationItemName, options) if err != nil { return ReplicationMigrationItemsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationMigrationItemsClientGetResponse{}, err } @@ -240,16 +234,16 @@ func (client *ReplicationMigrationItemsClient) Get(ctx context.Context, fabricNa } // getCreateRequest creates the Get request. -func (client *ReplicationMigrationItemsClient) getCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, options *ReplicationMigrationItemsClientGetOptions) (*policy.Request, error) { +func (client *ReplicationMigrationItemsClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, options *ReplicationMigrationItemsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -266,7 +260,7 @@ func (client *ReplicationMigrationItemsClient) getCreateRequest(ctx context.Cont return nil, errors.New("parameter migrationItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{migrationItemName}", url.PathEscape(migrationItemName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -287,10 +281,13 @@ func (client *ReplicationMigrationItemsClient) getHandleResponse(resp *http.Resp } // NewListPager - Gets the list of migration items in the vault. +// // Generated from API version 2022-10-01 -// options - ReplicationMigrationItemsClientListOptions contains the optional parameters for the ReplicationMigrationItemsClient.List -// method. -func (client *ReplicationMigrationItemsClient) NewListPager(options *ReplicationMigrationItemsClientListOptions) *runtime.Pager[ReplicationMigrationItemsClientListResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - ReplicationMigrationItemsClientListOptions contains the optional parameters for the ReplicationMigrationItemsClient.NewListPager +// method. +func (client *ReplicationMigrationItemsClient) NewListPager(resourceName string, resourceGroupName string, options *ReplicationMigrationItemsClientListOptions) *runtime.Pager[ReplicationMigrationItemsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationMigrationItemsClientListResponse]{ More: func(page ReplicationMigrationItemsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -299,14 +296,14 @@ func (client *ReplicationMigrationItemsClient) NewListPager(options *Replication var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, resourceName, resourceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationMigrationItemsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationMigrationItemsClientListResponse{}, err } @@ -319,21 +316,21 @@ func (client *ReplicationMigrationItemsClient) NewListPager(options *Replication } // listCreateRequest creates the List request. -func (client *ReplicationMigrationItemsClient) listCreateRequest(ctx context.Context, options *ReplicationMigrationItemsClientListOptions) (*policy.Request, error) { +func (client *ReplicationMigrationItemsClient) listCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationMigrationItemsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationMigrationItems" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -363,12 +360,15 @@ func (client *ReplicationMigrationItemsClient) listHandleResponse(resp *http.Res } // NewListByReplicationProtectionContainersPager - Gets the list of ASR migration items in the protection container. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// options - ReplicationMigrationItemsClientListByReplicationProtectionContainersOptions contains the optional parameters -// for the ReplicationMigrationItemsClient.ListByReplicationProtectionContainers method. -func (client *ReplicationMigrationItemsClient) NewListByReplicationProtectionContainersPager(fabricName string, protectionContainerName string, options *ReplicationMigrationItemsClientListByReplicationProtectionContainersOptions) *runtime.Pager[ReplicationMigrationItemsClientListByReplicationProtectionContainersResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - options - ReplicationMigrationItemsClientListByReplicationProtectionContainersOptions contains the optional parameters +// for the ReplicationMigrationItemsClient.NewListByReplicationProtectionContainersPager method. +func (client *ReplicationMigrationItemsClient) NewListByReplicationProtectionContainersPager(resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, options *ReplicationMigrationItemsClientListByReplicationProtectionContainersOptions) *runtime.Pager[ReplicationMigrationItemsClientListByReplicationProtectionContainersResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationMigrationItemsClientListByReplicationProtectionContainersResponse]{ More: func(page ReplicationMigrationItemsClientListByReplicationProtectionContainersResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -377,14 +377,14 @@ func (client *ReplicationMigrationItemsClient) NewListByReplicationProtectionCon var req *policy.Request var err error if page == nil { - req, err = client.listByReplicationProtectionContainersCreateRequest(ctx, fabricName, protectionContainerName, options) + req, err = client.listByReplicationProtectionContainersCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationMigrationItemsClientListByReplicationProtectionContainersResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationMigrationItemsClientListByReplicationProtectionContainersResponse{}, err } @@ -397,16 +397,16 @@ func (client *ReplicationMigrationItemsClient) NewListByReplicationProtectionCon } // listByReplicationProtectionContainersCreateRequest creates the ListByReplicationProtectionContainers request. -func (client *ReplicationMigrationItemsClient) listByReplicationProtectionContainersCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, options *ReplicationMigrationItemsClientListByReplicationProtectionContainersOptions) (*policy.Request, error) { +func (client *ReplicationMigrationItemsClient) listByReplicationProtectionContainersCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, options *ReplicationMigrationItemsClientListByReplicationProtectionContainersOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -419,7 +419,7 @@ func (client *ReplicationMigrationItemsClient) listByReplicationProtectionContai return nil, errors.New("parameter protectionContainerName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{protectionContainerName}", url.PathEscape(protectionContainerName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -450,34 +450,38 @@ func (client *ReplicationMigrationItemsClient) listByReplicationProtectionContai // BeginMigrate - The operation to initiate migration of the item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// migrationItemName - Migration item name. -// migrateInput - Migrate input. -// options - ReplicationMigrationItemsClientBeginMigrateOptions contains the optional parameters for the ReplicationMigrationItemsClient.BeginMigrate -// method. -func (client *ReplicationMigrationItemsClient) BeginMigrate(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, migrateInput MigrateInput, options *ReplicationMigrationItemsClientBeginMigrateOptions) (*runtime.Poller[ReplicationMigrationItemsClientMigrateResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - migrationItemName - Migration item name. +// - migrateInput - Migrate input. +// - options - ReplicationMigrationItemsClientBeginMigrateOptions contains the optional parameters for the ReplicationMigrationItemsClient.BeginMigrate +// method. +func (client *ReplicationMigrationItemsClient) BeginMigrate(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, migrateInput MigrateInput, options *ReplicationMigrationItemsClientBeginMigrateOptions) (*runtime.Poller[ReplicationMigrationItemsClientMigrateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.migrate(ctx, fabricName, protectionContainerName, migrationItemName, migrateInput, options) + resp, err := client.migrate(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, migrationItemName, migrateInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationMigrationItemsClientMigrateResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationMigrationItemsClientMigrateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationMigrationItemsClientMigrateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationMigrationItemsClientMigrateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Migrate - The operation to initiate migration of the item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationMigrationItemsClient) migrate(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, migrateInput MigrateInput, options *ReplicationMigrationItemsClientBeginMigrateOptions) (*http.Response, error) { - req, err := client.migrateCreateRequest(ctx, fabricName, protectionContainerName, migrationItemName, migrateInput, options) +func (client *ReplicationMigrationItemsClient) migrate(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, migrateInput MigrateInput, options *ReplicationMigrationItemsClientBeginMigrateOptions) (*http.Response, error) { + req, err := client.migrateCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, migrationItemName, migrateInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -488,16 +492,16 @@ func (client *ReplicationMigrationItemsClient) migrate(ctx context.Context, fabr } // migrateCreateRequest creates the Migrate request. -func (client *ReplicationMigrationItemsClient) migrateCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, migrateInput MigrateInput, options *ReplicationMigrationItemsClientBeginMigrateOptions) (*policy.Request, error) { +func (client *ReplicationMigrationItemsClient) migrateCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, migrateInput MigrateInput, options *ReplicationMigrationItemsClientBeginMigrateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrate" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -514,7 +518,7 @@ func (client *ReplicationMigrationItemsClient) migrateCreateRequest(ctx context. return nil, errors.New("parameter migrationItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{migrationItemName}", url.PathEscape(migrationItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -527,34 +531,38 @@ func (client *ReplicationMigrationItemsClient) migrateCreateRequest(ctx context. // BeginPauseReplication - The operation to initiate pause replication of the item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// migrationItemName - Migration item name. -// pauseReplicationInput - Pause replication input. -// options - ReplicationMigrationItemsClientBeginPauseReplicationOptions contains the optional parameters for the ReplicationMigrationItemsClient.BeginPauseReplication -// method. -func (client *ReplicationMigrationItemsClient) BeginPauseReplication(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, pauseReplicationInput PauseReplicationInput, options *ReplicationMigrationItemsClientBeginPauseReplicationOptions) (*runtime.Poller[ReplicationMigrationItemsClientPauseReplicationResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - migrationItemName - Migration item name. +// - pauseReplicationInput - Pause replication input. +// - options - ReplicationMigrationItemsClientBeginPauseReplicationOptions contains the optional parameters for the ReplicationMigrationItemsClient.BeginPauseReplication +// method. +func (client *ReplicationMigrationItemsClient) BeginPauseReplication(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, pauseReplicationInput PauseReplicationInput, options *ReplicationMigrationItemsClientBeginPauseReplicationOptions) (*runtime.Poller[ReplicationMigrationItemsClientPauseReplicationResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.pauseReplication(ctx, fabricName, protectionContainerName, migrationItemName, pauseReplicationInput, options) + resp, err := client.pauseReplication(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, migrationItemName, pauseReplicationInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationMigrationItemsClientPauseReplicationResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationMigrationItemsClientPauseReplicationResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationMigrationItemsClientPauseReplicationResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationMigrationItemsClientPauseReplicationResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // PauseReplication - The operation to initiate pause replication of the item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationMigrationItemsClient) pauseReplication(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, pauseReplicationInput PauseReplicationInput, options *ReplicationMigrationItemsClientBeginPauseReplicationOptions) (*http.Response, error) { - req, err := client.pauseReplicationCreateRequest(ctx, fabricName, protectionContainerName, migrationItemName, pauseReplicationInput, options) +func (client *ReplicationMigrationItemsClient) pauseReplication(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, pauseReplicationInput PauseReplicationInput, options *ReplicationMigrationItemsClientBeginPauseReplicationOptions) (*http.Response, error) { + req, err := client.pauseReplicationCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, migrationItemName, pauseReplicationInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -565,16 +573,16 @@ func (client *ReplicationMigrationItemsClient) pauseReplication(ctx context.Cont } // pauseReplicationCreateRequest creates the PauseReplication request. -func (client *ReplicationMigrationItemsClient) pauseReplicationCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, pauseReplicationInput PauseReplicationInput, options *ReplicationMigrationItemsClientBeginPauseReplicationOptions) (*policy.Request, error) { +func (client *ReplicationMigrationItemsClient) pauseReplicationCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, pauseReplicationInput PauseReplicationInput, options *ReplicationMigrationItemsClientBeginPauseReplicationOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/pauseReplication" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -591,7 +599,7 @@ func (client *ReplicationMigrationItemsClient) pauseReplicationCreateRequest(ctx return nil, errors.New("parameter migrationItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{migrationItemName}", url.PathEscape(migrationItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -604,34 +612,38 @@ func (client *ReplicationMigrationItemsClient) pauseReplicationCreateRequest(ctx // BeginResumeReplication - The operation to initiate resume replication of the item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// migrationItemName - Migration item name. -// resumeReplicationInput - Resume replication input. -// options - ReplicationMigrationItemsClientBeginResumeReplicationOptions contains the optional parameters for the ReplicationMigrationItemsClient.BeginResumeReplication -// method. -func (client *ReplicationMigrationItemsClient) BeginResumeReplication(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, resumeReplicationInput ResumeReplicationInput, options *ReplicationMigrationItemsClientBeginResumeReplicationOptions) (*runtime.Poller[ReplicationMigrationItemsClientResumeReplicationResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - migrationItemName - Migration item name. +// - resumeReplicationInput - Resume replication input. +// - options - ReplicationMigrationItemsClientBeginResumeReplicationOptions contains the optional parameters for the ReplicationMigrationItemsClient.BeginResumeReplication +// method. +func (client *ReplicationMigrationItemsClient) BeginResumeReplication(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, resumeReplicationInput ResumeReplicationInput, options *ReplicationMigrationItemsClientBeginResumeReplicationOptions) (*runtime.Poller[ReplicationMigrationItemsClientResumeReplicationResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.resumeReplication(ctx, fabricName, protectionContainerName, migrationItemName, resumeReplicationInput, options) + resp, err := client.resumeReplication(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, migrationItemName, resumeReplicationInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationMigrationItemsClientResumeReplicationResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationMigrationItemsClientResumeReplicationResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationMigrationItemsClientResumeReplicationResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationMigrationItemsClientResumeReplicationResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // ResumeReplication - The operation to initiate resume replication of the item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationMigrationItemsClient) resumeReplication(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, resumeReplicationInput ResumeReplicationInput, options *ReplicationMigrationItemsClientBeginResumeReplicationOptions) (*http.Response, error) { - req, err := client.resumeReplicationCreateRequest(ctx, fabricName, protectionContainerName, migrationItemName, resumeReplicationInput, options) +func (client *ReplicationMigrationItemsClient) resumeReplication(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, resumeReplicationInput ResumeReplicationInput, options *ReplicationMigrationItemsClientBeginResumeReplicationOptions) (*http.Response, error) { + req, err := client.resumeReplicationCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, migrationItemName, resumeReplicationInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -642,16 +654,16 @@ func (client *ReplicationMigrationItemsClient) resumeReplication(ctx context.Con } // resumeReplicationCreateRequest creates the ResumeReplication request. -func (client *ReplicationMigrationItemsClient) resumeReplicationCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, resumeReplicationInput ResumeReplicationInput, options *ReplicationMigrationItemsClientBeginResumeReplicationOptions) (*policy.Request, error) { +func (client *ReplicationMigrationItemsClient) resumeReplicationCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, resumeReplicationInput ResumeReplicationInput, options *ReplicationMigrationItemsClientBeginResumeReplicationOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resumeReplication" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -668,7 +680,7 @@ func (client *ReplicationMigrationItemsClient) resumeReplicationCreateRequest(ct return nil, errors.New("parameter migrationItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{migrationItemName}", url.PathEscape(migrationItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -681,34 +693,38 @@ func (client *ReplicationMigrationItemsClient) resumeReplicationCreateRequest(ct // BeginResync - The operation to resynchronize replication of an ASR migration item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// migrationItemName - Migration item name. -// input - Resync input. -// options - ReplicationMigrationItemsClientBeginResyncOptions contains the optional parameters for the ReplicationMigrationItemsClient.BeginResync -// method. -func (client *ReplicationMigrationItemsClient) BeginResync(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, input ResyncInput, options *ReplicationMigrationItemsClientBeginResyncOptions) (*runtime.Poller[ReplicationMigrationItemsClientResyncResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - migrationItemName - Migration item name. +// - input - Resync input. +// - options - ReplicationMigrationItemsClientBeginResyncOptions contains the optional parameters for the ReplicationMigrationItemsClient.BeginResync +// method. +func (client *ReplicationMigrationItemsClient) BeginResync(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, input ResyncInput, options *ReplicationMigrationItemsClientBeginResyncOptions) (*runtime.Poller[ReplicationMigrationItemsClientResyncResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.resync(ctx, fabricName, protectionContainerName, migrationItemName, input, options) + resp, err := client.resync(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, migrationItemName, input, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationMigrationItemsClientResyncResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationMigrationItemsClientResyncResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationMigrationItemsClientResyncResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationMigrationItemsClientResyncResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Resync - The operation to resynchronize replication of an ASR migration item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationMigrationItemsClient) resync(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, input ResyncInput, options *ReplicationMigrationItemsClientBeginResyncOptions) (*http.Response, error) { - req, err := client.resyncCreateRequest(ctx, fabricName, protectionContainerName, migrationItemName, input, options) +func (client *ReplicationMigrationItemsClient) resync(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, input ResyncInput, options *ReplicationMigrationItemsClientBeginResyncOptions) (*http.Response, error) { + req, err := client.resyncCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, migrationItemName, input, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -719,16 +735,16 @@ func (client *ReplicationMigrationItemsClient) resync(ctx context.Context, fabri } // resyncCreateRequest creates the Resync request. -func (client *ReplicationMigrationItemsClient) resyncCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, input ResyncInput, options *ReplicationMigrationItemsClientBeginResyncOptions) (*policy.Request, error) { +func (client *ReplicationMigrationItemsClient) resyncCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, input ResyncInput, options *ReplicationMigrationItemsClientBeginResyncOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resync" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -745,7 +761,7 @@ func (client *ReplicationMigrationItemsClient) resyncCreateRequest(ctx context.C return nil, errors.New("parameter migrationItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{migrationItemName}", url.PathEscape(migrationItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -758,34 +774,38 @@ func (client *ReplicationMigrationItemsClient) resyncCreateRequest(ctx context.C // BeginTestMigrate - The operation to initiate test migration of the item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// migrationItemName - Migration item name. -// testMigrateInput - Test migrate input. -// options - ReplicationMigrationItemsClientBeginTestMigrateOptions contains the optional parameters for the ReplicationMigrationItemsClient.BeginTestMigrate -// method. -func (client *ReplicationMigrationItemsClient) BeginTestMigrate(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, testMigrateInput TestMigrateInput, options *ReplicationMigrationItemsClientBeginTestMigrateOptions) (*runtime.Poller[ReplicationMigrationItemsClientTestMigrateResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - migrationItemName - Migration item name. +// - testMigrateInput - Test migrate input. +// - options - ReplicationMigrationItemsClientBeginTestMigrateOptions contains the optional parameters for the ReplicationMigrationItemsClient.BeginTestMigrate +// method. +func (client *ReplicationMigrationItemsClient) BeginTestMigrate(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, testMigrateInput TestMigrateInput, options *ReplicationMigrationItemsClientBeginTestMigrateOptions) (*runtime.Poller[ReplicationMigrationItemsClientTestMigrateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.testMigrate(ctx, fabricName, protectionContainerName, migrationItemName, testMigrateInput, options) + resp, err := client.testMigrate(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, migrationItemName, testMigrateInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationMigrationItemsClientTestMigrateResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationMigrationItemsClientTestMigrateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationMigrationItemsClientTestMigrateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationMigrationItemsClientTestMigrateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // TestMigrate - The operation to initiate test migration of the item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationMigrationItemsClient) testMigrate(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, testMigrateInput TestMigrateInput, options *ReplicationMigrationItemsClientBeginTestMigrateOptions) (*http.Response, error) { - req, err := client.testMigrateCreateRequest(ctx, fabricName, protectionContainerName, migrationItemName, testMigrateInput, options) +func (client *ReplicationMigrationItemsClient) testMigrate(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, testMigrateInput TestMigrateInput, options *ReplicationMigrationItemsClientBeginTestMigrateOptions) (*http.Response, error) { + req, err := client.testMigrateCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, migrationItemName, testMigrateInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -796,16 +816,16 @@ func (client *ReplicationMigrationItemsClient) testMigrate(ctx context.Context, } // testMigrateCreateRequest creates the TestMigrate request. -func (client *ReplicationMigrationItemsClient) testMigrateCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, testMigrateInput TestMigrateInput, options *ReplicationMigrationItemsClientBeginTestMigrateOptions) (*policy.Request, error) { +func (client *ReplicationMigrationItemsClient) testMigrateCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, testMigrateInput TestMigrateInput, options *ReplicationMigrationItemsClientBeginTestMigrateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrate" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -822,7 +842,7 @@ func (client *ReplicationMigrationItemsClient) testMigrateCreateRequest(ctx cont return nil, errors.New("parameter migrationItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{migrationItemName}", url.PathEscape(migrationItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -835,34 +855,38 @@ func (client *ReplicationMigrationItemsClient) testMigrateCreateRequest(ctx cont // BeginTestMigrateCleanup - The operation to initiate test migrate cleanup. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// migrationItemName - Migration item name. -// testMigrateCleanupInput - Test migrate cleanup input. -// options - ReplicationMigrationItemsClientBeginTestMigrateCleanupOptions contains the optional parameters for the ReplicationMigrationItemsClient.BeginTestMigrateCleanup -// method. -func (client *ReplicationMigrationItemsClient) BeginTestMigrateCleanup(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, testMigrateCleanupInput TestMigrateCleanupInput, options *ReplicationMigrationItemsClientBeginTestMigrateCleanupOptions) (*runtime.Poller[ReplicationMigrationItemsClientTestMigrateCleanupResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - migrationItemName - Migration item name. +// - testMigrateCleanupInput - Test migrate cleanup input. +// - options - ReplicationMigrationItemsClientBeginTestMigrateCleanupOptions contains the optional parameters for the ReplicationMigrationItemsClient.BeginTestMigrateCleanup +// method. +func (client *ReplicationMigrationItemsClient) BeginTestMigrateCleanup(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, testMigrateCleanupInput TestMigrateCleanupInput, options *ReplicationMigrationItemsClientBeginTestMigrateCleanupOptions) (*runtime.Poller[ReplicationMigrationItemsClientTestMigrateCleanupResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.testMigrateCleanup(ctx, fabricName, protectionContainerName, migrationItemName, testMigrateCleanupInput, options) + resp, err := client.testMigrateCleanup(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, migrationItemName, testMigrateCleanupInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationMigrationItemsClientTestMigrateCleanupResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationMigrationItemsClientTestMigrateCleanupResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationMigrationItemsClientTestMigrateCleanupResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationMigrationItemsClientTestMigrateCleanupResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // TestMigrateCleanup - The operation to initiate test migrate cleanup. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationMigrationItemsClient) testMigrateCleanup(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, testMigrateCleanupInput TestMigrateCleanupInput, options *ReplicationMigrationItemsClientBeginTestMigrateCleanupOptions) (*http.Response, error) { - req, err := client.testMigrateCleanupCreateRequest(ctx, fabricName, protectionContainerName, migrationItemName, testMigrateCleanupInput, options) +func (client *ReplicationMigrationItemsClient) testMigrateCleanup(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, testMigrateCleanupInput TestMigrateCleanupInput, options *ReplicationMigrationItemsClientBeginTestMigrateCleanupOptions) (*http.Response, error) { + req, err := client.testMigrateCleanupCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, migrationItemName, testMigrateCleanupInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -873,16 +897,16 @@ func (client *ReplicationMigrationItemsClient) testMigrateCleanup(ctx context.Co } // testMigrateCleanupCreateRequest creates the TestMigrateCleanup request. -func (client *ReplicationMigrationItemsClient) testMigrateCleanupCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, testMigrateCleanupInput TestMigrateCleanupInput, options *ReplicationMigrationItemsClientBeginTestMigrateCleanupOptions) (*policy.Request, error) { +func (client *ReplicationMigrationItemsClient) testMigrateCleanupCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, testMigrateCleanupInput TestMigrateCleanupInput, options *ReplicationMigrationItemsClientBeginTestMigrateCleanupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrateCleanup" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -899,7 +923,7 @@ func (client *ReplicationMigrationItemsClient) testMigrateCleanupCreateRequest(c return nil, errors.New("parameter migrationItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{migrationItemName}", url.PathEscape(migrationItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -912,34 +936,38 @@ func (client *ReplicationMigrationItemsClient) testMigrateCleanupCreateRequest(c // BeginUpdate - The operation to update the recovery settings of an ASR migration item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// migrationItemName - Migration item name. -// input - Update migration item input. -// options - ReplicationMigrationItemsClientBeginUpdateOptions contains the optional parameters for the ReplicationMigrationItemsClient.BeginUpdate -// method. -func (client *ReplicationMigrationItemsClient) BeginUpdate(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, input UpdateMigrationItemInput, options *ReplicationMigrationItemsClientBeginUpdateOptions) (*runtime.Poller[ReplicationMigrationItemsClientUpdateResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - migrationItemName - Migration item name. +// - input - Update migration item input. +// - options - ReplicationMigrationItemsClientBeginUpdateOptions contains the optional parameters for the ReplicationMigrationItemsClient.BeginUpdate +// method. +func (client *ReplicationMigrationItemsClient) BeginUpdate(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, input UpdateMigrationItemInput, options *ReplicationMigrationItemsClientBeginUpdateOptions) (*runtime.Poller[ReplicationMigrationItemsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, fabricName, protectionContainerName, migrationItemName, input, options) + resp, err := client.update(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, migrationItemName, input, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationMigrationItemsClientUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationMigrationItemsClientUpdateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationMigrationItemsClientUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationMigrationItemsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Update - The operation to update the recovery settings of an ASR migration item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationMigrationItemsClient) update(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, input UpdateMigrationItemInput, options *ReplicationMigrationItemsClientBeginUpdateOptions) (*http.Response, error) { - req, err := client.updateCreateRequest(ctx, fabricName, protectionContainerName, migrationItemName, input, options) +func (client *ReplicationMigrationItemsClient) update(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, input UpdateMigrationItemInput, options *ReplicationMigrationItemsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, migrationItemName, input, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -950,16 +978,16 @@ func (client *ReplicationMigrationItemsClient) update(ctx context.Context, fabri } // updateCreateRequest creates the Update request. -func (client *ReplicationMigrationItemsClient) updateCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, migrationItemName string, input UpdateMigrationItemInput, options *ReplicationMigrationItemsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *ReplicationMigrationItemsClient) updateCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, migrationItemName string, input UpdateMigrationItemInput, options *ReplicationMigrationItemsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -976,7 +1004,7 @@ func (client *ReplicationMigrationItemsClient) updateCreateRequest(ctx context.C return nil, errors.New("parameter migrationItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{migrationItemName}", url.PathEscape(migrationItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationmigrationitems_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationmigrationitems_client_example_test.go index e4e4bbdd774f..7fa1f113639b 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationmigrationitems_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationmigrationitems_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -14,67 +15,126 @@ import ( "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/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_ListByReplicationProtectionContainers.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_ListByReplicationProtectionContainers.json func ExampleReplicationMigrationItemsClient_NewListByReplicationProtectionContainersPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationMigrationItemsClient("migrationvault", "resourcegroup1", "cb53d0c3-bd59-4721-89bc-06916a9147ef", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByReplicationProtectionContainersPager("vmwarefabric1", "vmwareContainer1", &armrecoveryservicessiterecovery.ReplicationMigrationItemsClientListByReplicationProtectionContainersOptions{SkipToken: nil, + pager := clientFactory.NewReplicationMigrationItemsClient().NewListByReplicationProtectionContainersPager("migrationvault", "resourcegroup1", "vmwarefabric1", "vmwareContainer1", &armrecoveryservicessiterecovery.ReplicationMigrationItemsClientListByReplicationProtectionContainersOptions{SkipToken: nil, TakeToken: nil, Filter: nil, }) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.MigrationItemCollection = armrecoveryservicessiterecovery.MigrationItemCollection{ + // Value: []*armrecoveryservicessiterecovery.MigrationItem{ + // { + // Name: to.Ptr("virtualmachine1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationMigrationItems"), + // ID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationFabrics/vmwarefabric1/replicationProtectionContainers/vmwareContainer1/replicationMigrationItems/virtualmachine1"), + // Properties: &armrecoveryservicessiterecovery.MigrationItemProperties{ + // AllowedOperations: []*armrecoveryservicessiterecovery.MigrationItemOperation{ + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationMigrate), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationDisableMigration), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationTestMigrate), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationTestMigrateCleanup)}, + // CurrentJob: &armrecoveryservicessiterecovery.CurrentJobDetails{ + // JobID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationJobs/None"), + // JobName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T06:37:50.8082715Z"); return t}()), + // }, + // MachineName: to.Ptr("vm-0520-2"), + // MigrationState: to.Ptr(armrecoveryservicessiterecovery.MigrationStateReplicating), + // MigrationStateDescription: to.Ptr("Ready to migrate"), + // PolicyFriendlyName: to.Ptr("vmwarepolicy1"), + // PolicyID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationPolicies/vmwarepolicy1"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.VMwareCbtMigrationDetails{ + // InstanceType: to.Ptr("VMwareCbt"), + // }, + // TestMigrateState: to.Ptr(armrecoveryservicessiterecovery.TestMigrationStateNone), + // TestMigrateStateDescription: to.Ptr("None"), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Get.json func ExampleReplicationMigrationItemsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationMigrationItemsClient("migrationvault", "resourcegroup1", "cb53d0c3-bd59-4721-89bc-06916a9147ef", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "vmwarefabric1", "vmwareContainer1", "virtualmachine1", nil) + res, err := clientFactory.NewReplicationMigrationItemsClient().Get(ctx, "migrationvault", "resourcegroup1", "vmwarefabric1", "vmwareContainer1", "virtualmachine1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.MigrationItem = armrecoveryservicessiterecovery.MigrationItem{ + // Name: to.Ptr("virtualmachine1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationMigrationItems"), + // ID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationFabrics/vmwarefabric1/replicationProtectionContainers/vmwareContainer1/replicationMigrationItems/virtualmachine1"), + // Properties: &armrecoveryservicessiterecovery.MigrationItemProperties{ + // AllowedOperations: []*armrecoveryservicessiterecovery.MigrationItemOperation{ + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationMigrate), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationDisableMigration), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationTestMigrate), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationTestMigrateCleanup)}, + // CurrentJob: &armrecoveryservicessiterecovery.CurrentJobDetails{ + // JobID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationJobs/None"), + // JobName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T06:37:50.8082715Z"); return t}()), + // }, + // MachineName: to.Ptr("vm-0520-2"), + // MigrationState: to.Ptr(armrecoveryservicessiterecovery.MigrationStateReplicating), + // MigrationStateDescription: to.Ptr("Ready to migrate"), + // PolicyFriendlyName: to.Ptr("vmwarepolicy1"), + // PolicyID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationPolicies/vmwarepolicy1"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.VMwareCbtMigrationDetails{ + // InstanceType: to.Ptr("VMwareCbt"), + // }, + // TestMigrateState: to.Ptr(armrecoveryservicessiterecovery.TestMigrationStateNone), + // TestMigrateStateDescription: to.Ptr("None"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Create.json func ExampleReplicationMigrationItemsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationMigrationItemsClient("migrationvault", "resourcegroup1", "cb53d0c3-bd59-4721-89bc-06916a9147ef", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreate(ctx, "vmwarefabric1", "vmwareContainer1", "virtualmachine1", armrecoveryservicessiterecovery.EnableMigrationInput{ + poller, err := clientFactory.NewReplicationMigrationItemsClient().BeginCreate(ctx, "migrationvault", "resourcegroup1", "vmwarefabric1", "vmwareContainer1", "virtualmachine1", armrecoveryservicessiterecovery.EnableMigrationInput{ Properties: &armrecoveryservicessiterecovery.EnableMigrationInputProperties{ PolicyID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationPolicies/vmwarepolicy1"), ProviderSpecificDetails: &armrecoveryservicessiterecovery.VMwareCbtEnableMigrationInput{ @@ -101,22 +161,50 @@ func ExampleReplicationMigrationItemsClient_BeginCreate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.MigrationItem = armrecoveryservicessiterecovery.MigrationItem{ + // Name: to.Ptr("virtualmachine1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationMigrationItems"), + // ID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationFabrics/vmwarefabric1/replicationProtectionContainers/vmwareContainer1/replicationMigrationItems/virtualmachine1"), + // Properties: &armrecoveryservicessiterecovery.MigrationItemProperties{ + // AllowedOperations: []*armrecoveryservicessiterecovery.MigrationItemOperation{ + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationMigrate), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationDisableMigration), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationTestMigrate), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationTestMigrateCleanup)}, + // CurrentJob: &armrecoveryservicessiterecovery.CurrentJobDetails{ + // JobID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationJobs/None"), + // JobName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T06:37:50.8082715Z"); return t}()), + // }, + // MachineName: to.Ptr("vm-0520-2"), + // MigrationState: to.Ptr(armrecoveryservicessiterecovery.MigrationStateReplicating), + // MigrationStateDescription: to.Ptr("Ready to migrate"), + // PolicyFriendlyName: to.Ptr("vmwarepolicy1"), + // PolicyID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationPolicies/vmwarepolicy1"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.VMwareCbtMigrationDetails{ + // InstanceType: to.Ptr("VMwareCbt"), + // }, + // TestMigrateState: to.Ptr(armrecoveryservicessiterecovery.TestMigrationStateNone), + // TestMigrateStateDescription: to.Ptr("None"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Delete.json func ExampleReplicationMigrationItemsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationMigrationItemsClient("migrationvault", "resourcegroup1", "cb53d0c3-bd59-4721-89bc-06916a9147ef", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, "vmwarefabric1", "vmwareContainer1", "virtualmachine1", &armrecoveryservicessiterecovery.ReplicationMigrationItemsClientBeginDeleteOptions{DeleteOption: nil}) + poller, err := clientFactory.NewReplicationMigrationItemsClient().BeginDelete(ctx, "migrationvault", "resourcegroup1", "vmwarefabric1", "vmwareContainer1", "virtualmachine1", &armrecoveryservicessiterecovery.ReplicationMigrationItemsClientBeginDeleteOptions{DeleteOption: nil}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -126,18 +214,18 @@ func ExampleReplicationMigrationItemsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Update.json func ExampleReplicationMigrationItemsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationMigrationItemsClient("migrationvault", "resourcegroup1", "cb53d0c3-bd59-4721-89bc-06916a9147ef", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, "vmwarefabric1", "vmwareContainer1", "virtualmachine1", armrecoveryservicessiterecovery.UpdateMigrationItemInput{ + poller, err := clientFactory.NewReplicationMigrationItemsClient().BeginUpdate(ctx, "migrationvault", "resourcegroup1", "vmwarefabric1", "vmwareContainer1", "virtualmachine1", armrecoveryservicessiterecovery.UpdateMigrationItemInput{ Properties: &armrecoveryservicessiterecovery.UpdateMigrationItemInputProperties{ ProviderSpecificDetails: &armrecoveryservicessiterecovery.VMwareCbtUpdateMigrationItemInput{ InstanceType: to.Ptr("VMwareCbt"), @@ -151,22 +239,50 @@ func ExampleReplicationMigrationItemsClient_BeginUpdate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.MigrationItem = armrecoveryservicessiterecovery.MigrationItem{ + // Name: to.Ptr("virtualmachine1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationMigrationItems"), + // ID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationFabrics/vmwarefabric1/replicationProtectionContainers/vmwareContainer1/replicationMigrationItems/virtualmachine1"), + // Properties: &armrecoveryservicessiterecovery.MigrationItemProperties{ + // AllowedOperations: []*armrecoveryservicessiterecovery.MigrationItemOperation{ + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationMigrate), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationDisableMigration), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationTestMigrate), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationTestMigrateCleanup)}, + // CurrentJob: &armrecoveryservicessiterecovery.CurrentJobDetails{ + // JobID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationJobs/None"), + // JobName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T06:37:50.8082715Z"); return t}()), + // }, + // MachineName: to.Ptr("vm-0520-2"), + // MigrationState: to.Ptr(armrecoveryservicessiterecovery.MigrationStateReplicating), + // MigrationStateDescription: to.Ptr("Ready to migrate"), + // PolicyFriendlyName: to.Ptr("vmwarepolicy1"), + // PolicyID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationPolicies/vmwarepolicy1"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.VMwareCbtMigrationDetails{ + // InstanceType: to.Ptr("VMwareCbt"), + // }, + // TestMigrateState: to.Ptr(armrecoveryservicessiterecovery.TestMigrationStateNone), + // TestMigrateStateDescription: to.Ptr("None"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Migrate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Migrate.json func ExampleReplicationMigrationItemsClient_BeginMigrate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationMigrationItemsClient("migrationvault", "resourcegroup1", "cb53d0c3-bd59-4721-89bc-06916a9147ef", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginMigrate(ctx, "vmwarefabric1", "vmwareContainer1", "virtualmachine1", armrecoveryservicessiterecovery.MigrateInput{ + poller, err := clientFactory.NewReplicationMigrationItemsClient().BeginMigrate(ctx, "migrationvault", "resourcegroup1", "vmwarefabric1", "vmwareContainer1", "virtualmachine1", armrecoveryservicessiterecovery.MigrateInput{ Properties: &armrecoveryservicessiterecovery.MigrateInputProperties{ ProviderSpecificDetails: &armrecoveryservicessiterecovery.VMwareCbtMigrateInput{ InstanceType: to.Ptr("VMwareCbt"), @@ -181,22 +297,50 @@ func ExampleReplicationMigrationItemsClient_BeginMigrate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.MigrationItem = armrecoveryservicessiterecovery.MigrationItem{ + // Name: to.Ptr("virtualmachine1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationMigrationItems"), + // ID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationFabrics/vmwarefabric1/replicationProtectionContainers/vmwareContainer1/replicationMigrationItems/virtualmachine1"), + // Properties: &armrecoveryservicessiterecovery.MigrationItemProperties{ + // AllowedOperations: []*armrecoveryservicessiterecovery.MigrationItemOperation{ + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationMigrate), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationDisableMigration), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationTestMigrate), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationTestMigrateCleanup)}, + // CurrentJob: &armrecoveryservicessiterecovery.CurrentJobDetails{ + // JobID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationJobs/None"), + // JobName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T06:37:50.8082715Z"); return t}()), + // }, + // MachineName: to.Ptr("vm-0520-2"), + // MigrationState: to.Ptr(armrecoveryservicessiterecovery.MigrationStateReplicating), + // MigrationStateDescription: to.Ptr("Ready to migrate"), + // PolicyFriendlyName: to.Ptr("vmwarepolicy1"), + // PolicyID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationPolicies/vmwarepolicy1"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.VMwareCbtMigrationDetails{ + // InstanceType: to.Ptr("VMwareCbt"), + // }, + // TestMigrateState: to.Ptr(armrecoveryservicessiterecovery.TestMigrationStateNone), + // TestMigrateStateDescription: to.Ptr("None"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_PauseReplication.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_PauseReplication.json func ExampleReplicationMigrationItemsClient_BeginPauseReplication() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationMigrationItemsClient("migrationvault", "resourcegroup1", "cb53d0c3-bd59-4721-89bc-06916a9147ef", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginPauseReplication(ctx, "vmwarefabric1", "vmwareContainer1", "virtualmachine1", armrecoveryservicessiterecovery.PauseReplicationInput{ + poller, err := clientFactory.NewReplicationMigrationItemsClient().BeginPauseReplication(ctx, "migrationvault", "resourcegroup1", "vmwarefabric1", "vmwareContainer1", "virtualmachine1", armrecoveryservicessiterecovery.PauseReplicationInput{ Properties: &armrecoveryservicessiterecovery.PauseReplicationInputProperties{ InstanceType: to.Ptr("VMwareCbt"), }, @@ -208,22 +352,47 @@ func ExampleReplicationMigrationItemsClient_BeginPauseReplication() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.MigrationItem = armrecoveryservicessiterecovery.MigrationItem{ + // Name: to.Ptr("virtualmachine1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationMigrationItems"), + // ID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationFabrics/vmwarefabric1/replicationProtectionContainers/vmwareContainer1/replicationMigrationItems/virtualmachine1"), + // Properties: &armrecoveryservicessiterecovery.MigrationItemProperties{ + // AllowedOperations: []*armrecoveryservicessiterecovery.MigrationItemOperation{ + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationDisableMigration)}, + // CurrentJob: &armrecoveryservicessiterecovery.CurrentJobDetails{ + // JobID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationJobs/None"), + // JobName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T06:37:50.8082715Z"); return t}()), + // }, + // MachineName: to.Ptr("vm-0520-2"), + // MigrationState: to.Ptr(armrecoveryservicessiterecovery.MigrationStateProtectionSuspended), + // MigrationStateDescription: to.Ptr("Paused"), + // PolicyFriendlyName: to.Ptr("vmwarepolicy1"), + // PolicyID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationPolicies/vmwarepolicy1"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.VMwareCbtMigrationDetails{ + // InstanceType: to.Ptr("VMwareCbt"), + // }, + // TestMigrateState: to.Ptr(armrecoveryservicessiterecovery.TestMigrationStateNone), + // TestMigrateStateDescription: to.Ptr("None"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_ResumeReplication.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_ResumeReplication.json func ExampleReplicationMigrationItemsClient_BeginResumeReplication() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationMigrationItemsClient("migrationvault", "resourcegroup1", "cb53d0c3-bd59-4721-89bc-06916a9147ef", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginResumeReplication(ctx, "vmwarefabric1", "vmwareContainer1", "virtualmachine1", armrecoveryservicessiterecovery.ResumeReplicationInput{ + poller, err := clientFactory.NewReplicationMigrationItemsClient().BeginResumeReplication(ctx, "migrationvault", "resourcegroup1", "vmwarefabric1", "vmwareContainer1", "virtualmachine1", armrecoveryservicessiterecovery.ResumeReplicationInput{ Properties: &armrecoveryservicessiterecovery.ResumeReplicationInputProperties{ ProviderSpecificDetails: &armrecoveryservicessiterecovery.VMwareCbtResumeReplicationInput{ InstanceType: to.Ptr("VMwareCbt"), @@ -238,22 +407,47 @@ func ExampleReplicationMigrationItemsClient_BeginResumeReplication() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.MigrationItem = armrecoveryservicessiterecovery.MigrationItem{ + // Name: to.Ptr("virtualmachine1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationMigrationItems"), + // ID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationFabrics/vmwarefabric1/replicationProtectionContainers/vmwareContainer1/replicationMigrationItems/virtualmachine1"), + // Properties: &armrecoveryservicessiterecovery.MigrationItemProperties{ + // AllowedOperations: []*armrecoveryservicessiterecovery.MigrationItemOperation{ + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationDisableMigration)}, + // CurrentJob: &armrecoveryservicessiterecovery.CurrentJobDetails{ + // JobID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationJobs/None"), + // JobName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T06:37:50.8082715Z"); return t}()), + // }, + // MachineName: to.Ptr("vm-0520-2"), + // MigrationState: to.Ptr(armrecoveryservicessiterecovery.MigrationStateResumeInitiated), + // MigrationStateDescription: to.Ptr("Resuming"), + // PolicyFriendlyName: to.Ptr("vmwarepolicy1"), + // PolicyID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationPolicies/vmwarepolicy1"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.VMwareCbtMigrationDetails{ + // InstanceType: to.Ptr("VMwareCbt"), + // }, + // TestMigrateState: to.Ptr(armrecoveryservicessiterecovery.TestMigrationStateNone), + // TestMigrateStateDescription: to.Ptr("None"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Resync.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Resync.json func ExampleReplicationMigrationItemsClient_BeginResync() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationMigrationItemsClient("migrationvault", "resourcegroup1", "cb53d0c3-bd59-4721-89bc-06916a9147ef", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginResync(ctx, "vmwarefabric1", "vmwareContainer1", "virtualmachine1", armrecoveryservicessiterecovery.ResyncInput{ + poller, err := clientFactory.NewReplicationMigrationItemsClient().BeginResync(ctx, "migrationvault", "resourcegroup1", "vmwarefabric1", "vmwareContainer1", "virtualmachine1", armrecoveryservicessiterecovery.ResyncInput{ Properties: &armrecoveryservicessiterecovery.ResyncInputProperties{ ProviderSpecificDetails: &armrecoveryservicessiterecovery.VMwareCbtResyncInput{ InstanceType: to.Ptr("VMwareCbt"), @@ -268,22 +462,50 @@ func ExampleReplicationMigrationItemsClient_BeginResync() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.MigrationItem = armrecoveryservicessiterecovery.MigrationItem{ + // Name: to.Ptr("virtualmachine1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationMigrationItems"), + // ID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationFabrics/vmwarefabric1/replicationProtectionContainers/vmwareContainer1/replicationMigrationItems/virtualmachine1"), + // Properties: &armrecoveryservicessiterecovery.MigrationItemProperties{ + // AllowedOperations: []*armrecoveryservicessiterecovery.MigrationItemOperation{ + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationMigrate), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationDisableMigration), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationTestMigrate), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationTestMigrateCleanup)}, + // CurrentJob: &armrecoveryservicessiterecovery.CurrentJobDetails{ + // JobID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationJobs/None"), + // JobName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T06:37:50.8082715Z"); return t}()), + // }, + // MachineName: to.Ptr("vm-0520-2"), + // MigrationState: to.Ptr(armrecoveryservicessiterecovery.MigrationStateReplicating), + // MigrationStateDescription: to.Ptr("Ready to migrate"), + // PolicyFriendlyName: to.Ptr("vmwarepolicy1"), + // PolicyID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationPolicies/vmwarepolicy1"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.VMwareCbtMigrationDetails{ + // InstanceType: to.Ptr("VMwareCbt"), + // }, + // TestMigrateState: to.Ptr(armrecoveryservicessiterecovery.TestMigrationStateNone), + // TestMigrateStateDescription: to.Ptr("None"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_TestMigrate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_TestMigrate.json func ExampleReplicationMigrationItemsClient_BeginTestMigrate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationMigrationItemsClient("migrationvault", "resourcegroup1", "cb53d0c3-bd59-4721-89bc-06916a9147ef", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginTestMigrate(ctx, "vmwarefabric1", "vmwareContainer1", "virtualmachine1", armrecoveryservicessiterecovery.TestMigrateInput{ + poller, err := clientFactory.NewReplicationMigrationItemsClient().BeginTestMigrate(ctx, "migrationvault", "resourcegroup1", "vmwarefabric1", "vmwareContainer1", "virtualmachine1", armrecoveryservicessiterecovery.TestMigrateInput{ Properties: &armrecoveryservicessiterecovery.TestMigrateInputProperties{ ProviderSpecificDetails: &armrecoveryservicessiterecovery.VMwareCbtTestMigrateInput{ InstanceType: to.Ptr("VMwareCbt"), @@ -299,22 +521,50 @@ func ExampleReplicationMigrationItemsClient_BeginTestMigrate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.MigrationItem = armrecoveryservicessiterecovery.MigrationItem{ + // Name: to.Ptr("virtualmachine1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationMigrationItems"), + // ID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationFabrics/vmwarefabric1/replicationProtectionContainers/vmwareContainer1/replicationMigrationItems/virtualmachine1"), + // Properties: &armrecoveryservicessiterecovery.MigrationItemProperties{ + // AllowedOperations: []*armrecoveryservicessiterecovery.MigrationItemOperation{ + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationMigrate), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationDisableMigration), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationTestMigrate), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationTestMigrateCleanup)}, + // CurrentJob: &armrecoveryservicessiterecovery.CurrentJobDetails{ + // JobID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationJobs/None"), + // JobName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T06:37:50.8082715Z"); return t}()), + // }, + // MachineName: to.Ptr("vm-0520-2"), + // MigrationState: to.Ptr(armrecoveryservicessiterecovery.MigrationStateReplicating), + // MigrationStateDescription: to.Ptr("Ready to migrate"), + // PolicyFriendlyName: to.Ptr("vmwarepolicy1"), + // PolicyID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationPolicies/vmwarepolicy1"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.VMwareCbtMigrationDetails{ + // InstanceType: to.Ptr("VMwareCbt"), + // }, + // TestMigrateState: to.Ptr(armrecoveryservicessiterecovery.TestMigrationStateNone), + // TestMigrateStateDescription: to.Ptr("None"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_TestMigrateCleanup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_TestMigrateCleanup.json func ExampleReplicationMigrationItemsClient_BeginTestMigrateCleanup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationMigrationItemsClient("migrationvault", "resourcegroup1", "cb53d0c3-bd59-4721-89bc-06916a9147ef", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginTestMigrateCleanup(ctx, "vmwarefabric1", "vmwareContainer1", "virtualmachine1", armrecoveryservicessiterecovery.TestMigrateCleanupInput{ + poller, err := clientFactory.NewReplicationMigrationItemsClient().BeginTestMigrateCleanup(ctx, "migrationvault", "resourcegroup1", "vmwarefabric1", "vmwareContainer1", "virtualmachine1", armrecoveryservicessiterecovery.TestMigrateCleanupInput{ Properties: &armrecoveryservicessiterecovery.TestMigrateCleanupInputProperties{ Comments: to.Ptr("Test Failover Cleanup"), }, @@ -326,33 +576,92 @@ func ExampleReplicationMigrationItemsClient_BeginTestMigrateCleanup() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.MigrationItem = armrecoveryservicessiterecovery.MigrationItem{ + // Name: to.Ptr("virtualmachine1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationMigrationItems"), + // ID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationFabrics/vmwarefabric1/replicationProtectionContainers/vmwareContainer1/replicationMigrationItems/virtualmachine1"), + // Properties: &armrecoveryservicessiterecovery.MigrationItemProperties{ + // AllowedOperations: []*armrecoveryservicessiterecovery.MigrationItemOperation{ + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationMigrate), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationDisableMigration), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationTestMigrate), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationTestMigrateCleanup)}, + // CurrentJob: &armrecoveryservicessiterecovery.CurrentJobDetails{ + // JobID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationJobs/None"), + // JobName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T06:37:50.8082715Z"); return t}()), + // }, + // MachineName: to.Ptr("vm-0520-2"), + // MigrationState: to.Ptr(armrecoveryservicessiterecovery.MigrationStateReplicating), + // MigrationStateDescription: to.Ptr("Ready to migrate"), + // PolicyFriendlyName: to.Ptr("vmwarepolicy1"), + // PolicyID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationPolicies/vmwarepolicy1"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.VMwareCbtMigrationDetails{ + // InstanceType: to.Ptr("VMwareCbt"), + // }, + // TestMigrateState: to.Ptr(armrecoveryservicessiterecovery.TestMigrationStateNone), + // TestMigrateStateDescription: to.Ptr("None"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_List.json func ExampleReplicationMigrationItemsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationMigrationItemsClient("migrationvault", "resourcegroup1", "cb53d0c3-bd59-4721-89bc-06916a9147ef", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(&armrecoveryservicessiterecovery.ReplicationMigrationItemsClientListOptions{SkipToken: nil, + pager := clientFactory.NewReplicationMigrationItemsClient().NewListPager("migrationvault", "resourcegroup1", &armrecoveryservicessiterecovery.ReplicationMigrationItemsClientListOptions{SkipToken: nil, TakeToken: nil, Filter: nil, }) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.MigrationItemCollection = armrecoveryservicessiterecovery.MigrationItemCollection{ + // Value: []*armrecoveryservicessiterecovery.MigrationItem{ + // { + // Name: to.Ptr("virtualmachine1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationMigrationItems"), + // ID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationFabrics/vmwarefabric1/replicationProtectionContainers/vmwareContainer1/replicationMigrationItems/virtualmachine1"), + // Properties: &armrecoveryservicessiterecovery.MigrationItemProperties{ + // AllowedOperations: []*armrecoveryservicessiterecovery.MigrationItemOperation{ + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationMigrate), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationDisableMigration), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationTestMigrate), + // to.Ptr(armrecoveryservicessiterecovery.MigrationItemOperationTestMigrateCleanup)}, + // CurrentJob: &armrecoveryservicessiterecovery.CurrentJobDetails{ + // JobID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationJobs/None"), + // JobName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T06:37:50.8082715Z"); return t}()), + // }, + // MachineName: to.Ptr("vm-0520-2"), + // MigrationState: to.Ptr(armrecoveryservicessiterecovery.MigrationStateReplicating), + // MigrationStateDescription: to.Ptr("Ready to migrate"), + // PolicyFriendlyName: to.Ptr("vmwarepolicy1"), + // PolicyID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationPolicies/vmwarepolicy1"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.VMwareCbtMigrationDetails{ + // InstanceType: to.Ptr("VMwareCbt"), + // }, + // TestMigrateState: to.Ptr(armrecoveryservicessiterecovery.TestMigrationStateNone), + // TestMigrateStateDescription: to.Ptr("None"), + // }, + // }}, + // } } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationnetworkmappings_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationnetworkmappings_client.go index 8fb1a27a02fc..85deee856544 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationnetworkmappings_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationnetworkmappings_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,71 +24,60 @@ import ( // ReplicationNetworkMappingsClient contains the methods for the ReplicationNetworkMappings group. // Don't use this type directly, use NewReplicationNetworkMappingsClient() instead. type ReplicationNetworkMappingsClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationNetworkMappingsClient creates a new instance of ReplicationNetworkMappingsClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationNetworkMappingsClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationNetworkMappingsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationNetworkMappingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationNetworkMappingsClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationNetworkMappingsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationNetworkMappingsClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // BeginCreate - The operation to create an ASR network mapping. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Primary fabric name. -// networkName - Primary network name. -// networkMappingName - Network mapping name. -// input - Create network mapping input. -// options - ReplicationNetworkMappingsClientBeginCreateOptions contains the optional parameters for the ReplicationNetworkMappingsClient.BeginCreate -// method. -func (client *ReplicationNetworkMappingsClient) BeginCreate(ctx context.Context, fabricName string, networkName string, networkMappingName string, input CreateNetworkMappingInput, options *ReplicationNetworkMappingsClientBeginCreateOptions) (*runtime.Poller[ReplicationNetworkMappingsClientCreateResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Primary fabric name. +// - networkName - Primary network name. +// - networkMappingName - Network mapping name. +// - input - Create network mapping input. +// - options - ReplicationNetworkMappingsClientBeginCreateOptions contains the optional parameters for the ReplicationNetworkMappingsClient.BeginCreate +// method. +func (client *ReplicationNetworkMappingsClient) BeginCreate(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, networkName string, networkMappingName string, input CreateNetworkMappingInput, options *ReplicationNetworkMappingsClientBeginCreateOptions) (*runtime.Poller[ReplicationNetworkMappingsClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, fabricName, networkName, networkMappingName, input, options) + resp, err := client.create(ctx, resourceName, resourceGroupName, fabricName, networkName, networkMappingName, input, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationNetworkMappingsClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationNetworkMappingsClientCreateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationNetworkMappingsClientCreateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationNetworkMappingsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Create - The operation to create an ASR network mapping. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationNetworkMappingsClient) create(ctx context.Context, fabricName string, networkName string, networkMappingName string, input CreateNetworkMappingInput, options *ReplicationNetworkMappingsClientBeginCreateOptions) (*http.Response, error) { - req, err := client.createCreateRequest(ctx, fabricName, networkName, networkMappingName, input, options) +func (client *ReplicationNetworkMappingsClient) create(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, networkName string, networkMappingName string, input CreateNetworkMappingInput, options *ReplicationNetworkMappingsClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceName, resourceGroupName, fabricName, networkName, networkMappingName, input, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -101,16 +88,16 @@ func (client *ReplicationNetworkMappingsClient) create(ctx context.Context, fabr } // createCreateRequest creates the Create request. -func (client *ReplicationNetworkMappingsClient) createCreateRequest(ctx context.Context, fabricName string, networkName string, networkMappingName string, input CreateNetworkMappingInput, options *ReplicationNetworkMappingsClientBeginCreateOptions) (*policy.Request, error) { +func (client *ReplicationNetworkMappingsClient) createCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, networkName string, networkMappingName string, input CreateNetworkMappingInput, options *ReplicationNetworkMappingsClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -127,7 +114,7 @@ func (client *ReplicationNetworkMappingsClient) createCreateRequest(ctx context. return nil, errors.New("parameter networkMappingName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{networkMappingName}", url.PathEscape(networkMappingName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -140,33 +127,37 @@ func (client *ReplicationNetworkMappingsClient) createCreateRequest(ctx context. // BeginDelete - The operation to delete a network mapping. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Primary fabric name. -// networkName - Primary network name. -// networkMappingName - ARM Resource Name for network mapping. -// options - ReplicationNetworkMappingsClientBeginDeleteOptions contains the optional parameters for the ReplicationNetworkMappingsClient.BeginDelete -// method. -func (client *ReplicationNetworkMappingsClient) BeginDelete(ctx context.Context, fabricName string, networkName string, networkMappingName string, options *ReplicationNetworkMappingsClientBeginDeleteOptions) (*runtime.Poller[ReplicationNetworkMappingsClientDeleteResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Primary fabric name. +// - networkName - Primary network name. +// - networkMappingName - ARM Resource Name for network mapping. +// - options - ReplicationNetworkMappingsClientBeginDeleteOptions contains the optional parameters for the ReplicationNetworkMappingsClient.BeginDelete +// method. +func (client *ReplicationNetworkMappingsClient) BeginDelete(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, networkName string, networkMappingName string, options *ReplicationNetworkMappingsClientBeginDeleteOptions) (*runtime.Poller[ReplicationNetworkMappingsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, fabricName, networkName, networkMappingName, options) + resp, err := client.deleteOperation(ctx, resourceName, resourceGroupName, fabricName, networkName, networkMappingName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationNetworkMappingsClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationNetworkMappingsClientDeleteResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationNetworkMappingsClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationNetworkMappingsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - The operation to delete a network mapping. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationNetworkMappingsClient) deleteOperation(ctx context.Context, fabricName string, networkName string, networkMappingName string, options *ReplicationNetworkMappingsClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, fabricName, networkName, networkMappingName, options) +func (client *ReplicationNetworkMappingsClient) deleteOperation(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, networkName string, networkMappingName string, options *ReplicationNetworkMappingsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceName, resourceGroupName, fabricName, networkName, networkMappingName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -177,16 +168,16 @@ func (client *ReplicationNetworkMappingsClient) deleteOperation(ctx context.Cont } // deleteCreateRequest creates the Delete request. -func (client *ReplicationNetworkMappingsClient) deleteCreateRequest(ctx context.Context, fabricName string, networkName string, networkMappingName string, options *ReplicationNetworkMappingsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ReplicationNetworkMappingsClient) deleteCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, networkName string, networkMappingName string, options *ReplicationNetworkMappingsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -203,7 +194,7 @@ func (client *ReplicationNetworkMappingsClient) deleteCreateRequest(ctx context. return nil, errors.New("parameter networkMappingName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{networkMappingName}", url.PathEscape(networkMappingName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -215,18 +206,21 @@ func (client *ReplicationNetworkMappingsClient) deleteCreateRequest(ctx context. // Get - Gets the details of an ASR network mapping. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Primary fabric name. -// networkName - Primary network name. -// networkMappingName - Network mapping name. -// options - ReplicationNetworkMappingsClientGetOptions contains the optional parameters for the ReplicationNetworkMappingsClient.Get -// method. -func (client *ReplicationNetworkMappingsClient) Get(ctx context.Context, fabricName string, networkName string, networkMappingName string, options *ReplicationNetworkMappingsClientGetOptions) (ReplicationNetworkMappingsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, fabricName, networkName, networkMappingName, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Primary fabric name. +// - networkName - Primary network name. +// - networkMappingName - Network mapping name. +// - options - ReplicationNetworkMappingsClientGetOptions contains the optional parameters for the ReplicationNetworkMappingsClient.Get +// method. +func (client *ReplicationNetworkMappingsClient) Get(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, networkName string, networkMappingName string, options *ReplicationNetworkMappingsClientGetOptions) (ReplicationNetworkMappingsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, fabricName, networkName, networkMappingName, options) if err != nil { return ReplicationNetworkMappingsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationNetworkMappingsClientGetResponse{}, err } @@ -237,16 +231,16 @@ func (client *ReplicationNetworkMappingsClient) Get(ctx context.Context, fabricN } // getCreateRequest creates the Get request. -func (client *ReplicationNetworkMappingsClient) getCreateRequest(ctx context.Context, fabricName string, networkName string, networkMappingName string, options *ReplicationNetworkMappingsClientGetOptions) (*policy.Request, error) { +func (client *ReplicationNetworkMappingsClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, networkName string, networkMappingName string, options *ReplicationNetworkMappingsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -263,7 +257,7 @@ func (client *ReplicationNetworkMappingsClient) getCreateRequest(ctx context.Con return nil, errors.New("parameter networkMappingName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{networkMappingName}", url.PathEscape(networkMappingName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -284,10 +278,13 @@ func (client *ReplicationNetworkMappingsClient) getHandleResponse(resp *http.Res } // NewListPager - Lists all ASR network mappings in the vault. +// // Generated from API version 2022-10-01 -// options - ReplicationNetworkMappingsClientListOptions contains the optional parameters for the ReplicationNetworkMappingsClient.List -// method. -func (client *ReplicationNetworkMappingsClient) NewListPager(options *ReplicationNetworkMappingsClientListOptions) *runtime.Pager[ReplicationNetworkMappingsClientListResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - ReplicationNetworkMappingsClientListOptions contains the optional parameters for the ReplicationNetworkMappingsClient.NewListPager +// method. +func (client *ReplicationNetworkMappingsClient) NewListPager(resourceName string, resourceGroupName string, options *ReplicationNetworkMappingsClientListOptions) *runtime.Pager[ReplicationNetworkMappingsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationNetworkMappingsClientListResponse]{ More: func(page ReplicationNetworkMappingsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -296,14 +293,14 @@ func (client *ReplicationNetworkMappingsClient) NewListPager(options *Replicatio var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, resourceName, resourceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationNetworkMappingsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationNetworkMappingsClientListResponse{}, err } @@ -316,21 +313,21 @@ func (client *ReplicationNetworkMappingsClient) NewListPager(options *Replicatio } // listCreateRequest creates the List request. -func (client *ReplicationNetworkMappingsClient) listCreateRequest(ctx context.Context, options *ReplicationNetworkMappingsClientListOptions) (*policy.Request, error) { +func (client *ReplicationNetworkMappingsClient) listCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationNetworkMappingsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworkMappings" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -351,12 +348,15 @@ func (client *ReplicationNetworkMappingsClient) listHandleResponse(resp *http.Re } // NewListByReplicationNetworksPager - Lists all ASR network mappings for the specified network. +// // Generated from API version 2022-10-01 -// fabricName - Primary fabric name. -// networkName - Primary network name. -// options - ReplicationNetworkMappingsClientListByReplicationNetworksOptions contains the optional parameters for the ReplicationNetworkMappingsClient.ListByReplicationNetworks -// method. -func (client *ReplicationNetworkMappingsClient) NewListByReplicationNetworksPager(fabricName string, networkName string, options *ReplicationNetworkMappingsClientListByReplicationNetworksOptions) *runtime.Pager[ReplicationNetworkMappingsClientListByReplicationNetworksResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Primary fabric name. +// - networkName - Primary network name. +// - options - ReplicationNetworkMappingsClientListByReplicationNetworksOptions contains the optional parameters for the ReplicationNetworkMappingsClient.NewListByReplicationNetworksPager +// method. +func (client *ReplicationNetworkMappingsClient) NewListByReplicationNetworksPager(resourceName string, resourceGroupName string, fabricName string, networkName string, options *ReplicationNetworkMappingsClientListByReplicationNetworksOptions) *runtime.Pager[ReplicationNetworkMappingsClientListByReplicationNetworksResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationNetworkMappingsClientListByReplicationNetworksResponse]{ More: func(page ReplicationNetworkMappingsClientListByReplicationNetworksResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -365,14 +365,14 @@ func (client *ReplicationNetworkMappingsClient) NewListByReplicationNetworksPage var req *policy.Request var err error if page == nil { - req, err = client.listByReplicationNetworksCreateRequest(ctx, fabricName, networkName, options) + req, err = client.listByReplicationNetworksCreateRequest(ctx, resourceName, resourceGroupName, fabricName, networkName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationNetworkMappingsClientListByReplicationNetworksResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationNetworkMappingsClientListByReplicationNetworksResponse{}, err } @@ -385,16 +385,16 @@ func (client *ReplicationNetworkMappingsClient) NewListByReplicationNetworksPage } // listByReplicationNetworksCreateRequest creates the ListByReplicationNetworks request. -func (client *ReplicationNetworkMappingsClient) listByReplicationNetworksCreateRequest(ctx context.Context, fabricName string, networkName string, options *ReplicationNetworkMappingsClientListByReplicationNetworksOptions) (*policy.Request, error) { +func (client *ReplicationNetworkMappingsClient) listByReplicationNetworksCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, networkName string, options *ReplicationNetworkMappingsClientListByReplicationNetworksOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -407,7 +407,7 @@ func (client *ReplicationNetworkMappingsClient) listByReplicationNetworksCreateR return nil, errors.New("parameter networkName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{networkName}", url.PathEscape(networkName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -429,34 +429,38 @@ func (client *ReplicationNetworkMappingsClient) listByReplicationNetworksHandleR // BeginUpdate - The operation to update an ASR network mapping. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Primary fabric name. -// networkName - Primary network name. -// networkMappingName - Network mapping name. -// input - Update network mapping input. -// options - ReplicationNetworkMappingsClientBeginUpdateOptions contains the optional parameters for the ReplicationNetworkMappingsClient.BeginUpdate -// method. -func (client *ReplicationNetworkMappingsClient) BeginUpdate(ctx context.Context, fabricName string, networkName string, networkMappingName string, input UpdateNetworkMappingInput, options *ReplicationNetworkMappingsClientBeginUpdateOptions) (*runtime.Poller[ReplicationNetworkMappingsClientUpdateResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Primary fabric name. +// - networkName - Primary network name. +// - networkMappingName - Network mapping name. +// - input - Update network mapping input. +// - options - ReplicationNetworkMappingsClientBeginUpdateOptions contains the optional parameters for the ReplicationNetworkMappingsClient.BeginUpdate +// method. +func (client *ReplicationNetworkMappingsClient) BeginUpdate(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, networkName string, networkMappingName string, input UpdateNetworkMappingInput, options *ReplicationNetworkMappingsClientBeginUpdateOptions) (*runtime.Poller[ReplicationNetworkMappingsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, fabricName, networkName, networkMappingName, input, options) + resp, err := client.update(ctx, resourceName, resourceGroupName, fabricName, networkName, networkMappingName, input, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationNetworkMappingsClientUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationNetworkMappingsClientUpdateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationNetworkMappingsClientUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationNetworkMappingsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Update - The operation to update an ASR network mapping. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationNetworkMappingsClient) update(ctx context.Context, fabricName string, networkName string, networkMappingName string, input UpdateNetworkMappingInput, options *ReplicationNetworkMappingsClientBeginUpdateOptions) (*http.Response, error) { - req, err := client.updateCreateRequest(ctx, fabricName, networkName, networkMappingName, input, options) +func (client *ReplicationNetworkMappingsClient) update(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, networkName string, networkMappingName string, input UpdateNetworkMappingInput, options *ReplicationNetworkMappingsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceName, resourceGroupName, fabricName, networkName, networkMappingName, input, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -467,16 +471,16 @@ func (client *ReplicationNetworkMappingsClient) update(ctx context.Context, fabr } // updateCreateRequest creates the Update request. -func (client *ReplicationNetworkMappingsClient) updateCreateRequest(ctx context.Context, fabricName string, networkName string, networkMappingName string, input UpdateNetworkMappingInput, options *ReplicationNetworkMappingsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *ReplicationNetworkMappingsClient) updateCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, networkName string, networkMappingName string, input UpdateNetworkMappingInput, options *ReplicationNetworkMappingsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -493,7 +497,7 @@ func (client *ReplicationNetworkMappingsClient) updateCreateRequest(ctx context. return nil, errors.New("parameter networkMappingName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{networkMappingName}", url.PathEscape(networkMappingName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationnetworkmappings_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationnetworkmappings_client_example_test.go index 9061aecdc0c8..19c65e19953a 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationnetworkmappings_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationnetworkmappings_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -14,64 +15,105 @@ import ( "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/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_ListByReplicationNetworks.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_ListByReplicationNetworks.json func ExampleReplicationNetworkMappingsClient_NewListByReplicationNetworksPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationNetworkMappingsClient("srce2avaultbvtaC27", "srcBvte2a14C27", "9112a37f-0f3e-46ec-9c00-060c6edca071", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByReplicationNetworksPager("b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac", "e2267b5c-2650-49bd-ab3f-d66aae694c06", nil) + pager := clientFactory.NewReplicationNetworkMappingsClient().NewListByReplicationNetworksPager("srce2avaultbvtaC27", "srcBvte2a14C27", "b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac", "e2267b5c-2650-49bd-ab3f-d66aae694c06", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.NetworkMappingCollection = armrecoveryservicessiterecovery.NetworkMappingCollection{ + // Value: []*armrecoveryservicessiterecovery.NetworkMapping{ + // { + // Name: to.Ptr("corpe2amap"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationNetworks/replicationNetworkMappings"), + // ID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/srcBvte2a14C27/providers/Microsoft.RecoveryServices/vaults/srce2avaultbvtaC27/replicationFabrics/b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac/replicationNetworks/e2267b5c-2650-49bd-ab3f-d66aae694c06/replicationNetworkMappings/corpe2amap"), + // Properties: &armrecoveryservicessiterecovery.NetworkMappingProperties{ + // FabricSpecificSettings: &armrecoveryservicessiterecovery.VmmToAzureNetworkMappingSettings{ + // InstanceType: to.Ptr("VmmToAzure"), + // }, + // PrimaryFabricFriendlyName: to.Ptr("CP-B3L30108-01.ntdev.corp.microsoft.com"), + // PrimaryNetworkFriendlyName: to.Ptr("corp"), + // PrimaryNetworkID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/srcBvte2a14C27/providers/Microsoft.RecoveryServices/vaults/srce2avaultbvtaC27/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5/replicationNetworks/e2267b5c-2650-49bd-ab3f-d66aae694c06"), + // RecoveryFabricArmID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/srcBvte2a14C27/providers/Microsoft.RecoveryServices/vaults/srce2avaultbvtaC27/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryNetworkFriendlyName: to.Ptr("vnetavrai"), + // RecoveryNetworkID: to.Ptr("/subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/siterecoveryProd1/providers/Microsoft.Network/virtualNetworks/vnetavrai"), + // State: to.Ptr("Paired"), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_Get.json func ExampleReplicationNetworkMappingsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationNetworkMappingsClient("srce2avaultbvtaC27", "srcBvte2a14C27", "9112a37f-0f3e-46ec-9c00-060c6edca071", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac", "e2267b5c-2650-49bd-ab3f-d66aae694c06", "corpe2amap", nil) + res, err := clientFactory.NewReplicationNetworkMappingsClient().Get(ctx, "srce2avaultbvtaC27", "srcBvte2a14C27", "b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac", "e2267b5c-2650-49bd-ab3f-d66aae694c06", "corpe2amap", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.NetworkMapping = armrecoveryservicessiterecovery.NetworkMapping{ + // Name: to.Ptr("corpe2amap"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationNetworks/replicationNetworkMappings"), + // ID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/srcBvte2a14C27/providers/Microsoft.RecoveryServices/vaults/srce2avaultbvtaC27/replicationFabrics/b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac/replicationNetworks/e2267b5c-2650-49bd-ab3f-d66aae694c06/replicationNetworkMappings/corpe2amap"), + // Properties: &armrecoveryservicessiterecovery.NetworkMappingProperties{ + // FabricSpecificSettings: &armrecoveryservicessiterecovery.VmmToAzureNetworkMappingSettings{ + // InstanceType: to.Ptr("VmmToAzure"), + // }, + // PrimaryFabricFriendlyName: to.Ptr("CP-B3L30108-01.ntdev.corp.microsoft.com"), + // PrimaryNetworkFriendlyName: to.Ptr("corp"), + // PrimaryNetworkID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/srcBvte2a14C27/providers/Microsoft.RecoveryServices/vaults/srce2avaultbvtaC27/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5/replicationNetworks/e2267b5c-2650-49bd-ab3f-d66aae694c06"), + // RecoveryFabricArmID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/srcBvte2a14C27/providers/Microsoft.RecoveryServices/vaults/srce2avaultbvtaC27/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryNetworkFriendlyName: to.Ptr("vnetavrai"), + // RecoveryNetworkID: to.Ptr("/subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/siterecoveryProd1/providers/Microsoft.Network/virtualNetworks/vnetavrai"), + // State: to.Ptr("Paired"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_Create.json func ExampleReplicationNetworkMappingsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationNetworkMappingsClient("srce2avaultbvtaC27", "srcBvte2a14C27", "9112a37f-0f3e-46ec-9c00-060c6edca071", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreate(ctx, "b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac", "e2267b5c-2650-49bd-ab3f-d66aae694c06", "corpe2amap", armrecoveryservicessiterecovery.CreateNetworkMappingInput{ + poller, err := clientFactory.NewReplicationNetworkMappingsClient().BeginCreate(ctx, "srce2avaultbvtaC27", "srcBvte2a14C27", "b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac", "e2267b5c-2650-49bd-ab3f-d66aae694c06", "corpe2amap", armrecoveryservicessiterecovery.CreateNetworkMappingInput{ Properties: &armrecoveryservicessiterecovery.CreateNetworkMappingInputProperties{ FabricSpecificDetails: &armrecoveryservicessiterecovery.VmmToAzureCreateNetworkMappingInput{ InstanceType: to.Ptr("VmmToAzure"), @@ -87,22 +129,41 @@ func ExampleReplicationNetworkMappingsClient_BeginCreate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.NetworkMapping = armrecoveryservicessiterecovery.NetworkMapping{ + // Name: to.Ptr("corpe2amap"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationNetworks/replicationNetworkMappings"), + // ID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/srcBvte2a14C27/providers/Microsoft.RecoveryServices/vaults/srce2avaultbvtaC27/replicationFabrics/b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac/replicationNetworks/e2267b5c-2650-49bd-ab3f-d66aae694c06/replicationNetworkMappings/corpe2amap"), + // Properties: &armrecoveryservicessiterecovery.NetworkMappingProperties{ + // FabricSpecificSettings: &armrecoveryservicessiterecovery.VmmToAzureNetworkMappingSettings{ + // InstanceType: to.Ptr("VmmToAzure"), + // }, + // PrimaryFabricFriendlyName: to.Ptr("CP-B3L30108-01.ntdev.corp.microsoft.com"), + // PrimaryNetworkFriendlyName: to.Ptr("corp"), + // PrimaryNetworkID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/srcBvte2a14C27/providers/Microsoft.RecoveryServices/vaults/srce2avaultbvtaC27/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5/replicationNetworks/e2267b5c-2650-49bd-ab3f-d66aae694c06"), + // RecoveryFabricArmID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/srcBvte2a14C27/providers/Microsoft.RecoveryServices/vaults/srce2avaultbvtaC27/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryNetworkFriendlyName: to.Ptr("vnetavrai"), + // RecoveryNetworkID: to.Ptr("/subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/siterecoveryProd1/providers/Microsoft.Network/virtualNetworks/vnetavrai"), + // State: to.Ptr("Paired"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_Delete.json func ExampleReplicationNetworkMappingsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationNetworkMappingsClient("srce2avaultbvtaC27", "srcBvte2a14C27", "9112a37f-0f3e-46ec-9c00-060c6edca071", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, "b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac", "e2267b5c-2650-49bd-ab3f-d66aae694c06", "corpe2amap", nil) + poller, err := clientFactory.NewReplicationNetworkMappingsClient().BeginDelete(ctx, "srce2avaultbvtaC27", "srcBvte2a14C27", "b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac", "e2267b5c-2650-49bd-ab3f-d66aae694c06", "corpe2amap", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -112,18 +173,18 @@ func ExampleReplicationNetworkMappingsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_Update.json func ExampleReplicationNetworkMappingsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationNetworkMappingsClient("srce2avaultbvtaC27", "srcBvte2a14C27", "9112a37f-0f3e-46ec-9c00-060c6edca071", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, "b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac", "e2267b5c-2650-49bd-ab3f-d66aae694c06", "corpe2amap", armrecoveryservicessiterecovery.UpdateNetworkMappingInput{ + poller, err := clientFactory.NewReplicationNetworkMappingsClient().BeginUpdate(ctx, "srce2avaultbvtaC27", "srcBvte2a14C27", "b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac", "e2267b5c-2650-49bd-ab3f-d66aae694c06", "corpe2amap", armrecoveryservicessiterecovery.UpdateNetworkMappingInput{ Properties: &armrecoveryservicessiterecovery.UpdateNetworkMappingInputProperties{ FabricSpecificDetails: &armrecoveryservicessiterecovery.VmmToAzureUpdateNetworkMappingInput{ InstanceType: to.Ptr("VmmToAzure"), @@ -139,30 +200,71 @@ func ExampleReplicationNetworkMappingsClient_BeginUpdate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.NetworkMapping = armrecoveryservicessiterecovery.NetworkMapping{ + // Name: to.Ptr("corpe2amap"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationNetworks/replicationNetworkMappings"), + // ID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/srcBvte2a14C27/providers/Microsoft.RecoveryServices/vaults/srce2avaultbvtaC27/replicationFabrics/b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac/replicationNetworks/e2267b5c-2650-49bd-ab3f-d66aae694c06/replicationNetworkMappings/corpe2amap"), + // Properties: &armrecoveryservicessiterecovery.NetworkMappingProperties{ + // FabricSpecificSettings: &armrecoveryservicessiterecovery.VmmToAzureNetworkMappingSettings{ + // InstanceType: to.Ptr("VmmToAzure"), + // }, + // PrimaryFabricFriendlyName: to.Ptr("CP-B3L30108-01.ntdev.corp.microsoft.com"), + // PrimaryNetworkFriendlyName: to.Ptr("corp"), + // PrimaryNetworkID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/srcBvte2a14C27/providers/Microsoft.RecoveryServices/vaults/srce2avaultbvtaC27/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5/replicationNetworks/e2267b5c-2650-49bd-ab3f-d66aae694c06"), + // RecoveryFabricArmID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/srcBvte2a14C27/providers/Microsoft.RecoveryServices/vaults/srce2avaultbvtaC27/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryNetworkFriendlyName: to.Ptr("vnetavrai2"), + // RecoveryNetworkID: to.Ptr("/subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/siterecoveryProd1/providers/Microsoft.Network/virtualNetworks/vnetavrai2"), + // State: to.Ptr("Paired"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_List.json func ExampleReplicationNetworkMappingsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationNetworkMappingsClient("srce2avaultbvtaC27", "srcBvte2a14C27", "9112a37f-0f3e-46ec-9c00-060c6edca071", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(nil) + pager := clientFactory.NewReplicationNetworkMappingsClient().NewListPager("srce2avaultbvtaC27", "srcBvte2a14C27", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.NetworkMappingCollection = armrecoveryservicessiterecovery.NetworkMappingCollection{ + // Value: []*armrecoveryservicessiterecovery.NetworkMapping{ + // { + // Name: to.Ptr("corpe2amap"), + // Type: to.Ptr("Microsoft.RecoveryServicesBVTD2/vaults/replicationFabrics/replicationNetworks/replicationNetworkMappings"), + // ID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/srcBvte2a14C27/providers/Microsoft.RecoveryServicesBVTD2/vaults/srce2avaultbvtaC27/replicationFabrics/b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac/replicationNetworks/e2267b5c-2650-49bd-ab3f-d66aae694c06/replicationNetworkMappings/corpe2amap"), + // Properties: &armrecoveryservicessiterecovery.NetworkMappingProperties{ + // FabricSpecificSettings: &armrecoveryservicessiterecovery.VmmToAzureNetworkMappingSettings{ + // InstanceType: to.Ptr("VmmToAzure"), + // }, + // PrimaryFabricFriendlyName: to.Ptr("CP-B3L30108-01.ntdev.corp.microsoft.com"), + // PrimaryNetworkFriendlyName: to.Ptr("corp"), + // PrimaryNetworkID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/srcBvte2a14C27/providers/Microsoft.RecoveryServicesBVTD2/vaults/srce2avaultbvtaC27/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5/replicationNetworks/e2267b5c-2650-49bd-ab3f-d66aae694c06"), + // RecoveryFabricArmID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/srcBvte2a14C27/providers/Microsoft.RecoveryServicesBVTD2/vaults/srce2avaultbvtaC27/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryNetworkFriendlyName: to.Ptr("vnetavrai"), + // RecoveryNetworkID: to.Ptr("/subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/siterecoveryProd1/providers/Microsoft.Network/virtualNetworks/vnetavrai"), + // State: to.Ptr("Paired"), + // }, + // }}, + // } } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationnetworks_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationnetworks_client.go index 171206c4f79f..8e617b340132 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationnetworks_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationnetworks_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,53 +24,41 @@ import ( // ReplicationNetworksClient contains the methods for the ReplicationNetworks group. // Don't use this type directly, use NewReplicationNetworksClient() instead. type ReplicationNetworksClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationNetworksClient creates a new instance of ReplicationNetworksClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationNetworksClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationNetworksClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationNetworksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationNetworksClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationNetworksClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationNetworksClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // Get - Gets the details of a network. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Server Id. -// networkName - Primary network name. -// options - ReplicationNetworksClientGetOptions contains the optional parameters for the ReplicationNetworksClient.Get method. -func (client *ReplicationNetworksClient) Get(ctx context.Context, fabricName string, networkName string, options *ReplicationNetworksClientGetOptions) (ReplicationNetworksClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, fabricName, networkName, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Server Id. +// - networkName - Primary network name. +// - options - ReplicationNetworksClientGetOptions contains the optional parameters for the ReplicationNetworksClient.Get method. +func (client *ReplicationNetworksClient) Get(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, networkName string, options *ReplicationNetworksClientGetOptions) (ReplicationNetworksClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, fabricName, networkName, options) if err != nil { return ReplicationNetworksClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationNetworksClientGetResponse{}, err } @@ -83,16 +69,16 @@ func (client *ReplicationNetworksClient) Get(ctx context.Context, fabricName str } // getCreateRequest creates the Get request. -func (client *ReplicationNetworksClient) getCreateRequest(ctx context.Context, fabricName string, networkName string, options *ReplicationNetworksClientGetOptions) (*policy.Request, error) { +func (client *ReplicationNetworksClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, networkName string, options *ReplicationNetworksClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -105,7 +91,7 @@ func (client *ReplicationNetworksClient) getCreateRequest(ctx context.Context, f return nil, errors.New("parameter networkName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{networkName}", url.PathEscape(networkName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -126,10 +112,13 @@ func (client *ReplicationNetworksClient) getHandleResponse(resp *http.Response) } // NewListPager - Lists the networks available in a vault. +// // Generated from API version 2022-10-01 -// options - ReplicationNetworksClientListOptions contains the optional parameters for the ReplicationNetworksClient.List -// method. -func (client *ReplicationNetworksClient) NewListPager(options *ReplicationNetworksClientListOptions) *runtime.Pager[ReplicationNetworksClientListResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - ReplicationNetworksClientListOptions contains the optional parameters for the ReplicationNetworksClient.NewListPager +// method. +func (client *ReplicationNetworksClient) NewListPager(resourceName string, resourceGroupName string, options *ReplicationNetworksClientListOptions) *runtime.Pager[ReplicationNetworksClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationNetworksClientListResponse]{ More: func(page ReplicationNetworksClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -138,14 +127,14 @@ func (client *ReplicationNetworksClient) NewListPager(options *ReplicationNetwor var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, resourceName, resourceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationNetworksClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationNetworksClientListResponse{}, err } @@ -158,21 +147,21 @@ func (client *ReplicationNetworksClient) NewListPager(options *ReplicationNetwor } // listCreateRequest creates the List request. -func (client *ReplicationNetworksClient) listCreateRequest(ctx context.Context, options *ReplicationNetworksClientListOptions) (*policy.Request, error) { +func (client *ReplicationNetworksClient) listCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationNetworksClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworks" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -193,11 +182,14 @@ func (client *ReplicationNetworksClient) listHandleResponse(resp *http.Response) } // NewListByReplicationFabricsPager - Lists the networks available for a fabric. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// options - ReplicationNetworksClientListByReplicationFabricsOptions contains the optional parameters for the ReplicationNetworksClient.ListByReplicationFabrics -// method. -func (client *ReplicationNetworksClient) NewListByReplicationFabricsPager(fabricName string, options *ReplicationNetworksClientListByReplicationFabricsOptions) *runtime.Pager[ReplicationNetworksClientListByReplicationFabricsResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - options - ReplicationNetworksClientListByReplicationFabricsOptions contains the optional parameters for the ReplicationNetworksClient.NewListByReplicationFabricsPager +// method. +func (client *ReplicationNetworksClient) NewListByReplicationFabricsPager(resourceName string, resourceGroupName string, fabricName string, options *ReplicationNetworksClientListByReplicationFabricsOptions) *runtime.Pager[ReplicationNetworksClientListByReplicationFabricsResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationNetworksClientListByReplicationFabricsResponse]{ More: func(page ReplicationNetworksClientListByReplicationFabricsResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -206,14 +198,14 @@ func (client *ReplicationNetworksClient) NewListByReplicationFabricsPager(fabric var req *policy.Request var err error if page == nil { - req, err = client.listByReplicationFabricsCreateRequest(ctx, fabricName, options) + req, err = client.listByReplicationFabricsCreateRequest(ctx, resourceName, resourceGroupName, fabricName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationNetworksClientListByReplicationFabricsResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationNetworksClientListByReplicationFabricsResponse{}, err } @@ -226,16 +218,16 @@ func (client *ReplicationNetworksClient) NewListByReplicationFabricsPager(fabric } // listByReplicationFabricsCreateRequest creates the ListByReplicationFabrics request. -func (client *ReplicationNetworksClient) listByReplicationFabricsCreateRequest(ctx context.Context, fabricName string, options *ReplicationNetworksClientListByReplicationFabricsOptions) (*policy.Request, error) { +func (client *ReplicationNetworksClient) listByReplicationFabricsCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, options *ReplicationNetworksClientListByReplicationFabricsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -244,7 +236,7 @@ func (client *ReplicationNetworksClient) listByReplicationFabricsCreateRequest(c return nil, errors.New("parameter fabricName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationnetworks_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationnetworks_client_example_test.go index 60131864ddf2..2fe32d2ff6b3 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationnetworks_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationnetworks_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -13,72 +14,165 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworks_ListByReplicationFabrics.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworks_ListByReplicationFabrics.json func ExampleReplicationNetworksClient_NewListByReplicationFabricsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationNetworksClient("srce2avaultbvtaC27", "srcBvte2a14C27", "9112a37f-0f3e-46ec-9c00-060c6edca071", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByReplicationFabricsPager("b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac", nil) + pager := clientFactory.NewReplicationNetworksClient().NewListByReplicationFabricsPager("srce2avaultbvtaC27", "srcBvte2a14C27", "b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.NetworkCollection = armrecoveryservicessiterecovery.NetworkCollection{ + // Value: []*armrecoveryservicessiterecovery.Network{ + // { + // Name: to.Ptr("93ce99d7-1219-4914-aa61-73fe5023988e"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationNetworks"), + // ID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/srcBvte2a14C27/providers/Microsoft.RecoveryServices/vaults/srce2avaultbvtaC27/replicationFabrics/b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac/replicationNetworks/93ce99d7-1219-4914-aa61-73fe5023988e"), + // Properties: &armrecoveryservicessiterecovery.NetworkProperties{ + // FabricType: to.Ptr("VMM"), + // FriendlyName: to.Ptr("VSwitch_VLan"), + // NetworkType: to.Ptr("NoIsolation"), + // Subnets: []*armrecoveryservicessiterecovery.Subnet{ + // }, + // }, + // }, + // { + // Name: to.Ptr("b83bf8fd-f304-48d7-82c9-5d74e6215c1b"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationNetworks"), + // ID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/srcBvte2a14C27/providers/Microsoft.RecoveryServices/vaults/srce2avaultbvtaC27/replicationFabrics/b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac/replicationNetworks/b83bf8fd-f304-48d7-82c9-5d74e6215c1b"), + // Properties: &armrecoveryservicessiterecovery.NetworkProperties{ + // FabricType: to.Ptr("VMM"), + // FriendlyName: to.Ptr("VSwitch_NoIso"), + // NetworkType: to.Ptr("NoIsolation"), + // Subnets: []*armrecoveryservicessiterecovery.Subnet{ + // }, + // }, + // }, + // { + // Name: to.Ptr("e2267b5c-2650-49bd-ab3f-d66aae694c06"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationNetworks"), + // ID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/srcBvte2a14C27/providers/Microsoft.RecoveryServices/vaults/srce2avaultbvtaC27/replicationFabrics/b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac/replicationNetworks/e2267b5c-2650-49bd-ab3f-d66aae694c06"), + // Properties: &armrecoveryservicessiterecovery.NetworkProperties{ + // FabricType: to.Ptr("VMM"), + // FriendlyName: to.Ptr("corp"), + // NetworkType: to.Ptr("NoIsolation"), + // Subnets: []*armrecoveryservicessiterecovery.Subnet{ + // }, + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworks_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworks_Get.json func ExampleReplicationNetworksClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationNetworksClient("srce2avaultbvtaC27", "srcBvte2a14C27", "9112a37f-0f3e-46ec-9c00-060c6edca071", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac", "93ce99d7-1219-4914-aa61-73fe5023988e", nil) + res, err := clientFactory.NewReplicationNetworksClient().Get(ctx, "srce2avaultbvtaC27", "srcBvte2a14C27", "b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac", "93ce99d7-1219-4914-aa61-73fe5023988e", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Network = armrecoveryservicessiterecovery.Network{ + // Name: to.Ptr("93ce99d7-1219-4914-aa61-73fe5023988e"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationNetworks"), + // ID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/srcBvte2a14C27/providers/Microsoft.RecoveryServices/vaults/srce2avaultbvtaC27/replicationFabrics/b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac/replicationNetworks/93ce99d7-1219-4914-aa61-73fe5023988e"), + // Properties: &armrecoveryservicessiterecovery.NetworkProperties{ + // FabricType: to.Ptr("VMM"), + // FriendlyName: to.Ptr("VSwitch_VLan"), + // NetworkType: to.Ptr("NoIsolation"), + // Subnets: []*armrecoveryservicessiterecovery.Subnet{ + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworks_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworks_List.json func ExampleReplicationNetworksClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationNetworksClient("srce2avaultbvtaC27", "srcBvte2a14C27", "9112a37f-0f3e-46ec-9c00-060c6edca071", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(nil) + pager := clientFactory.NewReplicationNetworksClient().NewListPager("srce2avaultbvtaC27", "srcBvte2a14C27", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.NetworkCollection = armrecoveryservicessiterecovery.NetworkCollection{ + // Value: []*armrecoveryservicessiterecovery.Network{ + // { + // Name: to.Ptr("93ce99d7-1219-4914-aa61-73fe5023988e"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationNetworks"), + // ID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/srcBvte2a14C27/providers/Microsoft.RecoveryServices/vaults/srce2avaultbvtaC27/replicationFabrics/b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac/replicationNetworks/93ce99d7-1219-4914-aa61-73fe5023988e"), + // Properties: &armrecoveryservicessiterecovery.NetworkProperties{ + // FabricType: to.Ptr("VMM"), + // FriendlyName: to.Ptr("VSwitch_VLan"), + // NetworkType: to.Ptr("NoIsolation"), + // Subnets: []*armrecoveryservicessiterecovery.Subnet{ + // }, + // }, + // }, + // { + // Name: to.Ptr("b83bf8fd-f304-48d7-82c9-5d74e6215c1b"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationNetworks"), + // ID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/srcBvte2a14C27/providers/Microsoft.RecoveryServices/vaults/srce2avaultbvtaC27/replicationFabrics/b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac/replicationNetworks/b83bf8fd-f304-48d7-82c9-5d74e6215c1b"), + // Properties: &armrecoveryservicessiterecovery.NetworkProperties{ + // FabricType: to.Ptr("VMM"), + // FriendlyName: to.Ptr("VSwitch_NoIso"), + // NetworkType: to.Ptr("NoIsolation"), + // Subnets: []*armrecoveryservicessiterecovery.Subnet{ + // }, + // }, + // }, + // { + // Name: to.Ptr("e2267b5c-2650-49bd-ab3f-d66aae694c06"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationNetworks"), + // ID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/srcBvte2a14C27/providers/Microsoft.RecoveryServices/vaults/srce2avaultbvtaC27/replicationFabrics/b0cef6e9a4437b81803d0b55ada4f700ab66caae59c35d62723a1589c0cd13ac/replicationNetworks/e2267b5c-2650-49bd-ab3f-d66aae694c06"), + // Properties: &armrecoveryservicessiterecovery.NetworkProperties{ + // FabricType: to.Ptr("VMM"), + // FriendlyName: to.Ptr("corp"), + // NetworkType: to.Ptr("NoIsolation"), + // Subnets: []*armrecoveryservicessiterecovery.Subnet{ + // }, + // }, + // }}, + // } } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationpolicies_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationpolicies_client.go index 6d67a09d0c6a..10bc9a2c9280 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationpolicies_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationpolicies_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,69 +24,58 @@ import ( // ReplicationPoliciesClient contains the methods for the ReplicationPolicies group. // Don't use this type directly, use NewReplicationPoliciesClient() instead. type ReplicationPoliciesClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationPoliciesClient creates a new instance of ReplicationPoliciesClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationPoliciesClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationPoliciesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationPoliciesClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationPoliciesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationPoliciesClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // BeginCreate - The operation to create a replication policy. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// policyName - Replication policy name. -// input - Create policy input. -// options - ReplicationPoliciesClientBeginCreateOptions contains the optional parameters for the ReplicationPoliciesClient.BeginCreate -// method. -func (client *ReplicationPoliciesClient) BeginCreate(ctx context.Context, policyName string, input CreatePolicyInput, options *ReplicationPoliciesClientBeginCreateOptions) (*runtime.Poller[ReplicationPoliciesClientCreateResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - policyName - Replication policy name. +// - input - Create policy input. +// - options - ReplicationPoliciesClientBeginCreateOptions contains the optional parameters for the ReplicationPoliciesClient.BeginCreate +// method. +func (client *ReplicationPoliciesClient) BeginCreate(ctx context.Context, resourceName string, resourceGroupName string, policyName string, input CreatePolicyInput, options *ReplicationPoliciesClientBeginCreateOptions) (*runtime.Poller[ReplicationPoliciesClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, policyName, input, options) + resp, err := client.create(ctx, resourceName, resourceGroupName, policyName, input, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationPoliciesClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationPoliciesClientCreateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationPoliciesClientCreateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationPoliciesClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Create - The operation to create a replication policy. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationPoliciesClient) create(ctx context.Context, policyName string, input CreatePolicyInput, options *ReplicationPoliciesClientBeginCreateOptions) (*http.Response, error) { - req, err := client.createCreateRequest(ctx, policyName, input, options) +func (client *ReplicationPoliciesClient) create(ctx context.Context, resourceName string, resourceGroupName string, policyName string, input CreatePolicyInput, options *ReplicationPoliciesClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceName, resourceGroupName, policyName, input, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -99,16 +86,16 @@ func (client *ReplicationPoliciesClient) create(ctx context.Context, policyName } // createCreateRequest creates the Create request. -func (client *ReplicationPoliciesClient) createCreateRequest(ctx context.Context, policyName string, input CreatePolicyInput, options *ReplicationPoliciesClientBeginCreateOptions) (*policy.Request, error) { +func (client *ReplicationPoliciesClient) createCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, policyName string, input CreatePolicyInput, options *ReplicationPoliciesClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -117,7 +104,7 @@ func (client *ReplicationPoliciesClient) createCreateRequest(ctx context.Context return nil, errors.New("parameter policyName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{policyName}", url.PathEscape(policyName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -130,31 +117,35 @@ func (client *ReplicationPoliciesClient) createCreateRequest(ctx context.Context // BeginDelete - The operation to delete a replication policy. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// policyName - Replication policy name. -// options - ReplicationPoliciesClientBeginDeleteOptions contains the optional parameters for the ReplicationPoliciesClient.BeginDelete -// method. -func (client *ReplicationPoliciesClient) BeginDelete(ctx context.Context, policyName string, options *ReplicationPoliciesClientBeginDeleteOptions) (*runtime.Poller[ReplicationPoliciesClientDeleteResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - policyName - Replication policy name. +// - options - ReplicationPoliciesClientBeginDeleteOptions contains the optional parameters for the ReplicationPoliciesClient.BeginDelete +// method. +func (client *ReplicationPoliciesClient) BeginDelete(ctx context.Context, resourceName string, resourceGroupName string, policyName string, options *ReplicationPoliciesClientBeginDeleteOptions) (*runtime.Poller[ReplicationPoliciesClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, policyName, options) + resp, err := client.deleteOperation(ctx, resourceName, resourceGroupName, policyName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationPoliciesClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationPoliciesClientDeleteResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationPoliciesClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationPoliciesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - The operation to delete a replication policy. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationPoliciesClient) deleteOperation(ctx context.Context, policyName string, options *ReplicationPoliciesClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, policyName, options) +func (client *ReplicationPoliciesClient) deleteOperation(ctx context.Context, resourceName string, resourceGroupName string, policyName string, options *ReplicationPoliciesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceName, resourceGroupName, policyName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -165,16 +156,16 @@ func (client *ReplicationPoliciesClient) deleteOperation(ctx context.Context, po } // deleteCreateRequest creates the Delete request. -func (client *ReplicationPoliciesClient) deleteCreateRequest(ctx context.Context, policyName string, options *ReplicationPoliciesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ReplicationPoliciesClient) deleteCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, policyName string, options *ReplicationPoliciesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -183,7 +174,7 @@ func (client *ReplicationPoliciesClient) deleteCreateRequest(ctx context.Context return nil, errors.New("parameter policyName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{policyName}", url.PathEscape(policyName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -195,15 +186,18 @@ func (client *ReplicationPoliciesClient) deleteCreateRequest(ctx context.Context // Get - Gets the details of a replication policy. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// policyName - Replication policy name. -// options - ReplicationPoliciesClientGetOptions contains the optional parameters for the ReplicationPoliciesClient.Get method. -func (client *ReplicationPoliciesClient) Get(ctx context.Context, policyName string, options *ReplicationPoliciesClientGetOptions) (ReplicationPoliciesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, policyName, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - policyName - Replication policy name. +// - options - ReplicationPoliciesClientGetOptions contains the optional parameters for the ReplicationPoliciesClient.Get method. +func (client *ReplicationPoliciesClient) Get(ctx context.Context, resourceName string, resourceGroupName string, policyName string, options *ReplicationPoliciesClientGetOptions) (ReplicationPoliciesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, policyName, options) if err != nil { return ReplicationPoliciesClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationPoliciesClientGetResponse{}, err } @@ -214,16 +208,16 @@ func (client *ReplicationPoliciesClient) Get(ctx context.Context, policyName str } // getCreateRequest creates the Get request. -func (client *ReplicationPoliciesClient) getCreateRequest(ctx context.Context, policyName string, options *ReplicationPoliciesClientGetOptions) (*policy.Request, error) { +func (client *ReplicationPoliciesClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, policyName string, options *ReplicationPoliciesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -232,7 +226,7 @@ func (client *ReplicationPoliciesClient) getCreateRequest(ctx context.Context, p return nil, errors.New("parameter policyName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{policyName}", url.PathEscape(policyName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -253,10 +247,13 @@ func (client *ReplicationPoliciesClient) getHandleResponse(resp *http.Response) } // NewListPager - Lists the replication policies for a vault. +// // Generated from API version 2022-10-01 -// options - ReplicationPoliciesClientListOptions contains the optional parameters for the ReplicationPoliciesClient.List -// method. -func (client *ReplicationPoliciesClient) NewListPager(options *ReplicationPoliciesClientListOptions) *runtime.Pager[ReplicationPoliciesClientListResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - ReplicationPoliciesClientListOptions contains the optional parameters for the ReplicationPoliciesClient.NewListPager +// method. +func (client *ReplicationPoliciesClient) NewListPager(resourceName string, resourceGroupName string, options *ReplicationPoliciesClientListOptions) *runtime.Pager[ReplicationPoliciesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationPoliciesClientListResponse]{ More: func(page ReplicationPoliciesClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -265,14 +262,14 @@ func (client *ReplicationPoliciesClient) NewListPager(options *ReplicationPolici var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, resourceName, resourceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationPoliciesClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationPoliciesClientListResponse{}, err } @@ -285,21 +282,21 @@ func (client *ReplicationPoliciesClient) NewListPager(options *ReplicationPolici } // listCreateRequest creates the List request. -func (client *ReplicationPoliciesClient) listCreateRequest(ctx context.Context, options *ReplicationPoliciesClientListOptions) (*policy.Request, error) { +func (client *ReplicationPoliciesClient) listCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationPoliciesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -321,32 +318,36 @@ func (client *ReplicationPoliciesClient) listHandleResponse(resp *http.Response) // BeginUpdate - The operation to update a replication policy. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// policyName - Policy Id. -// input - Update Policy Input. -// options - ReplicationPoliciesClientBeginUpdateOptions contains the optional parameters for the ReplicationPoliciesClient.BeginUpdate -// method. -func (client *ReplicationPoliciesClient) BeginUpdate(ctx context.Context, policyName string, input UpdatePolicyInput, options *ReplicationPoliciesClientBeginUpdateOptions) (*runtime.Poller[ReplicationPoliciesClientUpdateResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - policyName - Policy Id. +// - input - Update Policy Input. +// - options - ReplicationPoliciesClientBeginUpdateOptions contains the optional parameters for the ReplicationPoliciesClient.BeginUpdate +// method. +func (client *ReplicationPoliciesClient) BeginUpdate(ctx context.Context, resourceName string, resourceGroupName string, policyName string, input UpdatePolicyInput, options *ReplicationPoliciesClientBeginUpdateOptions) (*runtime.Poller[ReplicationPoliciesClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, policyName, input, options) + resp, err := client.update(ctx, resourceName, resourceGroupName, policyName, input, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationPoliciesClientUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationPoliciesClientUpdateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationPoliciesClientUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationPoliciesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Update - The operation to update a replication policy. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationPoliciesClient) update(ctx context.Context, policyName string, input UpdatePolicyInput, options *ReplicationPoliciesClientBeginUpdateOptions) (*http.Response, error) { - req, err := client.updateCreateRequest(ctx, policyName, input, options) +func (client *ReplicationPoliciesClient) update(ctx context.Context, resourceName string, resourceGroupName string, policyName string, input UpdatePolicyInput, options *ReplicationPoliciesClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceName, resourceGroupName, policyName, input, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -357,16 +358,16 @@ func (client *ReplicationPoliciesClient) update(ctx context.Context, policyName } // updateCreateRequest creates the Update request. -func (client *ReplicationPoliciesClient) updateCreateRequest(ctx context.Context, policyName string, input UpdatePolicyInput, options *ReplicationPoliciesClientBeginUpdateOptions) (*policy.Request, error) { +func (client *ReplicationPoliciesClient) updateCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, policyName string, input UpdatePolicyInput, options *ReplicationPoliciesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -375,7 +376,7 @@ func (client *ReplicationPoliciesClient) updateCreateRequest(ctx context.Context return nil, errors.New("parameter policyName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{policyName}", url.PathEscape(policyName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationpolicies_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationpolicies_client_example_test.go index 8ca250234370..5e5370178b8c 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationpolicies_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationpolicies_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -14,64 +15,91 @@ import ( "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/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationPolicies_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationPolicies_List.json func ExampleReplicationPoliciesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationPoliciesClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(nil) + pager := clientFactory.NewReplicationPoliciesClient().NewListPager("vault1", "resourceGroupPS1", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.PolicyCollection = armrecoveryservicessiterecovery.PolicyCollection{ + // Value: []*armrecoveryservicessiterecovery.Policy{ + // { + // Name: to.Ptr("protectionprofile1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationPolicies"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // Properties: &armrecoveryservicessiterecovery.PolicyProperties{ + // FriendlyName: to.Ptr("protectionprofile1"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzurePolicyDetails{ + // InstanceType: to.Ptr("HyperVReplicaAzure"), + // }, + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationPolicies_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationPolicies_Get.json func ExampleReplicationPoliciesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationPoliciesClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "protectionprofile1", nil) + res, err := clientFactory.NewReplicationPoliciesClient().Get(ctx, "vault1", "resourceGroupPS1", "protectionprofile1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Policy = armrecoveryservicessiterecovery.Policy{ + // Name: to.Ptr("protectionprofile1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationPolicies"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // Properties: &armrecoveryservicessiterecovery.PolicyProperties{ + // FriendlyName: to.Ptr("protectionprofile1"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzurePolicyDetails{ + // InstanceType: to.Ptr("HyperVReplicaAzure"), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationPolicies_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationPolicies_Create.json func ExampleReplicationPoliciesClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationPoliciesClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreate(ctx, "protectionprofile1", armrecoveryservicessiterecovery.CreatePolicyInput{ + poller, err := clientFactory.NewReplicationPoliciesClient().BeginCreate(ctx, "vault1", "resourceGroupPS1", "protectionprofile1", armrecoveryservicessiterecovery.CreatePolicyInput{ Properties: &armrecoveryservicessiterecovery.CreatePolicyInputProperties{ ProviderSpecificInput: &armrecoveryservicessiterecovery.HyperVReplicaAzurePolicyInput{ InstanceType: to.Ptr("HyperVReplicaAzure"), @@ -85,22 +113,34 @@ func ExampleReplicationPoliciesClient_BeginCreate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Policy = armrecoveryservicessiterecovery.Policy{ + // Name: to.Ptr("protectionprofile1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationPolicies"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // Properties: &armrecoveryservicessiterecovery.PolicyProperties{ + // FriendlyName: to.Ptr("protectionprofile1"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzurePolicyDetails{ + // InstanceType: to.Ptr("HyperVReplicaAzure"), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationPolicies_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationPolicies_Delete.json func ExampleReplicationPoliciesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationPoliciesClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, "protectionprofile1", nil) + poller, err := clientFactory.NewReplicationPoliciesClient().BeginDelete(ctx, "vault1", "resourceGroupPS1", "protectionprofile1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -110,18 +150,18 @@ func ExampleReplicationPoliciesClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationPolicies_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationPolicies_Update.json func ExampleReplicationPoliciesClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationPoliciesClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, "protectionprofile1", armrecoveryservicessiterecovery.UpdatePolicyInput{ + poller, err := clientFactory.NewReplicationPoliciesClient().BeginUpdate(ctx, "vault1", "resourceGroupPS1", "protectionprofile1", armrecoveryservicessiterecovery.UpdatePolicyInput{ Properties: &armrecoveryservicessiterecovery.UpdatePolicyInputProperties{ ReplicationProviderSettings: &armrecoveryservicessiterecovery.HyperVReplicaAzurePolicyInput{ InstanceType: to.Ptr("HyperVReplicaAzure"), @@ -135,6 +175,18 @@ func ExampleReplicationPoliciesClient_BeginUpdate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Policy = armrecoveryservicessiterecovery.Policy{ + // Name: to.Ptr("protectionprofile1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationPolicies"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // Properties: &armrecoveryservicessiterecovery.PolicyProperties{ + // FriendlyName: to.Ptr("protectionprofile1"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzurePolicyDetails{ + // InstanceType: to.Ptr("HyperVReplicaAzure"), + // }, + // }, + // } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectableitems_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectableitems_client.go index 9241031254f7..d693206b4bc9 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectableitems_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectableitems_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,55 +24,43 @@ import ( // ReplicationProtectableItemsClient contains the methods for the ReplicationProtectableItems group. // Don't use this type directly, use NewReplicationProtectableItemsClient() instead. type ReplicationProtectableItemsClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationProtectableItemsClient creates a new instance of ReplicationProtectableItemsClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationProtectableItemsClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationProtectableItemsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationProtectableItemsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationProtectableItemsClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationProtectableItemsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationProtectableItemsClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // Get - The operation to get the details of a protectable item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// protectableItemName - Protectable item name. -// options - ReplicationProtectableItemsClientGetOptions contains the optional parameters for the ReplicationProtectableItemsClient.Get -// method. -func (client *ReplicationProtectableItemsClient) Get(ctx context.Context, fabricName string, protectionContainerName string, protectableItemName string, options *ReplicationProtectableItemsClientGetOptions) (ReplicationProtectableItemsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, fabricName, protectionContainerName, protectableItemName, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - protectableItemName - Protectable item name. +// - options - ReplicationProtectableItemsClientGetOptions contains the optional parameters for the ReplicationProtectableItemsClient.Get +// method. +func (client *ReplicationProtectableItemsClient) Get(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, protectableItemName string, options *ReplicationProtectableItemsClientGetOptions) (ReplicationProtectableItemsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, protectableItemName, options) if err != nil { return ReplicationProtectableItemsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationProtectableItemsClientGetResponse{}, err } @@ -85,16 +71,16 @@ func (client *ReplicationProtectableItemsClient) Get(ctx context.Context, fabric } // getCreateRequest creates the Get request. -func (client *ReplicationProtectableItemsClient) getCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, protectableItemName string, options *ReplicationProtectableItemsClientGetOptions) (*policy.Request, error) { +func (client *ReplicationProtectableItemsClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, protectableItemName string, options *ReplicationProtectableItemsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems/{protectableItemName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -111,7 +97,7 @@ func (client *ReplicationProtectableItemsClient) getCreateRequest(ctx context.Co return nil, errors.New("parameter protectableItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{protectableItemName}", url.PathEscape(protectableItemName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -132,12 +118,15 @@ func (client *ReplicationProtectableItemsClient) getHandleResponse(resp *http.Re } // NewListByReplicationProtectionContainersPager - Lists the protectable items in a protection container. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// options - ReplicationProtectableItemsClientListByReplicationProtectionContainersOptions contains the optional parameters -// for the ReplicationProtectableItemsClient.ListByReplicationProtectionContainers method. -func (client *ReplicationProtectableItemsClient) NewListByReplicationProtectionContainersPager(fabricName string, protectionContainerName string, options *ReplicationProtectableItemsClientListByReplicationProtectionContainersOptions) *runtime.Pager[ReplicationProtectableItemsClientListByReplicationProtectionContainersResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - options - ReplicationProtectableItemsClientListByReplicationProtectionContainersOptions contains the optional parameters +// for the ReplicationProtectableItemsClient.NewListByReplicationProtectionContainersPager method. +func (client *ReplicationProtectableItemsClient) NewListByReplicationProtectionContainersPager(resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, options *ReplicationProtectableItemsClientListByReplicationProtectionContainersOptions) *runtime.Pager[ReplicationProtectableItemsClientListByReplicationProtectionContainersResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationProtectableItemsClientListByReplicationProtectionContainersResponse]{ More: func(page ReplicationProtectableItemsClientListByReplicationProtectionContainersResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -146,14 +135,14 @@ func (client *ReplicationProtectableItemsClient) NewListByReplicationProtectionC var req *policy.Request var err error if page == nil { - req, err = client.listByReplicationProtectionContainersCreateRequest(ctx, fabricName, protectionContainerName, options) + req, err = client.listByReplicationProtectionContainersCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationProtectableItemsClientListByReplicationProtectionContainersResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationProtectableItemsClientListByReplicationProtectionContainersResponse{}, err } @@ -166,16 +155,16 @@ func (client *ReplicationProtectableItemsClient) NewListByReplicationProtectionC } // listByReplicationProtectionContainersCreateRequest creates the ListByReplicationProtectionContainers request. -func (client *ReplicationProtectableItemsClient) listByReplicationProtectionContainersCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, options *ReplicationProtectableItemsClientListByReplicationProtectionContainersOptions) (*policy.Request, error) { +func (client *ReplicationProtectableItemsClient) listByReplicationProtectionContainersCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, options *ReplicationProtectableItemsClientListByReplicationProtectionContainersOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -188,7 +177,7 @@ func (client *ReplicationProtectableItemsClient) listByReplicationProtectionCont return nil, errors.New("parameter protectionContainerName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{protectionContainerName}", url.PathEscape(protectionContainerName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectableitems_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectableitems_client_example_test.go index c6e2bb2acf9a..33c49baefbad 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectableitems_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectableitems_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -13,51 +14,107 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectableItems_ListByReplicationProtectionContainers.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectableItems_ListByReplicationProtectionContainers.json func ExampleReplicationProtectableItemsClient_NewListByReplicationProtectionContainersPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectableItemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByReplicationProtectionContainersPager("cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", &armrecoveryservicessiterecovery.ReplicationProtectableItemsClientListByReplicationProtectionContainersOptions{Filter: nil, + pager := clientFactory.NewReplicationProtectableItemsClient().NewListByReplicationProtectionContainersPager("vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", &armrecoveryservicessiterecovery.ReplicationProtectableItemsClientListByReplicationProtectionContainersOptions{Filter: nil, Take: nil, SkipToken: nil, }) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.ProtectableItemCollection = armrecoveryservicessiterecovery.ProtectableItemCollection{ + // Value: []*armrecoveryservicessiterecovery.ProtectableItem{ + // { + // Name: to.Ptr("c0c14913-3d7a-48ea-9531-cc99e0e686e6"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectableItems"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectableItems/c0c14913-3d7a-48ea-9531-cc99e0e686e6"), + // Properties: &armrecoveryservicessiterecovery.ProtectableItemProperties{ + // CustomDetails: &armrecoveryservicessiterecovery.ReplicationGroupDetails{ + // InstanceType: to.Ptr("ReplicationGroupDetails"), + // }, + // FriendlyName: to.Ptr("vm2"), + // ProtectionReadinessErrors: []*string{ + // }, + // ProtectionStatus: to.Ptr("Unprotected"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/241641e6-ee7b-4ee4-8141-821fadda43fa"), + // SupportedReplicationProviders: []*string{ + // to.Ptr("HyperVReplicaAzure")}, + // }, + // }, + // { + // Name: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectableItems"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectableItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // Properties: &armrecoveryservicessiterecovery.ProtectableItemProperties{ + // CustomDetails: &armrecoveryservicessiterecovery.ReplicationGroupDetails{ + // InstanceType: to.Ptr("ReplicationGroupDetails"), + // }, + // FriendlyName: to.Ptr("vm1"), + // ProtectionReadinessErrors: []*string{ + // }, + // ProtectionStatus: to.Ptr("Unprotected"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/241641e6-ee7b-4ee4-8141-821fadda43fa"), + // SupportedReplicationProviders: []*string{ + // to.Ptr("HyperVReplicaAzure")}, + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectableItems_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectableItems_Get.json func ExampleReplicationProtectableItemsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectableItemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "c0c14913-3d7a-48ea-9531-cc99e0e686e6", nil) + res, err := clientFactory.NewReplicationProtectableItemsClient().Get(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "c0c14913-3d7a-48ea-9531-cc99e0e686e6", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ProtectableItem = armrecoveryservicessiterecovery.ProtectableItem{ + // Name: to.Ptr("c0c14913-3d7a-48ea-9531-cc99e0e686e6"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectableItems"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectableItems/c0c14913-3d7a-48ea-9531-cc99e0e686e6"), + // Properties: &armrecoveryservicessiterecovery.ProtectableItemProperties{ + // CustomDetails: &armrecoveryservicessiterecovery.ReplicationGroupDetails{ + // InstanceType: to.Ptr("ReplicationGroupDetails"), + // }, + // FriendlyName: to.Ptr("vm2"), + // ProtectionReadinessErrors: []*string{ + // }, + // ProtectionStatus: to.Ptr("Unprotected"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/241641e6-ee7b-4ee4-8141-821fadda43fa"), + // SupportedReplicationProviders: []*string{ + // to.Ptr("HyperVReplicaAzure")}, + // }, + // } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotecteditems_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotecteditems_client.go index 35f6060cbfac..c04fabaa2efb 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotecteditems_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotecteditems_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,71 +24,60 @@ import ( // ReplicationProtectedItemsClient contains the methods for the ReplicationProtectedItems group. // Don't use this type directly, use NewReplicationProtectedItemsClient() instead. type ReplicationProtectedItemsClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationProtectedItemsClient creates a new instance of ReplicationProtectedItemsClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationProtectedItemsClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationProtectedItemsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationProtectedItemsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationProtectedItemsClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationProtectedItemsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationProtectedItemsClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // BeginAddDisks - Operation to add disks(s) to the replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Unique fabric name. -// protectionContainerName - Protection container name. -// replicatedProtectedItemName - Replication protected item name. -// addDisksInput - Add disks input. -// options - ReplicationProtectedItemsClientBeginAddDisksOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginAddDisks -// method. -func (client *ReplicationProtectedItemsClient) BeginAddDisks(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, addDisksInput AddDisksInput, options *ReplicationProtectedItemsClientBeginAddDisksOptions) (*runtime.Poller[ReplicationProtectedItemsClientAddDisksResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Unique fabric name. +// - protectionContainerName - Protection container name. +// - replicatedProtectedItemName - Replication protected item name. +// - addDisksInput - Add disks input. +// - options - ReplicationProtectedItemsClientBeginAddDisksOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginAddDisks +// method. +func (client *ReplicationProtectedItemsClient) BeginAddDisks(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, addDisksInput AddDisksInput, options *ReplicationProtectedItemsClientBeginAddDisksOptions) (*runtime.Poller[ReplicationProtectedItemsClientAddDisksResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.addDisks(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, addDisksInput, options) + resp, err := client.addDisks(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, addDisksInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectedItemsClientAddDisksResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectedItemsClientAddDisksResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientAddDisksResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientAddDisksResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // AddDisks - Operation to add disks(s) to the replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectedItemsClient) addDisks(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, addDisksInput AddDisksInput, options *ReplicationProtectedItemsClientBeginAddDisksOptions) (*http.Response, error) { - req, err := client.addDisksCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, addDisksInput, options) +func (client *ReplicationProtectedItemsClient) addDisks(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, addDisksInput AddDisksInput, options *ReplicationProtectedItemsClientBeginAddDisksOptions) (*http.Response, error) { + req, err := client.addDisksCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, addDisksInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -101,16 +88,16 @@ func (client *ReplicationProtectedItemsClient) addDisks(ctx context.Context, fab } // addDisksCreateRequest creates the AddDisks request. -func (client *ReplicationProtectedItemsClient) addDisksCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, addDisksInput AddDisksInput, options *ReplicationProtectedItemsClientBeginAddDisksOptions) (*policy.Request, error) { +func (client *ReplicationProtectedItemsClient) addDisksCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, addDisksInput AddDisksInput, options *ReplicationProtectedItemsClientBeginAddDisksOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/addDisks" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -127,7 +114,7 @@ func (client *ReplicationProtectedItemsClient) addDisksCreateRequest(ctx context return nil, errors.New("parameter replicatedProtectedItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{replicatedProtectedItemName}", url.PathEscape(replicatedProtectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -140,34 +127,38 @@ func (client *ReplicationProtectedItemsClient) addDisksCreateRequest(ctx context // BeginApplyRecoveryPoint - The operation to change the recovery point of a failed over replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - The ARM fabric name. -// protectionContainerName - The protection container name. -// replicatedProtectedItemName - The replicated protected item name. -// applyRecoveryPointInput - The ApplyRecoveryPointInput. -// options - ReplicationProtectedItemsClientBeginApplyRecoveryPointOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginApplyRecoveryPoint -// method. -func (client *ReplicationProtectedItemsClient) BeginApplyRecoveryPoint(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, applyRecoveryPointInput ApplyRecoveryPointInput, options *ReplicationProtectedItemsClientBeginApplyRecoveryPointOptions) (*runtime.Poller[ReplicationProtectedItemsClientApplyRecoveryPointResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - The ARM fabric name. +// - protectionContainerName - The protection container name. +// - replicatedProtectedItemName - The replicated protected item name. +// - applyRecoveryPointInput - The ApplyRecoveryPointInput. +// - options - ReplicationProtectedItemsClientBeginApplyRecoveryPointOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginApplyRecoveryPoint +// method. +func (client *ReplicationProtectedItemsClient) BeginApplyRecoveryPoint(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, applyRecoveryPointInput ApplyRecoveryPointInput, options *ReplicationProtectedItemsClientBeginApplyRecoveryPointOptions) (*runtime.Poller[ReplicationProtectedItemsClientApplyRecoveryPointResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.applyRecoveryPoint(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, applyRecoveryPointInput, options) + resp, err := client.applyRecoveryPoint(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, applyRecoveryPointInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectedItemsClientApplyRecoveryPointResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectedItemsClientApplyRecoveryPointResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientApplyRecoveryPointResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientApplyRecoveryPointResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // ApplyRecoveryPoint - The operation to change the recovery point of a failed over replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectedItemsClient) applyRecoveryPoint(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, applyRecoveryPointInput ApplyRecoveryPointInput, options *ReplicationProtectedItemsClientBeginApplyRecoveryPointOptions) (*http.Response, error) { - req, err := client.applyRecoveryPointCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, applyRecoveryPointInput, options) +func (client *ReplicationProtectedItemsClient) applyRecoveryPoint(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, applyRecoveryPointInput ApplyRecoveryPointInput, options *ReplicationProtectedItemsClientBeginApplyRecoveryPointOptions) (*http.Response, error) { + req, err := client.applyRecoveryPointCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, applyRecoveryPointInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -178,16 +169,16 @@ func (client *ReplicationProtectedItemsClient) applyRecoveryPoint(ctx context.Co } // applyRecoveryPointCreateRequest creates the ApplyRecoveryPoint request. -func (client *ReplicationProtectedItemsClient) applyRecoveryPointCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, applyRecoveryPointInput ApplyRecoveryPointInput, options *ReplicationProtectedItemsClientBeginApplyRecoveryPointOptions) (*policy.Request, error) { +func (client *ReplicationProtectedItemsClient) applyRecoveryPointCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, applyRecoveryPointInput ApplyRecoveryPointInput, options *ReplicationProtectedItemsClientBeginApplyRecoveryPointOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/applyRecoveryPoint" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -204,7 +195,7 @@ func (client *ReplicationProtectedItemsClient) applyRecoveryPointCreateRequest(c return nil, errors.New("parameter replicatedProtectedItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{replicatedProtectedItemName}", url.PathEscape(replicatedProtectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -217,34 +208,38 @@ func (client *ReplicationProtectedItemsClient) applyRecoveryPointCreateRequest(c // BeginCreate - The operation to create an ASR replication protected item (Enable replication). // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Name of the fabric. -// protectionContainerName - Protection container name. -// replicatedProtectedItemName - A name for the replication protected item. -// input - Enable Protection Input. -// options - ReplicationProtectedItemsClientBeginCreateOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginCreate -// method. -func (client *ReplicationProtectedItemsClient) BeginCreate(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, input EnableProtectionInput, options *ReplicationProtectedItemsClientBeginCreateOptions) (*runtime.Poller[ReplicationProtectedItemsClientCreateResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Name of the fabric. +// - protectionContainerName - Protection container name. +// - replicatedProtectedItemName - A name for the replication protected item. +// - input - Enable Protection Input. +// - options - ReplicationProtectedItemsClientBeginCreateOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginCreate +// method. +func (client *ReplicationProtectedItemsClient) BeginCreate(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, input EnableProtectionInput, options *ReplicationProtectedItemsClientBeginCreateOptions) (*runtime.Poller[ReplicationProtectedItemsClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, input, options) + resp, err := client.create(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, input, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectedItemsClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectedItemsClientCreateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientCreateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Create - The operation to create an ASR replication protected item (Enable replication). // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectedItemsClient) create(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, input EnableProtectionInput, options *ReplicationProtectedItemsClientBeginCreateOptions) (*http.Response, error) { - req, err := client.createCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, input, options) +func (client *ReplicationProtectedItemsClient) create(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, input EnableProtectionInput, options *ReplicationProtectedItemsClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, input, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -255,16 +250,16 @@ func (client *ReplicationProtectedItemsClient) create(ctx context.Context, fabri } // createCreateRequest creates the Create request. -func (client *ReplicationProtectedItemsClient) createCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, input EnableProtectionInput, options *ReplicationProtectedItemsClientBeginCreateOptions) (*policy.Request, error) { +func (client *ReplicationProtectedItemsClient) createCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, input EnableProtectionInput, options *ReplicationProtectedItemsClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -281,7 +276,7 @@ func (client *ReplicationProtectedItemsClient) createCreateRequest(ctx context.C return nil, errors.New("parameter replicatedProtectedItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{replicatedProtectedItemName}", url.PathEscape(replicatedProtectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -294,34 +289,38 @@ func (client *ReplicationProtectedItemsClient) createCreateRequest(ctx context.C // BeginDelete - The operation to disable replication on a replication protected item. This will also remove the item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// replicatedProtectedItemName - Replication protected item name. -// disableProtectionInput - Disable protection input. -// options - ReplicationProtectedItemsClientBeginDeleteOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginDelete -// method. -func (client *ReplicationProtectedItemsClient) BeginDelete(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, disableProtectionInput DisableProtectionInput, options *ReplicationProtectedItemsClientBeginDeleteOptions) (*runtime.Poller[ReplicationProtectedItemsClientDeleteResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - replicatedProtectedItemName - Replication protected item name. +// - disableProtectionInput - Disable protection input. +// - options - ReplicationProtectedItemsClientBeginDeleteOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginDelete +// method. +func (client *ReplicationProtectedItemsClient) BeginDelete(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, disableProtectionInput DisableProtectionInput, options *ReplicationProtectedItemsClientBeginDeleteOptions) (*runtime.Poller[ReplicationProtectedItemsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, disableProtectionInput, options) + resp, err := client.deleteOperation(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, disableProtectionInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectedItemsClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectedItemsClientDeleteResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - The operation to disable replication on a replication protected item. This will also remove the item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectedItemsClient) deleteOperation(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, disableProtectionInput DisableProtectionInput, options *ReplicationProtectedItemsClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, disableProtectionInput, options) +func (client *ReplicationProtectedItemsClient) deleteOperation(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, disableProtectionInput DisableProtectionInput, options *ReplicationProtectedItemsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, disableProtectionInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -332,16 +331,16 @@ func (client *ReplicationProtectedItemsClient) deleteOperation(ctx context.Conte } // deleteCreateRequest creates the Delete request. -func (client *ReplicationProtectedItemsClient) deleteCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, disableProtectionInput DisableProtectionInput, options *ReplicationProtectedItemsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ReplicationProtectedItemsClient) deleteCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, disableProtectionInput DisableProtectionInput, options *ReplicationProtectedItemsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/remove" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -358,7 +357,7 @@ func (client *ReplicationProtectedItemsClient) deleteCreateRequest(ctx context.C return nil, errors.New("parameter replicatedProtectedItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{replicatedProtectedItemName}", url.PathEscape(replicatedProtectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -370,33 +369,37 @@ func (client *ReplicationProtectedItemsClient) deleteCreateRequest(ctx context.C // BeginFailoverCancel - Operation to cancel the failover of the replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Unique fabric name. -// protectionContainerName - Protection container name. -// replicatedProtectedItemName - Replication protected item name. -// options - ReplicationProtectedItemsClientBeginFailoverCancelOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginFailoverCancel -// method. -func (client *ReplicationProtectedItemsClient) BeginFailoverCancel(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginFailoverCancelOptions) (*runtime.Poller[ReplicationProtectedItemsClientFailoverCancelResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Unique fabric name. +// - protectionContainerName - Protection container name. +// - replicatedProtectedItemName - Replication protected item name. +// - options - ReplicationProtectedItemsClientBeginFailoverCancelOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginFailoverCancel +// method. +func (client *ReplicationProtectedItemsClient) BeginFailoverCancel(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginFailoverCancelOptions) (*runtime.Poller[ReplicationProtectedItemsClientFailoverCancelResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.failoverCancel(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, options) + resp, err := client.failoverCancel(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectedItemsClientFailoverCancelResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectedItemsClientFailoverCancelResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientFailoverCancelResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientFailoverCancelResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // FailoverCancel - Operation to cancel the failover of the replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectedItemsClient) failoverCancel(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginFailoverCancelOptions) (*http.Response, error) { - req, err := client.failoverCancelCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, options) +func (client *ReplicationProtectedItemsClient) failoverCancel(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginFailoverCancelOptions) (*http.Response, error) { + req, err := client.failoverCancelCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -407,16 +410,16 @@ func (client *ReplicationProtectedItemsClient) failoverCancel(ctx context.Contex } // failoverCancelCreateRequest creates the FailoverCancel request. -func (client *ReplicationProtectedItemsClient) failoverCancelCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginFailoverCancelOptions) (*policy.Request, error) { +func (client *ReplicationProtectedItemsClient) failoverCancelCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginFailoverCancelOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCancel" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -433,7 +436,7 @@ func (client *ReplicationProtectedItemsClient) failoverCancelCreateRequest(ctx c return nil, errors.New("parameter replicatedProtectedItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{replicatedProtectedItemName}", url.PathEscape(replicatedProtectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -446,33 +449,37 @@ func (client *ReplicationProtectedItemsClient) failoverCancelCreateRequest(ctx c // BeginFailoverCommit - Operation to commit the failover of the replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Unique fabric name. -// protectionContainerName - Protection container name. -// replicatedProtectedItemName - Replication protected item name. -// options - ReplicationProtectedItemsClientBeginFailoverCommitOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginFailoverCommit -// method. -func (client *ReplicationProtectedItemsClient) BeginFailoverCommit(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginFailoverCommitOptions) (*runtime.Poller[ReplicationProtectedItemsClientFailoverCommitResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Unique fabric name. +// - protectionContainerName - Protection container name. +// - replicatedProtectedItemName - Replication protected item name. +// - options - ReplicationProtectedItemsClientBeginFailoverCommitOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginFailoverCommit +// method. +func (client *ReplicationProtectedItemsClient) BeginFailoverCommit(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginFailoverCommitOptions) (*runtime.Poller[ReplicationProtectedItemsClientFailoverCommitResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.failoverCommit(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, options) + resp, err := client.failoverCommit(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectedItemsClientFailoverCommitResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectedItemsClientFailoverCommitResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientFailoverCommitResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientFailoverCommitResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // FailoverCommit - Operation to commit the failover of the replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectedItemsClient) failoverCommit(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginFailoverCommitOptions) (*http.Response, error) { - req, err := client.failoverCommitCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, options) +func (client *ReplicationProtectedItemsClient) failoverCommit(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginFailoverCommitOptions) (*http.Response, error) { + req, err := client.failoverCommitCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -483,16 +490,16 @@ func (client *ReplicationProtectedItemsClient) failoverCommit(ctx context.Contex } // failoverCommitCreateRequest creates the FailoverCommit request. -func (client *ReplicationProtectedItemsClient) failoverCommitCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginFailoverCommitOptions) (*policy.Request, error) { +func (client *ReplicationProtectedItemsClient) failoverCommitCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginFailoverCommitOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCommit" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -509,7 +516,7 @@ func (client *ReplicationProtectedItemsClient) failoverCommitCreateRequest(ctx c return nil, errors.New("parameter replicatedProtectedItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{replicatedProtectedItemName}", url.PathEscape(replicatedProtectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -522,18 +529,21 @@ func (client *ReplicationProtectedItemsClient) failoverCommitCreateRequest(ctx c // Get - Gets the details of an ASR replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric unique name. -// protectionContainerName - Protection container name. -// replicatedProtectedItemName - Replication protected item name. -// options - ReplicationProtectedItemsClientGetOptions contains the optional parameters for the ReplicationProtectedItemsClient.Get -// method. -func (client *ReplicationProtectedItemsClient) Get(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientGetOptions) (ReplicationProtectedItemsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric unique name. +// - protectionContainerName - Protection container name. +// - replicatedProtectedItemName - Replication protected item name. +// - options - ReplicationProtectedItemsClientGetOptions contains the optional parameters for the ReplicationProtectedItemsClient.Get +// method. +func (client *ReplicationProtectedItemsClient) Get(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientGetOptions) (ReplicationProtectedItemsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, options) if err != nil { return ReplicationProtectedItemsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationProtectedItemsClientGetResponse{}, err } @@ -544,16 +554,16 @@ func (client *ReplicationProtectedItemsClient) Get(ctx context.Context, fabricNa } // getCreateRequest creates the Get request. -func (client *ReplicationProtectedItemsClient) getCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientGetOptions) (*policy.Request, error) { +func (client *ReplicationProtectedItemsClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -570,7 +580,7 @@ func (client *ReplicationProtectedItemsClient) getCreateRequest(ctx context.Cont return nil, errors.New("parameter replicatedProtectedItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{replicatedProtectedItemName}", url.PathEscape(replicatedProtectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -591,10 +601,13 @@ func (client *ReplicationProtectedItemsClient) getHandleResponse(resp *http.Resp } // NewListPager - Gets the list of ASR replication protected items in the vault. +// // Generated from API version 2022-10-01 -// options - ReplicationProtectedItemsClientListOptions contains the optional parameters for the ReplicationProtectedItemsClient.List -// method. -func (client *ReplicationProtectedItemsClient) NewListPager(options *ReplicationProtectedItemsClientListOptions) *runtime.Pager[ReplicationProtectedItemsClientListResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - ReplicationProtectedItemsClientListOptions contains the optional parameters for the ReplicationProtectedItemsClient.NewListPager +// method. +func (client *ReplicationProtectedItemsClient) NewListPager(resourceName string, resourceGroupName string, options *ReplicationProtectedItemsClientListOptions) *runtime.Pager[ReplicationProtectedItemsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationProtectedItemsClientListResponse]{ More: func(page ReplicationProtectedItemsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -603,14 +616,14 @@ func (client *ReplicationProtectedItemsClient) NewListPager(options *Replication var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, resourceName, resourceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationProtectedItemsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationProtectedItemsClientListResponse{}, err } @@ -623,21 +636,21 @@ func (client *ReplicationProtectedItemsClient) NewListPager(options *Replication } // listCreateRequest creates the List request. -func (client *ReplicationProtectedItemsClient) listCreateRequest(ctx context.Context, options *ReplicationProtectedItemsClientListOptions) (*policy.Request, error) { +func (client *ReplicationProtectedItemsClient) listCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationProtectedItemsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectedItems" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -664,12 +677,15 @@ func (client *ReplicationProtectedItemsClient) listHandleResponse(resp *http.Res } // NewListByReplicationProtectionContainersPager - Gets the list of ASR replication protected items in the protection container. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// options - ReplicationProtectedItemsClientListByReplicationProtectionContainersOptions contains the optional parameters -// for the ReplicationProtectedItemsClient.ListByReplicationProtectionContainers method. -func (client *ReplicationProtectedItemsClient) NewListByReplicationProtectionContainersPager(fabricName string, protectionContainerName string, options *ReplicationProtectedItemsClientListByReplicationProtectionContainersOptions) *runtime.Pager[ReplicationProtectedItemsClientListByReplicationProtectionContainersResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - options - ReplicationProtectedItemsClientListByReplicationProtectionContainersOptions contains the optional parameters +// for the ReplicationProtectedItemsClient.NewListByReplicationProtectionContainersPager method. +func (client *ReplicationProtectedItemsClient) NewListByReplicationProtectionContainersPager(resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, options *ReplicationProtectedItemsClientListByReplicationProtectionContainersOptions) *runtime.Pager[ReplicationProtectedItemsClientListByReplicationProtectionContainersResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationProtectedItemsClientListByReplicationProtectionContainersResponse]{ More: func(page ReplicationProtectedItemsClientListByReplicationProtectionContainersResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -678,14 +694,14 @@ func (client *ReplicationProtectedItemsClient) NewListByReplicationProtectionCon var req *policy.Request var err error if page == nil { - req, err = client.listByReplicationProtectionContainersCreateRequest(ctx, fabricName, protectionContainerName, options) + req, err = client.listByReplicationProtectionContainersCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationProtectedItemsClientListByReplicationProtectionContainersResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationProtectedItemsClientListByReplicationProtectionContainersResponse{}, err } @@ -698,16 +714,16 @@ func (client *ReplicationProtectedItemsClient) NewListByReplicationProtectionCon } // listByReplicationProtectionContainersCreateRequest creates the ListByReplicationProtectionContainers request. -func (client *ReplicationProtectedItemsClient) listByReplicationProtectionContainersCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, options *ReplicationProtectedItemsClientListByReplicationProtectionContainersOptions) (*policy.Request, error) { +func (client *ReplicationProtectedItemsClient) listByReplicationProtectionContainersCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, options *ReplicationProtectedItemsClientListByReplicationProtectionContainersOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -720,7 +736,7 @@ func (client *ReplicationProtectedItemsClient) listByReplicationProtectionContai return nil, errors.New("parameter protectionContainerName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{protectionContainerName}", url.PathEscape(protectionContainerName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -742,34 +758,38 @@ func (client *ReplicationProtectedItemsClient) listByReplicationProtectionContai // BeginPlannedFailover - Operation to initiate a planned failover of the replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Unique fabric name. -// protectionContainerName - Protection container name. -// replicatedProtectedItemName - Replication protected item name. -// failoverInput - Planned failover input. -// options - ReplicationProtectedItemsClientBeginPlannedFailoverOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginPlannedFailover -// method. -func (client *ReplicationProtectedItemsClient) BeginPlannedFailover(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, failoverInput PlannedFailoverInput, options *ReplicationProtectedItemsClientBeginPlannedFailoverOptions) (*runtime.Poller[ReplicationProtectedItemsClientPlannedFailoverResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Unique fabric name. +// - protectionContainerName - Protection container name. +// - replicatedProtectedItemName - Replication protected item name. +// - failoverInput - Planned failover input. +// - options - ReplicationProtectedItemsClientBeginPlannedFailoverOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginPlannedFailover +// method. +func (client *ReplicationProtectedItemsClient) BeginPlannedFailover(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, failoverInput PlannedFailoverInput, options *ReplicationProtectedItemsClientBeginPlannedFailoverOptions) (*runtime.Poller[ReplicationProtectedItemsClientPlannedFailoverResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.plannedFailover(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, failoverInput, options) + resp, err := client.plannedFailover(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, failoverInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectedItemsClientPlannedFailoverResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectedItemsClientPlannedFailoverResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientPlannedFailoverResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientPlannedFailoverResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // PlannedFailover - Operation to initiate a planned failover of the replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectedItemsClient) plannedFailover(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, failoverInput PlannedFailoverInput, options *ReplicationProtectedItemsClientBeginPlannedFailoverOptions) (*http.Response, error) { - req, err := client.plannedFailoverCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, failoverInput, options) +func (client *ReplicationProtectedItemsClient) plannedFailover(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, failoverInput PlannedFailoverInput, options *ReplicationProtectedItemsClientBeginPlannedFailoverOptions) (*http.Response, error) { + req, err := client.plannedFailoverCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, failoverInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -780,16 +800,16 @@ func (client *ReplicationProtectedItemsClient) plannedFailover(ctx context.Conte } // plannedFailoverCreateRequest creates the PlannedFailover request. -func (client *ReplicationProtectedItemsClient) plannedFailoverCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, failoverInput PlannedFailoverInput, options *ReplicationProtectedItemsClientBeginPlannedFailoverOptions) (*policy.Request, error) { +func (client *ReplicationProtectedItemsClient) plannedFailoverCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, failoverInput PlannedFailoverInput, options *ReplicationProtectedItemsClientBeginPlannedFailoverOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/plannedFailover" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -806,7 +826,7 @@ func (client *ReplicationProtectedItemsClient) plannedFailoverCreateRequest(ctx return nil, errors.New("parameter replicatedProtectedItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{replicatedProtectedItemName}", url.PathEscape(replicatedProtectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -821,21 +841,24 @@ func (client *ReplicationProtectedItemsClient) plannedFailoverCreateRequest(ctx // protected item. Use the remove operation on replication protected item to perform a // clean disable replication for the item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// replicatedProtectedItemName - Replication protected item name. -// options - ReplicationProtectedItemsClientBeginPurgeOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginPurge -// method. -func (client *ReplicationProtectedItemsClient) BeginPurge(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginPurgeOptions) (*runtime.Poller[ReplicationProtectedItemsClientPurgeResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - replicatedProtectedItemName - Replication protected item name. +// - options - ReplicationProtectedItemsClientBeginPurgeOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginPurge +// method. +func (client *ReplicationProtectedItemsClient) BeginPurge(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginPurgeOptions) (*runtime.Poller[ReplicationProtectedItemsClientPurgeResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.purge(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, options) + resp, err := client.purge(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectedItemsClientPurgeResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectedItemsClientPurgeResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientPurgeResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientPurgeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } @@ -843,13 +866,14 @@ func (client *ReplicationProtectedItemsClient) BeginPurge(ctx context.Context, f // protected item. Use the remove operation on replication protected item to perform a // clean disable replication for the item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectedItemsClient) purge(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginPurgeOptions) (*http.Response, error) { - req, err := client.purgeCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, options) +func (client *ReplicationProtectedItemsClient) purge(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginPurgeOptions) (*http.Response, error) { + req, err := client.purgeCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -860,16 +884,16 @@ func (client *ReplicationProtectedItemsClient) purge(ctx context.Context, fabric } // purgeCreateRequest creates the Purge request. -func (client *ReplicationProtectedItemsClient) purgeCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginPurgeOptions) (*policy.Request, error) { +func (client *ReplicationProtectedItemsClient) purgeCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginPurgeOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -886,7 +910,7 @@ func (client *ReplicationProtectedItemsClient) purgeCreateRequest(ctx context.Co return nil, errors.New("parameter replicatedProtectedItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{replicatedProtectedItemName}", url.PathEscape(replicatedProtectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -898,34 +922,38 @@ func (client *ReplicationProtectedItemsClient) purgeCreateRequest(ctx context.Co // BeginRemoveDisks - Operation to remove disk(s) from the replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Unique fabric name. -// protectionContainerName - Protection container name. -// replicatedProtectedItemName - Replication protected item name. -// removeDisksInput - Remove disks input. -// options - ReplicationProtectedItemsClientBeginRemoveDisksOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginRemoveDisks -// method. -func (client *ReplicationProtectedItemsClient) BeginRemoveDisks(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, removeDisksInput RemoveDisksInput, options *ReplicationProtectedItemsClientBeginRemoveDisksOptions) (*runtime.Poller[ReplicationProtectedItemsClientRemoveDisksResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Unique fabric name. +// - protectionContainerName - Protection container name. +// - replicatedProtectedItemName - Replication protected item name. +// - removeDisksInput - Remove disks input. +// - options - ReplicationProtectedItemsClientBeginRemoveDisksOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginRemoveDisks +// method. +func (client *ReplicationProtectedItemsClient) BeginRemoveDisks(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, removeDisksInput RemoveDisksInput, options *ReplicationProtectedItemsClientBeginRemoveDisksOptions) (*runtime.Poller[ReplicationProtectedItemsClientRemoveDisksResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.removeDisks(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, removeDisksInput, options) + resp, err := client.removeDisks(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, removeDisksInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectedItemsClientRemoveDisksResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectedItemsClientRemoveDisksResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientRemoveDisksResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientRemoveDisksResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // RemoveDisks - Operation to remove disk(s) from the replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectedItemsClient) removeDisks(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, removeDisksInput RemoveDisksInput, options *ReplicationProtectedItemsClientBeginRemoveDisksOptions) (*http.Response, error) { - req, err := client.removeDisksCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, removeDisksInput, options) +func (client *ReplicationProtectedItemsClient) removeDisks(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, removeDisksInput RemoveDisksInput, options *ReplicationProtectedItemsClientBeginRemoveDisksOptions) (*http.Response, error) { + req, err := client.removeDisksCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, removeDisksInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -936,16 +964,16 @@ func (client *ReplicationProtectedItemsClient) removeDisks(ctx context.Context, } // removeDisksCreateRequest creates the RemoveDisks request. -func (client *ReplicationProtectedItemsClient) removeDisksCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, removeDisksInput RemoveDisksInput, options *ReplicationProtectedItemsClientBeginRemoveDisksOptions) (*policy.Request, error) { +func (client *ReplicationProtectedItemsClient) removeDisksCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, removeDisksInput RemoveDisksInput, options *ReplicationProtectedItemsClientBeginRemoveDisksOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/removeDisks" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -962,7 +990,7 @@ func (client *ReplicationProtectedItemsClient) removeDisksCreateRequest(ctx cont return nil, errors.New("parameter replicatedProtectedItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{replicatedProtectedItemName}", url.PathEscape(replicatedProtectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -976,34 +1004,38 @@ func (client *ReplicationProtectedItemsClient) removeDisksCreateRequest(ctx cont // BeginRepairReplication - The operation to start resynchronize/repair replication for a replication protected item requiring // resynchronization. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - The name of the fabric. -// protectionContainerName - The name of the container. -// replicatedProtectedItemName - The name of the replication protected item. -// options - ReplicationProtectedItemsClientBeginRepairReplicationOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginRepairReplication -// method. -func (client *ReplicationProtectedItemsClient) BeginRepairReplication(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginRepairReplicationOptions) (*runtime.Poller[ReplicationProtectedItemsClientRepairReplicationResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - The name of the fabric. +// - protectionContainerName - The name of the container. +// - replicatedProtectedItemName - The name of the replication protected item. +// - options - ReplicationProtectedItemsClientBeginRepairReplicationOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginRepairReplication +// method. +func (client *ReplicationProtectedItemsClient) BeginRepairReplication(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginRepairReplicationOptions) (*runtime.Poller[ReplicationProtectedItemsClientRepairReplicationResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.repairReplication(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, options) + resp, err := client.repairReplication(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectedItemsClientRepairReplicationResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectedItemsClientRepairReplicationResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientRepairReplicationResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientRepairReplicationResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // RepairReplication - The operation to start resynchronize/repair replication for a replication protected item requiring // resynchronization. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectedItemsClient) repairReplication(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginRepairReplicationOptions) (*http.Response, error) { - req, err := client.repairReplicationCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, options) +func (client *ReplicationProtectedItemsClient) repairReplication(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginRepairReplicationOptions) (*http.Response, error) { + req, err := client.repairReplicationCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -1014,16 +1046,16 @@ func (client *ReplicationProtectedItemsClient) repairReplication(ctx context.Con } // repairReplicationCreateRequest creates the RepairReplication request. -func (client *ReplicationProtectedItemsClient) repairReplicationCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginRepairReplicationOptions) (*policy.Request, error) { +func (client *ReplicationProtectedItemsClient) repairReplicationCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *ReplicationProtectedItemsClientBeginRepairReplicationOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/repairReplication" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -1040,7 +1072,7 @@ func (client *ReplicationProtectedItemsClient) repairReplicationCreateRequest(ct return nil, errors.New("parameter replicatedProtectedItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{replicatedProtectedItemName}", url.PathEscape(replicatedProtectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -1053,34 +1085,38 @@ func (client *ReplicationProtectedItemsClient) repairReplicationCreateRequest(ct // BeginReprotect - Operation to reprotect or reverse replicate a failed over replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Unique fabric name. -// protectionContainerName - Protection container name. -// replicatedProtectedItemName - Replication protected item name. -// reprotectInput - Reverse replication input. -// options - ReplicationProtectedItemsClientBeginReprotectOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginReprotect -// method. -func (client *ReplicationProtectedItemsClient) BeginReprotect(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, reprotectInput ReverseReplicationInput, options *ReplicationProtectedItemsClientBeginReprotectOptions) (*runtime.Poller[ReplicationProtectedItemsClientReprotectResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Unique fabric name. +// - protectionContainerName - Protection container name. +// - replicatedProtectedItemName - Replication protected item name. +// - reprotectInput - Reverse replication input. +// - options - ReplicationProtectedItemsClientBeginReprotectOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginReprotect +// method. +func (client *ReplicationProtectedItemsClient) BeginReprotect(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, reprotectInput ReverseReplicationInput, options *ReplicationProtectedItemsClientBeginReprotectOptions) (*runtime.Poller[ReplicationProtectedItemsClientReprotectResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.reprotect(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, reprotectInput, options) + resp, err := client.reprotect(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, reprotectInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectedItemsClientReprotectResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectedItemsClientReprotectResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientReprotectResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientReprotectResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Reprotect - Operation to reprotect or reverse replicate a failed over replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectedItemsClient) reprotect(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, reprotectInput ReverseReplicationInput, options *ReplicationProtectedItemsClientBeginReprotectOptions) (*http.Response, error) { - req, err := client.reprotectCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, reprotectInput, options) +func (client *ReplicationProtectedItemsClient) reprotect(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, reprotectInput ReverseReplicationInput, options *ReplicationProtectedItemsClientBeginReprotectOptions) (*http.Response, error) { + req, err := client.reprotectCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, reprotectInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -1091,16 +1127,16 @@ func (client *ReplicationProtectedItemsClient) reprotect(ctx context.Context, fa } // reprotectCreateRequest creates the Reprotect request. -func (client *ReplicationProtectedItemsClient) reprotectCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, reprotectInput ReverseReplicationInput, options *ReplicationProtectedItemsClientBeginReprotectOptions) (*policy.Request, error) { +func (client *ReplicationProtectedItemsClient) reprotectCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, reprotectInput ReverseReplicationInput, options *ReplicationProtectedItemsClientBeginReprotectOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/reProtect" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -1117,7 +1153,7 @@ func (client *ReplicationProtectedItemsClient) reprotectCreateRequest(ctx contex return nil, errors.New("parameter replicatedProtectedItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{replicatedProtectedItemName}", url.PathEscape(replicatedProtectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -1130,34 +1166,38 @@ func (client *ReplicationProtectedItemsClient) reprotectCreateRequest(ctx contex // BeginResolveHealthErrors - Operation to resolve health issues of the replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Unique fabric name. -// protectionContainerName - Protection container name. -// replicatedProtectedItemName - Replication protected item name. -// resolveHealthInput - Health issue input object. -// options - ReplicationProtectedItemsClientBeginResolveHealthErrorsOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginResolveHealthErrors -// method. -func (client *ReplicationProtectedItemsClient) BeginResolveHealthErrors(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, resolveHealthInput ResolveHealthInput, options *ReplicationProtectedItemsClientBeginResolveHealthErrorsOptions) (*runtime.Poller[ReplicationProtectedItemsClientResolveHealthErrorsResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Unique fabric name. +// - protectionContainerName - Protection container name. +// - replicatedProtectedItemName - Replication protected item name. +// - resolveHealthInput - Health issue input object. +// - options - ReplicationProtectedItemsClientBeginResolveHealthErrorsOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginResolveHealthErrors +// method. +func (client *ReplicationProtectedItemsClient) BeginResolveHealthErrors(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, resolveHealthInput ResolveHealthInput, options *ReplicationProtectedItemsClientBeginResolveHealthErrorsOptions) (*runtime.Poller[ReplicationProtectedItemsClientResolveHealthErrorsResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.resolveHealthErrors(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, resolveHealthInput, options) + resp, err := client.resolveHealthErrors(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, resolveHealthInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectedItemsClientResolveHealthErrorsResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectedItemsClientResolveHealthErrorsResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientResolveHealthErrorsResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientResolveHealthErrorsResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // ResolveHealthErrors - Operation to resolve health issues of the replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectedItemsClient) resolveHealthErrors(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, resolveHealthInput ResolveHealthInput, options *ReplicationProtectedItemsClientBeginResolveHealthErrorsOptions) (*http.Response, error) { - req, err := client.resolveHealthErrorsCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, resolveHealthInput, options) +func (client *ReplicationProtectedItemsClient) resolveHealthErrors(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, resolveHealthInput ResolveHealthInput, options *ReplicationProtectedItemsClientBeginResolveHealthErrorsOptions) (*http.Response, error) { + req, err := client.resolveHealthErrorsCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, resolveHealthInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -1168,16 +1208,16 @@ func (client *ReplicationProtectedItemsClient) resolveHealthErrors(ctx context.C } // resolveHealthErrorsCreateRequest creates the ResolveHealthErrors request. -func (client *ReplicationProtectedItemsClient) resolveHealthErrorsCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, resolveHealthInput ResolveHealthInput, options *ReplicationProtectedItemsClientBeginResolveHealthErrorsOptions) (*policy.Request, error) { +func (client *ReplicationProtectedItemsClient) resolveHealthErrorsCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, resolveHealthInput ResolveHealthInput, options *ReplicationProtectedItemsClientBeginResolveHealthErrorsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/resolveHealthErrors" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -1194,7 +1234,7 @@ func (client *ReplicationProtectedItemsClient) resolveHealthErrorsCreateRequest( return nil, errors.New("parameter replicatedProtectedItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{replicatedProtectedItemName}", url.PathEscape(replicatedProtectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -1207,36 +1247,40 @@ func (client *ReplicationProtectedItemsClient) resolveHealthErrorsCreateRequest( // BeginSwitchProvider - Operation to initiate a switch provider of the replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Unique fabric name. -// protectionContainerName - Protection container name. -// replicatedProtectedItemName - Replication protected item name. -// switchProviderInput - Switch provider input. -// options - ReplicationProtectedItemsClientBeginSwitchProviderOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginSwitchProvider -// method. -func (client *ReplicationProtectedItemsClient) BeginSwitchProvider(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, switchProviderInput SwitchProviderInput, options *ReplicationProtectedItemsClientBeginSwitchProviderOptions) (*runtime.Poller[ReplicationProtectedItemsClientSwitchProviderResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Unique fabric name. +// - protectionContainerName - Protection container name. +// - replicatedProtectedItemName - Replication protected item name. +// - switchProviderInput - Switch provider input. +// - options - ReplicationProtectedItemsClientBeginSwitchProviderOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginSwitchProvider +// method. +func (client *ReplicationProtectedItemsClient) BeginSwitchProvider(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, switchProviderInput SwitchProviderInput, options *ReplicationProtectedItemsClientBeginSwitchProviderOptions) (*runtime.Poller[ReplicationProtectedItemsClientSwitchProviderResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.switchProvider(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, switchProviderInput, options) + resp, err := client.switchProvider(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, switchProviderInput, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ReplicationProtectedItemsClientSwitchProviderResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicationProtectedItemsClientSwitchProviderResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientSwitchProviderResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientSwitchProviderResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // SwitchProvider - Operation to initiate a switch provider of the replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectedItemsClient) switchProvider(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, switchProviderInput SwitchProviderInput, options *ReplicationProtectedItemsClientBeginSwitchProviderOptions) (*http.Response, error) { - req, err := client.switchProviderCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, switchProviderInput, options) +func (client *ReplicationProtectedItemsClient) switchProvider(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, switchProviderInput SwitchProviderInput, options *ReplicationProtectedItemsClientBeginSwitchProviderOptions) (*http.Response, error) { + req, err := client.switchProviderCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, switchProviderInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -1247,16 +1291,16 @@ func (client *ReplicationProtectedItemsClient) switchProvider(ctx context.Contex } // switchProviderCreateRequest creates the SwitchProvider request. -func (client *ReplicationProtectedItemsClient) switchProviderCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, switchProviderInput SwitchProviderInput, options *ReplicationProtectedItemsClientBeginSwitchProviderOptions) (*policy.Request, error) { +func (client *ReplicationProtectedItemsClient) switchProviderCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, switchProviderInput SwitchProviderInput, options *ReplicationProtectedItemsClientBeginSwitchProviderOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/switchProvider" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -1273,7 +1317,7 @@ func (client *ReplicationProtectedItemsClient) switchProviderCreateRequest(ctx c return nil, errors.New("parameter replicatedProtectedItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{replicatedProtectedItemName}", url.PathEscape(replicatedProtectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -1286,34 +1330,38 @@ func (client *ReplicationProtectedItemsClient) switchProviderCreateRequest(ctx c // BeginTestFailover - Operation to perform a test failover of the replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Unique fabric name. -// protectionContainerName - Protection container name. -// replicatedProtectedItemName - Replication protected item name. -// testfailoverInput - Test failover input. -// options - ReplicationProtectedItemsClientBeginTestFailoverOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginTestFailover -// method. -func (client *ReplicationProtectedItemsClient) BeginTestFailover(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, testfailoverInput TestFailoverInput, options *ReplicationProtectedItemsClientBeginTestFailoverOptions) (*runtime.Poller[ReplicationProtectedItemsClientTestFailoverResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Unique fabric name. +// - protectionContainerName - Protection container name. +// - replicatedProtectedItemName - Replication protected item name. +// - testfailoverInput - Test failover input. +// - options - ReplicationProtectedItemsClientBeginTestFailoverOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginTestFailover +// method. +func (client *ReplicationProtectedItemsClient) BeginTestFailover(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, testfailoverInput TestFailoverInput, options *ReplicationProtectedItemsClientBeginTestFailoverOptions) (*runtime.Poller[ReplicationProtectedItemsClientTestFailoverResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.testFailover(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, testfailoverInput, options) + resp, err := client.testFailover(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, testfailoverInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectedItemsClientTestFailoverResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectedItemsClientTestFailoverResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientTestFailoverResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientTestFailoverResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // TestFailover - Operation to perform a test failover of the replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectedItemsClient) testFailover(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, testfailoverInput TestFailoverInput, options *ReplicationProtectedItemsClientBeginTestFailoverOptions) (*http.Response, error) { - req, err := client.testFailoverCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, testfailoverInput, options) +func (client *ReplicationProtectedItemsClient) testFailover(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, testfailoverInput TestFailoverInput, options *ReplicationProtectedItemsClientBeginTestFailoverOptions) (*http.Response, error) { + req, err := client.testFailoverCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, testfailoverInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -1324,16 +1372,16 @@ func (client *ReplicationProtectedItemsClient) testFailover(ctx context.Context, } // testFailoverCreateRequest creates the TestFailover request. -func (client *ReplicationProtectedItemsClient) testFailoverCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, testfailoverInput TestFailoverInput, options *ReplicationProtectedItemsClientBeginTestFailoverOptions) (*policy.Request, error) { +func (client *ReplicationProtectedItemsClient) testFailoverCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, testfailoverInput TestFailoverInput, options *ReplicationProtectedItemsClientBeginTestFailoverOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailover" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -1350,7 +1398,7 @@ func (client *ReplicationProtectedItemsClient) testFailoverCreateRequest(ctx con return nil, errors.New("parameter replicatedProtectedItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{replicatedProtectedItemName}", url.PathEscape(replicatedProtectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -1363,34 +1411,38 @@ func (client *ReplicationProtectedItemsClient) testFailoverCreateRequest(ctx con // BeginTestFailoverCleanup - Operation to clean up the test failover of a replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Unique fabric name. -// protectionContainerName - Protection container name. -// replicatedProtectedItemName - Replication protected item name. -// cleanupInput - Test failover cleanup input. -// options - ReplicationProtectedItemsClientBeginTestFailoverCleanupOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginTestFailoverCleanup -// method. -func (client *ReplicationProtectedItemsClient) BeginTestFailoverCleanup(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, cleanupInput TestFailoverCleanupInput, options *ReplicationProtectedItemsClientBeginTestFailoverCleanupOptions) (*runtime.Poller[ReplicationProtectedItemsClientTestFailoverCleanupResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Unique fabric name. +// - protectionContainerName - Protection container name. +// - replicatedProtectedItemName - Replication protected item name. +// - cleanupInput - Test failover cleanup input. +// - options - ReplicationProtectedItemsClientBeginTestFailoverCleanupOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginTestFailoverCleanup +// method. +func (client *ReplicationProtectedItemsClient) BeginTestFailoverCleanup(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, cleanupInput TestFailoverCleanupInput, options *ReplicationProtectedItemsClientBeginTestFailoverCleanupOptions) (*runtime.Poller[ReplicationProtectedItemsClientTestFailoverCleanupResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.testFailoverCleanup(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, cleanupInput, options) + resp, err := client.testFailoverCleanup(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, cleanupInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectedItemsClientTestFailoverCleanupResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectedItemsClientTestFailoverCleanupResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientTestFailoverCleanupResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientTestFailoverCleanupResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // TestFailoverCleanup - Operation to clean up the test failover of a replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectedItemsClient) testFailoverCleanup(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, cleanupInput TestFailoverCleanupInput, options *ReplicationProtectedItemsClientBeginTestFailoverCleanupOptions) (*http.Response, error) { - req, err := client.testFailoverCleanupCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, cleanupInput, options) +func (client *ReplicationProtectedItemsClient) testFailoverCleanup(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, cleanupInput TestFailoverCleanupInput, options *ReplicationProtectedItemsClientBeginTestFailoverCleanupOptions) (*http.Response, error) { + req, err := client.testFailoverCleanupCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, cleanupInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -1401,16 +1453,16 @@ func (client *ReplicationProtectedItemsClient) testFailoverCleanup(ctx context.C } // testFailoverCleanupCreateRequest creates the TestFailoverCleanup request. -func (client *ReplicationProtectedItemsClient) testFailoverCleanupCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, cleanupInput TestFailoverCleanupInput, options *ReplicationProtectedItemsClientBeginTestFailoverCleanupOptions) (*policy.Request, error) { +func (client *ReplicationProtectedItemsClient) testFailoverCleanupCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, cleanupInput TestFailoverCleanupInput, options *ReplicationProtectedItemsClientBeginTestFailoverCleanupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailoverCleanup" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -1427,7 +1479,7 @@ func (client *ReplicationProtectedItemsClient) testFailoverCleanupCreateRequest( return nil, errors.New("parameter replicatedProtectedItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{replicatedProtectedItemName}", url.PathEscape(replicatedProtectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -1440,34 +1492,38 @@ func (client *ReplicationProtectedItemsClient) testFailoverCleanupCreateRequest( // BeginUnplannedFailover - Operation to initiate a failover of the replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Unique fabric name. -// protectionContainerName - Protection container name. -// replicatedProtectedItemName - Replication protected item name. -// failoverInput - Failover input. -// options - ReplicationProtectedItemsClientBeginUnplannedFailoverOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginUnplannedFailover -// method. -func (client *ReplicationProtectedItemsClient) BeginUnplannedFailover(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, failoverInput UnplannedFailoverInput, options *ReplicationProtectedItemsClientBeginUnplannedFailoverOptions) (*runtime.Poller[ReplicationProtectedItemsClientUnplannedFailoverResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Unique fabric name. +// - protectionContainerName - Protection container name. +// - replicatedProtectedItemName - Replication protected item name. +// - failoverInput - Failover input. +// - options - ReplicationProtectedItemsClientBeginUnplannedFailoverOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginUnplannedFailover +// method. +func (client *ReplicationProtectedItemsClient) BeginUnplannedFailover(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, failoverInput UnplannedFailoverInput, options *ReplicationProtectedItemsClientBeginUnplannedFailoverOptions) (*runtime.Poller[ReplicationProtectedItemsClientUnplannedFailoverResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.unplannedFailover(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, failoverInput, options) + resp, err := client.unplannedFailover(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, failoverInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectedItemsClientUnplannedFailoverResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectedItemsClientUnplannedFailoverResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientUnplannedFailoverResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientUnplannedFailoverResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // UnplannedFailover - Operation to initiate a failover of the replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectedItemsClient) unplannedFailover(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, failoverInput UnplannedFailoverInput, options *ReplicationProtectedItemsClientBeginUnplannedFailoverOptions) (*http.Response, error) { - req, err := client.unplannedFailoverCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, failoverInput, options) +func (client *ReplicationProtectedItemsClient) unplannedFailover(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, failoverInput UnplannedFailoverInput, options *ReplicationProtectedItemsClientBeginUnplannedFailoverOptions) (*http.Response, error) { + req, err := client.unplannedFailoverCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, failoverInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -1478,16 +1534,16 @@ func (client *ReplicationProtectedItemsClient) unplannedFailover(ctx context.Con } // unplannedFailoverCreateRequest creates the UnplannedFailover request. -func (client *ReplicationProtectedItemsClient) unplannedFailoverCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, failoverInput UnplannedFailoverInput, options *ReplicationProtectedItemsClientBeginUnplannedFailoverOptions) (*policy.Request, error) { +func (client *ReplicationProtectedItemsClient) unplannedFailoverCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, failoverInput UnplannedFailoverInput, options *ReplicationProtectedItemsClientBeginUnplannedFailoverOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/unplannedFailover" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -1504,7 +1560,7 @@ func (client *ReplicationProtectedItemsClient) unplannedFailoverCreateRequest(ct return nil, errors.New("parameter replicatedProtectedItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{replicatedProtectedItemName}", url.PathEscape(replicatedProtectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -1517,34 +1573,38 @@ func (client *ReplicationProtectedItemsClient) unplannedFailoverCreateRequest(ct // BeginUpdate - The operation to update the recovery settings of an ASR replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// replicatedProtectedItemName - Replication protected item name. -// updateProtectionInput - Update protection input. -// options - ReplicationProtectedItemsClientBeginUpdateOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginUpdate -// method. -func (client *ReplicationProtectedItemsClient) BeginUpdate(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, updateProtectionInput UpdateReplicationProtectedItemInput, options *ReplicationProtectedItemsClientBeginUpdateOptions) (*runtime.Poller[ReplicationProtectedItemsClientUpdateResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - replicatedProtectedItemName - Replication protected item name. +// - updateProtectionInput - Update protection input. +// - options - ReplicationProtectedItemsClientBeginUpdateOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginUpdate +// method. +func (client *ReplicationProtectedItemsClient) BeginUpdate(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, updateProtectionInput UpdateReplicationProtectedItemInput, options *ReplicationProtectedItemsClientBeginUpdateOptions) (*runtime.Poller[ReplicationProtectedItemsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, updateProtectionInput, options) + resp, err := client.update(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, updateProtectionInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectedItemsClientUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectedItemsClientUpdateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Update - The operation to update the recovery settings of an ASR replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectedItemsClient) update(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, updateProtectionInput UpdateReplicationProtectedItemInput, options *ReplicationProtectedItemsClientBeginUpdateOptions) (*http.Response, error) { - req, err := client.updateCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, updateProtectionInput, options) +func (client *ReplicationProtectedItemsClient) update(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, updateProtectionInput UpdateReplicationProtectedItemInput, options *ReplicationProtectedItemsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, updateProtectionInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -1555,16 +1615,16 @@ func (client *ReplicationProtectedItemsClient) update(ctx context.Context, fabri } // updateCreateRequest creates the Update request. -func (client *ReplicationProtectedItemsClient) updateCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, updateProtectionInput UpdateReplicationProtectedItemInput, options *ReplicationProtectedItemsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *ReplicationProtectedItemsClient) updateCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, updateProtectionInput UpdateReplicationProtectedItemInput, options *ReplicationProtectedItemsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -1581,7 +1641,7 @@ func (client *ReplicationProtectedItemsClient) updateCreateRequest(ctx context.C return nil, errors.New("parameter replicatedProtectedItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{replicatedProtectedItemName}", url.PathEscape(replicatedProtectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -1594,34 +1654,38 @@ func (client *ReplicationProtectedItemsClient) updateCreateRequest(ctx context.C // BeginUpdateAppliance - The operation to update appliance of an ASR replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// replicatedProtectedItemName - Replication protected item name. -// applianceUpdateInput - Appliance update protection input. -// options - ReplicationProtectedItemsClientBeginUpdateApplianceOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginUpdateAppliance -// method. -func (client *ReplicationProtectedItemsClient) BeginUpdateAppliance(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, applianceUpdateInput UpdateApplianceForReplicationProtectedItemInput, options *ReplicationProtectedItemsClientBeginUpdateApplianceOptions) (*runtime.Poller[ReplicationProtectedItemsClientUpdateApplianceResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - replicatedProtectedItemName - Replication protected item name. +// - applianceUpdateInput - Appliance update protection input. +// - options - ReplicationProtectedItemsClientBeginUpdateApplianceOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginUpdateAppliance +// method. +func (client *ReplicationProtectedItemsClient) BeginUpdateAppliance(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, applianceUpdateInput UpdateApplianceForReplicationProtectedItemInput, options *ReplicationProtectedItemsClientBeginUpdateApplianceOptions) (*runtime.Poller[ReplicationProtectedItemsClientUpdateApplianceResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.updateAppliance(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, applianceUpdateInput, options) + resp, err := client.updateAppliance(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, applianceUpdateInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectedItemsClientUpdateApplianceResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectedItemsClientUpdateApplianceResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientUpdateApplianceResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientUpdateApplianceResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // UpdateAppliance - The operation to update appliance of an ASR replication protected item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectedItemsClient) updateAppliance(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, applianceUpdateInput UpdateApplianceForReplicationProtectedItemInput, options *ReplicationProtectedItemsClientBeginUpdateApplianceOptions) (*http.Response, error) { - req, err := client.updateApplianceCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, applianceUpdateInput, options) +func (client *ReplicationProtectedItemsClient) updateAppliance(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, applianceUpdateInput UpdateApplianceForReplicationProtectedItemInput, options *ReplicationProtectedItemsClientBeginUpdateApplianceOptions) (*http.Response, error) { + req, err := client.updateApplianceCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, applianceUpdateInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -1632,16 +1696,16 @@ func (client *ReplicationProtectedItemsClient) updateAppliance(ctx context.Conte } // updateApplianceCreateRequest creates the UpdateAppliance request. -func (client *ReplicationProtectedItemsClient) updateApplianceCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, applianceUpdateInput UpdateApplianceForReplicationProtectedItemInput, options *ReplicationProtectedItemsClientBeginUpdateApplianceOptions) (*policy.Request, error) { +func (client *ReplicationProtectedItemsClient) updateApplianceCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, applianceUpdateInput UpdateApplianceForReplicationProtectedItemInput, options *ReplicationProtectedItemsClientBeginUpdateApplianceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateAppliance" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -1658,7 +1722,7 @@ func (client *ReplicationProtectedItemsClient) updateApplianceCreateRequest(ctx return nil, errors.New("parameter replicatedProtectedItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{replicatedProtectedItemName}", url.PathEscape(replicatedProtectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -1672,37 +1736,41 @@ func (client *ReplicationProtectedItemsClient) updateApplianceCreateRequest(ctx // BeginUpdateMobilityService - The operation to update(push update) the installed mobility service software on a replication // protected item to the latest available version. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - The name of the fabric containing the protected item. -// protectionContainerName - The name of the container containing the protected item. -// replicatedProtectedItemName - The name of the protected item on which the agent is to be updated. -// updateMobilityServiceRequest - Request to update the mobility service on the protected item. -// options - ReplicationProtectedItemsClientBeginUpdateMobilityServiceOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginUpdateMobilityService -// method. -func (client *ReplicationProtectedItemsClient) BeginUpdateMobilityService(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, updateMobilityServiceRequest UpdateMobilityServiceRequest, options *ReplicationProtectedItemsClientBeginUpdateMobilityServiceOptions) (*runtime.Poller[ReplicationProtectedItemsClientUpdateMobilityServiceResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - The name of the fabric containing the protected item. +// - protectionContainerName - The name of the container containing the protected item. +// - replicatedProtectedItemName - The name of the protected item on which the agent is to be updated. +// - updateMobilityServiceRequest - Request to update the mobility service on the protected item. +// - options - ReplicationProtectedItemsClientBeginUpdateMobilityServiceOptions contains the optional parameters for the ReplicationProtectedItemsClient.BeginUpdateMobilityService +// method. +func (client *ReplicationProtectedItemsClient) BeginUpdateMobilityService(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, updateMobilityServiceRequest UpdateMobilityServiceRequest, options *ReplicationProtectedItemsClientBeginUpdateMobilityServiceOptions) (*runtime.Poller[ReplicationProtectedItemsClientUpdateMobilityServiceResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.updateMobilityService(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, updateMobilityServiceRequest, options) + resp, err := client.updateMobilityService(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, updateMobilityServiceRequest, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ReplicationProtectedItemsClientUpdateMobilityServiceResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicationProtectedItemsClientUpdateMobilityServiceResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientUpdateMobilityServiceResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectedItemsClientUpdateMobilityServiceResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // UpdateMobilityService - The operation to update(push update) the installed mobility service software on a replication protected // item to the latest available version. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectedItemsClient) updateMobilityService(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, updateMobilityServiceRequest UpdateMobilityServiceRequest, options *ReplicationProtectedItemsClientBeginUpdateMobilityServiceOptions) (*http.Response, error) { - req, err := client.updateMobilityServiceCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, updateMobilityServiceRequest, options) +func (client *ReplicationProtectedItemsClient) updateMobilityService(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, updateMobilityServiceRequest UpdateMobilityServiceRequest, options *ReplicationProtectedItemsClientBeginUpdateMobilityServiceOptions) (*http.Response, error) { + req, err := client.updateMobilityServiceCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, updateMobilityServiceRequest, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -1713,16 +1781,16 @@ func (client *ReplicationProtectedItemsClient) updateMobilityService(ctx context } // updateMobilityServiceCreateRequest creates the UpdateMobilityService request. -func (client *ReplicationProtectedItemsClient) updateMobilityServiceCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, updateMobilityServiceRequest UpdateMobilityServiceRequest, options *ReplicationProtectedItemsClientBeginUpdateMobilityServiceOptions) (*policy.Request, error) { +func (client *ReplicationProtectedItemsClient) updateMobilityServiceCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, updateMobilityServiceRequest UpdateMobilityServiceRequest, options *ReplicationProtectedItemsClientBeginUpdateMobilityServiceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateMobilityService" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -1739,7 +1807,7 @@ func (client *ReplicationProtectedItemsClient) updateMobilityServiceCreateReques return nil, errors.New("parameter replicatedProtectedItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{replicatedProtectedItemName}", url.PathEscape(replicatedProtectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotecteditems_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotecteditems_client_example_test.go index 7e0f20292b19..4de0d5c46da2 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotecteditems_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotecteditems_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -14,64 +15,145 @@ import ( "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/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_ListByReplicationProtectionContainers.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_ListByReplicationProtectionContainers.json func ExampleReplicationProtectedItemsClient_NewListByReplicationProtectionContainersPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectedItemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByReplicationProtectionContainersPager("cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", nil) + pager := clientFactory.NewReplicationProtectedItemsClient().NewListByReplicationProtectionContainersPager("vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.ReplicationProtectedItemCollection = armrecoveryservicessiterecovery.ReplicationProtectedItemCollection{ + // Value: []*armrecoveryservicessiterecovery.ReplicationProtectedItem{ + // { + // Name: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectedItemProperties{ + // ActiveLocation: to.Ptr("Primary"), + // AllowedOperations: []*string{ + // to.Ptr("PlannedFailover"), + // to.Ptr("UnplannedFailover"), + // to.Ptr("DisableProtection"), + // to.Ptr("TestFailover")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/None"), + // ScenarioName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1753-01-01T01:01:01Z"); return t}()), + // }, + // FriendlyName: to.Ptr("vm1"), + // PolicyFriendlyName: to.Ptr("protectionprofile1"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryProtectionContainerFriendlyName: to.Ptr("cloud1"), + // ProtectableItemID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectableItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // ProtectedItemType: to.Ptr("HyperVVirtualMachine"), + // ProtectionState: to.Ptr("Protected"), + // ProtectionStateDescription: to.Ptr("Protected"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzureReplicationDetails{ + // InstanceType: to.Ptr("HyperVReplicaAzure"), + // }, + // RecoveryContainerID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5/replicationProtectionContainers/d38048d4-b460-4791-8ece-108395ee8478"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // RecoveryProtectionContainerFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/241641e6-ee7b-4ee4-8141-821fadda43fa"), + // ReplicationHealth: to.Ptr("Normal"), + // TestFailoverState: to.Ptr("None"), + // TestFailoverStateDescription: to.Ptr("None"), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Get.json func ExampleReplicationProtectedItemsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectedItemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", nil) + res, err := clientFactory.NewReplicationProtectedItemsClient().Get(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReplicationProtectedItem = armrecoveryservicessiterecovery.ReplicationProtectedItem{ + // Name: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectedItemProperties{ + // ActiveLocation: to.Ptr("Primary"), + // AllowedOperations: []*string{ + // to.Ptr("PlannedFailover"), + // to.Ptr("UnplannedFailover"), + // to.Ptr("DisableProtection"), + // to.Ptr("TestFailover")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/None"), + // ScenarioName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1753-01-01T01:01:01Z"); return t}()), + // }, + // FriendlyName: to.Ptr("vm1"), + // PolicyFriendlyName: to.Ptr("protectionprofile1"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryProtectionContainerFriendlyName: to.Ptr("cloud1"), + // ProtectableItemID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectableItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // ProtectedItemType: to.Ptr("HyperVVirtualMachine"), + // ProtectionState: to.Ptr("Protected"), + // ProtectionStateDescription: to.Ptr("Protected"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzureReplicationDetails{ + // InstanceType: to.Ptr("HyperVReplicaAzure"), + // }, + // RecoveryContainerID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5/replicationProtectionContainers/d38048d4-b460-4791-8ece-108395ee8478"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // RecoveryProtectionContainerFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/241641e6-ee7b-4ee4-8141-821fadda43fa"), + // ReplicationHealth: to.Ptr("Normal"), + // TestFailoverState: to.Ptr("None"), + // TestFailoverStateDescription: to.Ptr("None"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Create.json func ExampleReplicationProtectedItemsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectedItemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreate(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.EnableProtectionInput{ + poller, err := clientFactory.NewReplicationProtectedItemsClient().BeginCreate(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.EnableProtectionInput{ Properties: &armrecoveryservicessiterecovery.EnableProtectionInputProperties{ PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), ProtectableItemID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectableItems/f8491e4f-817a-40dd-a90c-af773978c75b"), @@ -87,22 +169,61 @@ func ExampleReplicationProtectedItemsClient_BeginCreate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReplicationProtectedItem = armrecoveryservicessiterecovery.ReplicationProtectedItem{ + // Name: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectedItemProperties{ + // ActiveLocation: to.Ptr("Primary"), + // AllowedOperations: []*string{ + // to.Ptr("PlannedFailover"), + // to.Ptr("UnplannedFailover"), + // to.Ptr("DisableProtection"), + // to.Ptr("TestFailover")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/None"), + // ScenarioName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1753-01-01T01:01:01Z"); return t}()), + // }, + // FriendlyName: to.Ptr("vm1"), + // PolicyFriendlyName: to.Ptr("protectionprofile1"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryProtectionContainerFriendlyName: to.Ptr("cloud1"), + // ProtectableItemID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectableItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // ProtectedItemType: to.Ptr("HyperVVirtualMachine"), + // ProtectionState: to.Ptr("Protected"), + // ProtectionStateDescription: to.Ptr("Protected"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzureReplicationDetails{ + // InstanceType: to.Ptr("HyperVReplicaAzure"), + // }, + // RecoveryContainerID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5/replicationProtectionContainers/d38048d4-b460-4791-8ece-108395ee8478"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // RecoveryProtectionContainerFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/241641e6-ee7b-4ee4-8141-821fadda43fa"), + // ReplicationHealth: to.Ptr("Normal"), + // TestFailoverState: to.Ptr("None"), + // TestFailoverStateDescription: to.Ptr("None"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Purge.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Purge.json func ExampleReplicationProtectedItemsClient_BeginPurge() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectedItemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginPurge(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "c0c14913-3d7a-48ea-9531-cc99e0e686e6", nil) + poller, err := clientFactory.NewReplicationProtectedItemsClient().BeginPurge(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "c0c14913-3d7a-48ea-9531-cc99e0e686e6", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -112,18 +233,18 @@ func ExampleReplicationProtectedItemsClient_BeginPurge() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Update.json func ExampleReplicationProtectedItemsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectedItemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.UpdateReplicationProtectedItemInput{ + poller, err := clientFactory.NewReplicationProtectedItemsClient().BeginUpdate(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.UpdateReplicationProtectedItemInput{ Properties: &armrecoveryservicessiterecovery.UpdateReplicationProtectedItemInputProperties{ LicenseType: to.Ptr(armrecoveryservicessiterecovery.LicenseTypeWindowsServer), ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzureUpdateReplicationProtectedItemInput{ @@ -153,22 +274,61 @@ func ExampleReplicationProtectedItemsClient_BeginUpdate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReplicationProtectedItem = armrecoveryservicessiterecovery.ReplicationProtectedItem{ + // Name: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectedItemProperties{ + // ActiveLocation: to.Ptr("Primary"), + // AllowedOperations: []*string{ + // to.Ptr("PlannedFailover"), + // to.Ptr("UnplannedFailover"), + // to.Ptr("DisableProtection"), + // to.Ptr("TestFailover")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/None"), + // ScenarioName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1753-01-01T01:01:01Z"); return t}()), + // }, + // FriendlyName: to.Ptr("vm1"), + // PolicyFriendlyName: to.Ptr("protectionprofile1"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryProtectionContainerFriendlyName: to.Ptr("cloud1"), + // ProtectableItemID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectableItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // ProtectedItemType: to.Ptr("HyperVVirtualMachine"), + // ProtectionState: to.Ptr("Protected"), + // ProtectionStateDescription: to.Ptr("Protected"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzureReplicationDetails{ + // InstanceType: to.Ptr("HyperVReplicaAzure"), + // }, + // RecoveryContainerID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5/replicationProtectionContainers/d38048d4-b460-4791-8ece-108395ee8478"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // RecoveryProtectionContainerFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/241641e6-ee7b-4ee4-8141-821fadda43fa"), + // ReplicationHealth: to.Ptr("Normal"), + // TestFailoverState: to.Ptr("None"), + // TestFailoverStateDescription: to.Ptr("None"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_AddDisks.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_AddDisks.json func ExampleReplicationProtectedItemsClient_BeginAddDisks() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectedItemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginAddDisks(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.AddDisksInput{ + poller, err := clientFactory.NewReplicationProtectedItemsClient().BeginAddDisks(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.AddDisksInput{ Properties: &armrecoveryservicessiterecovery.AddDisksInputProperties{ ProviderSpecificDetails: &armrecoveryservicessiterecovery.A2AAddDisksInput{ InstanceType: to.Ptr("A2A"), @@ -188,22 +348,64 @@ func ExampleReplicationProtectedItemsClient_BeginAddDisks() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReplicationProtectedItem = armrecoveryservicessiterecovery.ReplicationProtectedItem{ + // Name: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectedItemProperties{ + // ActiveLocation: to.Ptr("Primary"), + // AllowedOperations: []*string{ + // to.Ptr("RepairReplication"), + // to.Ptr("UnplannedFailover"), + // to.Ptr("DisableProtection"), + // to.Ptr("TestFailover")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/None"), + // ScenarioName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1752-12-31T19:31:01Z"); return t}()), + // }, + // FailoverHealth: to.Ptr("Normal"), + // FriendlyName: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // HealthErrors: []*armrecoveryservicessiterecovery.HealthError{ + // }, + // PolicyFriendlyName: to.Ptr("A2APolicy"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/A2APolicy"), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryFabricProvider: to.Ptr("AzureFabric"), + // PrimaryProtectionContainerFriendlyName: to.Ptr("cloud_6d224fc6-f326-5d35-96de-fbf51efb3179"), + // ProtectedItemType: to.Ptr(""), + // ProtectionState: to.Ptr("Protected"), + // ProtectionStateDescription: to.Ptr("Protected"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.A2AReplicationDetails{ + // InstanceType: to.Ptr("A2A"), + // }, + // RecoveryContainerID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud2/replicationProtectionContainers/cloud_81224fc6-f326-5d35-96de-fbf51efb3188"), + // RecoveryFabricFriendlyName: to.Ptr("cloud2"), + // RecoveryFabricID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud2"), + // RecoveryProtectionContainerFriendlyName: to.Ptr("cloud_81224fc6-f326-5d35-96de-fbf51efb3188"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/6d2940f9-4c34-5989-9f56-1243a6e76ecf"), + // ReplicationHealth: to.Ptr("Normal"), + // TestFailoverState: to.Ptr("None"), + // TestFailoverStateDescription: to.Ptr("None"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_ApplyRecoveryPoint.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_ApplyRecoveryPoint.json func ExampleReplicationProtectedItemsClient_BeginApplyRecoveryPoint() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectedItemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginApplyRecoveryPoint(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.ApplyRecoveryPointInput{ + poller, err := clientFactory.NewReplicationProtectedItemsClient().BeginApplyRecoveryPoint(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.ApplyRecoveryPointInput{ Properties: &armrecoveryservicessiterecovery.ApplyRecoveryPointInputProperties{ ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzureApplyRecoveryPointInput{ InstanceType: to.Ptr("HyperVReplicaAzure"), @@ -218,22 +420,64 @@ func ExampleReplicationProtectedItemsClient_BeginApplyRecoveryPoint() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReplicationProtectedItem = armrecoveryservicessiterecovery.ReplicationProtectedItem{ + // Name: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectedItemProperties{ + // ActiveLocation: to.Ptr("Recovery"), + // AllowedOperations: []*string{ + // to.Ptr("CompleteMigration"), + // to.Ptr("Commit"), + // to.Ptr("DisableProtection"), + // to.Ptr("ChangePit")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/None"), + // ScenarioName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1753-01-01T01:01:01Z"); return t}()), + // }, + // FailoverRecoveryPointID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b/recoveryPoints/e4d05fe9-5dfd-47be-b50b-aad306b2802d"), + // FriendlyName: to.Ptr("vm1"), + // LastSuccessfulFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T08:42:33.0996129Z"); return t}()), + // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-25T09:57:57.0357829Z"); return t}()), + // PolicyFriendlyName: to.Ptr("protectionprofile1"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryProtectionContainerFriendlyName: to.Ptr("cloud1"), + // ProtectableItemID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectableItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // ProtectedItemType: to.Ptr("HyperVVirtualMachine"), + // ProtectionState: to.Ptr("UnplannedFailoverCommitPendingStatesBegin"), + // ProtectionStateDescription: to.Ptr("Failover completed"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzureReplicationDetails{ + // InstanceType: to.Ptr("HyperVReplicaAzure"), + // }, + // RecoveryContainerID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5/replicationProtectionContainers/d38048d4-b460-4791-8ece-108395ee8478"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // RecoveryProtectionContainerFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/241641e6-ee7b-4ee4-8141-821fadda43fa"), + // ReplicationHealth: to.Ptr("Critical"), + // TestFailoverState: to.Ptr("MarkedForDeletion"), + // TestFailoverStateDescription: to.Ptr("Cleaning up test environment"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_FailoverCancel.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_FailoverCancel.json func ExampleReplicationProtectedItemsClient_BeginFailoverCancel() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectedItemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginFailoverCancel(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", nil) + poller, err := clientFactory.NewReplicationProtectedItemsClient().BeginFailoverCancel(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -241,22 +485,62 @@ func ExampleReplicationProtectedItemsClient_BeginFailoverCancel() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReplicationProtectedItem = armrecoveryservicessiterecovery.ReplicationProtectedItem{ + // Name: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectedItemProperties{ + // ActiveLocation: to.Ptr("Primary"), + // AllowedOperations: []*string{ + // to.Ptr("PlannedFailover"), + // to.Ptr("DisableProtection")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/None"), + // ScenarioName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-02-24T07:17:23.1358752Z"); return t}()), + // }, + // FailoverRecoveryPointID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b/recoveryPoints/b22134ea-620c-474b-9fa5-3c1cb47708e3"), + // FriendlyName: to.Ptr("vm1"), + // LastSuccessfulFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-02-24T06:37:23.1578655Z"); return t}()), + // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1601-01-01T00:00:00.0000000Z"); return t}()), + // PolicyFriendlyName: to.Ptr("protectionprofile1"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryProtectionContainerFriendlyName: to.Ptr("cloud1"), + // ProtectableItemID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectableItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // ProtectedItemType: to.Ptr(""), + // ProtectionState: to.Ptr("Protected"), + // ProtectionStateDescription: to.Ptr("Protected"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.InMageRcmFailbackReplicationDetails{ + // InstanceType: to.Ptr("InMageRcmFailback"), + // }, + // RecoveryContainerID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179"), + // RecoveryFabricFriendlyName: to.Ptr("cloud1"), + // RecoveryFabricID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1"), + // RecoveryProtectionContainerFriendlyName: to.Ptr("cloud1"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/241641e6-ee7b-4ee4-8141-821fadda43fa"), + // ReplicationHealth: to.Ptr("Normal"), + // TestFailoverState: to.Ptr("None"), + // TestFailoverStateDescription: to.Ptr("None"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_FailoverCommit.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_FailoverCommit.json func ExampleReplicationProtectedItemsClient_BeginFailoverCommit() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectedItemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginFailoverCommit(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", nil) + poller, err := clientFactory.NewReplicationProtectedItemsClient().BeginFailoverCommit(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -264,22 +548,63 @@ func ExampleReplicationProtectedItemsClient_BeginFailoverCommit() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReplicationProtectedItem = armrecoveryservicessiterecovery.ReplicationProtectedItem{ + // Name: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectedItemProperties{ + // ActiveLocation: to.Ptr("Recovery"), + // AllowedOperations: []*string{ + // to.Ptr("CompleteMigration"), + // to.Ptr("DisableProtection"), + // to.Ptr("Failback")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/None"), + // ScenarioName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1753-01-01T01:01:01Z"); return t}()), + // }, + // FailoverRecoveryPointID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b/recoveryPoints/b22134ea-620c-474b-9fa5-3c1cb47708e3"), + // FriendlyName: to.Ptr("vm1"), + // LastSuccessfulFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T06:37:23.1578655Z"); return t}()), + // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-25T09:57:57.0357829Z"); return t}()), + // PolicyFriendlyName: to.Ptr("protectionprofile1"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryProtectionContainerFriendlyName: to.Ptr("cloud1"), + // ProtectableItemID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectableItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // ProtectedItemType: to.Ptr("HyperVVirtualMachine"), + // ProtectionState: to.Ptr("PlannedFailoverStatesBegin"), + // ProtectionStateDescription: to.Ptr("Planned failover committed"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzureReplicationDetails{ + // InstanceType: to.Ptr("HyperVReplicaAzure"), + // }, + // RecoveryContainerID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5/replicationProtectionContainers/d38048d4-b460-4791-8ece-108395ee8478"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // RecoveryProtectionContainerFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/241641e6-ee7b-4ee4-8141-821fadda43fa"), + // ReplicationHealth: to.Ptr("Normal"), + // TestFailoverState: to.Ptr("MarkedForDeletion"), + // TestFailoverStateDescription: to.Ptr("Cleaning up test environment"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_PlannedFailover.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_PlannedFailover.json func ExampleReplicationProtectedItemsClient_BeginPlannedFailover() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectedItemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginPlannedFailover(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.PlannedFailoverInput{ + poller, err := clientFactory.NewReplicationProtectedItemsClient().BeginPlannedFailover(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.PlannedFailoverInput{ Properties: &armrecoveryservicessiterecovery.PlannedFailoverInputProperties{ FailoverDirection: to.Ptr("PrimaryToRecovery"), ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzurePlannedFailoverProviderInput{ @@ -294,22 +619,64 @@ func ExampleReplicationProtectedItemsClient_BeginPlannedFailover() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReplicationProtectedItem = armrecoveryservicessiterecovery.ReplicationProtectedItem{ + // Name: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectedItemProperties{ + // ActiveLocation: to.Ptr("Recovery"), + // AllowedOperations: []*string{ + // to.Ptr("CompleteMigration"), + // to.Ptr("Commit"), + // to.Ptr("DisableProtection"), + // to.Ptr("ChangePit")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/None"), + // ScenarioName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1753-01-01T01:01:01Z"); return t}()), + // }, + // FailoverRecoveryPointID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b/recoveryPoints/b22134ea-620c-474b-9fa5-3c1cb47708e3"), + // FriendlyName: to.Ptr("vm1"), + // LastSuccessfulFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T06:37:23.1578655Z"); return t}()), + // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-25T09:57:57.0357829Z"); return t}()), + // PolicyFriendlyName: to.Ptr("protectionprofile1"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryProtectionContainerFriendlyName: to.Ptr("cloud1"), + // ProtectableItemID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectableItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // ProtectedItemType: to.Ptr("HyperVVirtualMachine"), + // ProtectionState: to.Ptr("PlannedFailoverCommitRequired"), + // ProtectionStateDescription: to.Ptr("Planned failover finished"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzureReplicationDetails{ + // InstanceType: to.Ptr("HyperVReplicaAzure"), + // }, + // RecoveryContainerID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5/replicationProtectionContainers/d38048d4-b460-4791-8ece-108395ee8478"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // RecoveryProtectionContainerFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/241641e6-ee7b-4ee4-8141-821fadda43fa"), + // ReplicationHealth: to.Ptr("Normal"), + // TestFailoverState: to.Ptr("MarkedForDeletion"), + // TestFailoverStateDescription: to.Ptr("Cleaning up test environment"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Delete.json func ExampleReplicationProtectedItemsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectedItemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "c0c14913-3d7a-48ea-9531-cc99e0e686e6", armrecoveryservicessiterecovery.DisableProtectionInput{ + poller, err := clientFactory.NewReplicationProtectedItemsClient().BeginDelete(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "c0c14913-3d7a-48ea-9531-cc99e0e686e6", armrecoveryservicessiterecovery.DisableProtectionInput{ Properties: &armrecoveryservicessiterecovery.DisableProtectionInputProperties{ ReplicationProviderInput: &armrecoveryservicessiterecovery.DisableProtectionProviderSpecificInput{ InstanceType: to.Ptr("DisableProtectionProviderSpecificInput"), @@ -325,18 +692,18 @@ func ExampleReplicationProtectedItemsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_RemoveDisks.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_RemoveDisks.json func ExampleReplicationProtectedItemsClient_BeginRemoveDisks() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectedItemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginRemoveDisks(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.RemoveDisksInput{ + poller, err := clientFactory.NewReplicationProtectedItemsClient().BeginRemoveDisks(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.RemoveDisksInput{ Properties: &armrecoveryservicessiterecovery.RemoveDisksInputProperties{ ProviderSpecificDetails: &armrecoveryservicessiterecovery.A2ARemoveDisksInput{ InstanceType: to.Ptr("A2A"), @@ -352,22 +719,64 @@ func ExampleReplicationProtectedItemsClient_BeginRemoveDisks() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReplicationProtectedItem = armrecoveryservicessiterecovery.ReplicationProtectedItem{ + // Name: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectedItemProperties{ + // ActiveLocation: to.Ptr("Primary"), + // AllowedOperations: []*string{ + // to.Ptr("RepairReplication"), + // to.Ptr("UnplannedFailover"), + // to.Ptr("DisableProtection"), + // to.Ptr("TestFailover")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/None"), + // ScenarioName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1752-12-31T19:31:01Z"); return t}()), + // }, + // FailoverHealth: to.Ptr("Normal"), + // FriendlyName: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // HealthErrors: []*armrecoveryservicessiterecovery.HealthError{ + // }, + // PolicyFriendlyName: to.Ptr("A2APolicy"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/A2APolicy"), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryFabricProvider: to.Ptr("AzureFabric"), + // PrimaryProtectionContainerFriendlyName: to.Ptr("cloud_6d224fc6-f326-5d35-96de-fbf51efb3179"), + // ProtectedItemType: to.Ptr(""), + // ProtectionState: to.Ptr("Protected"), + // ProtectionStateDescription: to.Ptr("Protected"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.A2AReplicationDetails{ + // InstanceType: to.Ptr("A2A"), + // }, + // RecoveryContainerID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud2/replicationProtectionContainers/cloud_81224fc6-f326-5d35-96de-fbf51efb3188"), + // RecoveryFabricFriendlyName: to.Ptr("cloud2"), + // RecoveryFabricID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud2"), + // RecoveryProtectionContainerFriendlyName: to.Ptr("cloud_81224fc6-f326-5d35-96de-fbf51efb3188"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/6d2940f9-4c34-5989-9f56-1243a6e76ecf"), + // ReplicationHealth: to.Ptr("Normal"), + // TestFailoverState: to.Ptr("None"), + // TestFailoverStateDescription: to.Ptr("None"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_RepairReplication.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_RepairReplication.json func ExampleReplicationProtectedItemsClient_BeginRepairReplication() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectedItemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginRepairReplication(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", nil) + poller, err := clientFactory.NewReplicationProtectedItemsClient().BeginRepairReplication(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -375,22 +784,61 @@ func ExampleReplicationProtectedItemsClient_BeginRepairReplication() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReplicationProtectedItem = armrecoveryservicessiterecovery.ReplicationProtectedItem{ + // Name: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectedItemProperties{ + // ActiveLocation: to.Ptr("Primary"), + // AllowedOperations: []*string{ + // to.Ptr("PlannedFailover"), + // to.Ptr("UnplannedFailover"), + // to.Ptr("DisableProtection"), + // to.Ptr("TestFailover")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/None"), + // ScenarioName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1753-01-01T01:01:01Z"); return t}()), + // }, + // FriendlyName: to.Ptr("vm1"), + // PolicyFriendlyName: to.Ptr("protectionprofile1"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryProtectionContainerFriendlyName: to.Ptr("cloud1"), + // ProtectableItemID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectableItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // ProtectedItemType: to.Ptr("HyperVVirtualMachine"), + // ProtectionState: to.Ptr("Protected"), + // ProtectionStateDescription: to.Ptr("Protected"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzureReplicationDetails{ + // InstanceType: to.Ptr("HyperVReplicaAzure"), + // }, + // RecoveryContainerID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5/replicationProtectionContainers/d38048d4-b460-4791-8ece-108395ee8478"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // RecoveryProtectionContainerFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/241641e6-ee7b-4ee4-8141-821fadda43fa"), + // ReplicationHealth: to.Ptr("Normal"), + // TestFailoverState: to.Ptr("None"), + // TestFailoverStateDescription: to.Ptr("None"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Reprotect.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Reprotect.json func ExampleReplicationProtectedItemsClient_BeginReprotect() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectedItemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginReprotect(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.ReverseReplicationInput{ + poller, err := clientFactory.NewReplicationProtectedItemsClient().BeginReprotect(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.ReverseReplicationInput{ Properties: &armrecoveryservicessiterecovery.ReverseReplicationInputProperties{ FailoverDirection: to.Ptr("PrimaryToRecovery"), ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzureReprotectInput{ @@ -405,22 +853,64 @@ func ExampleReplicationProtectedItemsClient_BeginReprotect() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReplicationProtectedItem = armrecoveryservicessiterecovery.ReplicationProtectedItem{ + // Name: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectedItemProperties{ + // ActiveLocation: to.Ptr("Primary"), + // AllowedOperations: []*string{ + // to.Ptr("PlannedFailover"), + // to.Ptr("UnplannedFailover"), + // to.Ptr("DisableProtection"), + // to.Ptr("TestFailover")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/None"), + // ScenarioName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1753-01-01T01:01:01Z"); return t}()), + // }, + // FailoverRecoveryPointID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b/recoveryPoints/b22134ea-620c-474b-9fa5-3c1cb47708e3"), + // FriendlyName: to.Ptr("vm1"), + // LastSuccessfulFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T06:37:23.1578655Z"); return t}()), + // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-25T09:57:57.0357829Z"); return t}()), + // PolicyFriendlyName: to.Ptr("protectionprofile1"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryProtectionContainerFriendlyName: to.Ptr("cloud1"), + // ProtectableItemID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectableItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // ProtectedItemType: to.Ptr("HyperVVirtualMachine"), + // ProtectionState: to.Ptr("Protected"), + // ProtectionStateDescription: to.Ptr("Protected"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzureReplicationDetails{ + // InstanceType: to.Ptr("HyperVReplicaAzure"), + // }, + // RecoveryContainerID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5/replicationProtectionContainers/d38048d4-b460-4791-8ece-108395ee8478"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // RecoveryProtectionContainerFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/241641e6-ee7b-4ee4-8141-821fadda43fa"), + // ReplicationHealth: to.Ptr("Normal"), + // TestFailoverState: to.Ptr("MarkedForDeletion"), + // TestFailoverStateDescription: to.Ptr("Cleaning up test environment"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_ResolveHealthErrors.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_ResolveHealthErrors.json func ExampleReplicationProtectedItemsClient_BeginResolveHealthErrors() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectedItemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginResolveHealthErrors(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.ResolveHealthInput{ + poller, err := clientFactory.NewReplicationProtectedItemsClient().BeginResolveHealthErrors(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.ResolveHealthInput{ Properties: &armrecoveryservicessiterecovery.ResolveHealthInputProperties{ HealthErrors: []*armrecoveryservicessiterecovery.ResolveHealthError{ { @@ -435,22 +925,64 @@ func ExampleReplicationProtectedItemsClient_BeginResolveHealthErrors() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReplicationProtectedItem = armrecoveryservicessiterecovery.ReplicationProtectedItem{ + // Name: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectedItemProperties{ + // ActiveLocation: to.Ptr("Primary"), + // AllowedOperations: []*string{ + // to.Ptr("RepairReplication"), + // to.Ptr("UnplannedFailover"), + // to.Ptr("DisableProtection"), + // to.Ptr("TestFailover")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/None"), + // ScenarioName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1752-12-31T19:31:01Z"); return t}()), + // }, + // FailoverHealth: to.Ptr("Normal"), + // FriendlyName: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // HealthErrors: []*armrecoveryservicessiterecovery.HealthError{ + // }, + // PolicyFriendlyName: to.Ptr("A2APolicy"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/A2APolicy"), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryFabricProvider: to.Ptr("AzureFabric"), + // PrimaryProtectionContainerFriendlyName: to.Ptr("cloud_6d224fc6-f326-5d35-96de-fbf51efb3179"), + // ProtectedItemType: to.Ptr(""), + // ProtectionState: to.Ptr("Protected"), + // ProtectionStateDescription: to.Ptr("Protected"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.A2AReplicationDetails{ + // InstanceType: to.Ptr("A2A"), + // }, + // RecoveryContainerID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud2/replicationProtectionContainers/cloud_81224fc6-f326-5d35-96de-fbf51efb3188"), + // RecoveryFabricFriendlyName: to.Ptr("cloud2"), + // RecoveryFabricID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud2"), + // RecoveryProtectionContainerFriendlyName: to.Ptr("cloud_81224fc6-f326-5d35-96de-fbf51efb3188"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/6d2940f9-4c34-5989-9f56-1243a6e76ecf"), + // ReplicationHealth: to.Ptr("Normal"), + // TestFailoverState: to.Ptr("None"), + // TestFailoverStateDescription: to.Ptr("None"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_SwitchProvider.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_SwitchProvider.json func ExampleReplicationProtectedItemsClient_BeginSwitchProvider() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectedItemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginSwitchProvider(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.SwitchProviderInput{ + poller, err := clientFactory.NewReplicationProtectedItemsClient().BeginSwitchProvider(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.SwitchProviderInput{ Properties: &armrecoveryservicessiterecovery.SwitchProviderInputProperties{ ProviderSpecificDetails: &armrecoveryservicessiterecovery.InMageAzureV2SwitchProviderInput{ InstanceType: to.Ptr("InMageAzureV2"), @@ -468,22 +1000,64 @@ func ExampleReplicationProtectedItemsClient_BeginSwitchProvider() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReplicationProtectedItem = armrecoveryservicessiterecovery.ReplicationProtectedItem{ + // Name: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectedItemProperties{ + // ActiveLocation: to.Ptr("Recovery"), + // AllowedOperations: []*string{ + // to.Ptr("CompleteMigration"), + // to.Ptr("Commit"), + // to.Ptr("DisableProtection"), + // to.Ptr("ChangePit")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/None"), + // ScenarioName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1753-01-01T01:01:01Z"); return t}()), + // }, + // FailoverRecoveryPointID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b/recoveryPoints/b22134ea-620c-474b-9fa5-3c1cb47708e3"), + // FriendlyName: to.Ptr("vm1"), + // LastSuccessfulFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T06:37:23.1578655Z"); return t}()), + // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-25T09:57:57.0357829Z"); return t}()), + // PolicyFriendlyName: to.Ptr("protectionprofile1"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryProtectionContainerFriendlyName: to.Ptr("cloud1"), + // ProtectableItemID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectableItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // ProtectedItemType: to.Ptr("HyperVVirtualMachine"), + // ProtectionState: to.Ptr("PlannedFailoverCommitRequired"), + // ProtectionStateDescription: to.Ptr("Planned failover finished"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzureReplicationDetails{ + // InstanceType: to.Ptr("HyperVReplicaAzure"), + // }, + // RecoveryContainerID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5/replicationProtectionContainers/d38048d4-b460-4791-8ece-108395ee8478"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // RecoveryProtectionContainerFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/241641e6-ee7b-4ee4-8141-821fadda43fa"), + // ReplicationHealth: to.Ptr("Normal"), + // TestFailoverState: to.Ptr("MarkedForDeletion"), + // TestFailoverStateDescription: to.Ptr("Cleaning up test environment"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_TestFailover.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_TestFailover.json func ExampleReplicationProtectedItemsClient_BeginTestFailover() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectedItemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginTestFailover(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.TestFailoverInput{ + poller, err := clientFactory.NewReplicationProtectedItemsClient().BeginTestFailover(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.TestFailoverInput{ Properties: &armrecoveryservicessiterecovery.TestFailoverInputProperties{ FailoverDirection: to.Ptr("PrimaryToRecovery"), NetworkID: to.Ptr("/subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/siterecoveryProd1/providers/Microsoft.Network/virtualNetworks/vnetavrai"), @@ -500,22 +1074,59 @@ func ExampleReplicationProtectedItemsClient_BeginTestFailover() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReplicationProtectedItem = armrecoveryservicessiterecovery.ReplicationProtectedItem{ + // Name: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectedItemProperties{ + // ActiveLocation: to.Ptr("Primary"), + // AllowedOperations: []*string{ + // to.Ptr("TestFailoverCleanup")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/2838f9b4-2609-4f76-a7e9-07e6387c5e98"), + // ScenarioName: to.Ptr("TestFailover"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-25T09:57:57.0357829Z"); return t}()), + // }, + // FailoverRecoveryPointID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b/recoveryPoints/0689d0d0-3518-4793-8c98-c26bf94526f6"), + // FriendlyName: to.Ptr("vm1"), + // PolicyFriendlyName: to.Ptr("protectionprofile1"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryProtectionContainerFriendlyName: to.Ptr("cloud1"), + // ProtectableItemID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectableItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // ProtectedItemType: to.Ptr("HyperVVirtualMachine"), + // ProtectionState: to.Ptr("Protected"), + // ProtectionStateDescription: to.Ptr("Cleanup test failover pending"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzureReplicationDetails{ + // InstanceType: to.Ptr("HyperVReplicaAzure"), + // }, + // RecoveryContainerID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5/replicationProtectionContainers/d38048d4-b460-4791-8ece-108395ee8478"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // RecoveryProtectionContainerFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/241641e6-ee7b-4ee4-8141-821fadda43fa"), + // ReplicationHealth: to.Ptr("Normal"), + // TestFailoverState: to.Ptr("WaitingForCompletion"), + // TestFailoverStateDescription: to.Ptr("Waiting for user input"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_TestFailoverCleanup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_TestFailoverCleanup.json func ExampleReplicationProtectedItemsClient_BeginTestFailoverCleanup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectedItemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginTestFailoverCleanup(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.TestFailoverCleanupInput{ + poller, err := clientFactory.NewReplicationProtectedItemsClient().BeginTestFailoverCleanup(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.TestFailoverCleanupInput{ Properties: &armrecoveryservicessiterecovery.TestFailoverCleanupInputProperties{ Comments: to.Ptr("Test Failover Cleanup"), }, @@ -527,22 +1138,64 @@ func ExampleReplicationProtectedItemsClient_BeginTestFailoverCleanup() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReplicationProtectedItem = armrecoveryservicessiterecovery.ReplicationProtectedItem{ + // Name: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectedItemProperties{ + // ActiveLocation: to.Ptr("Primary"), + // AllowedOperations: []*string{ + // to.Ptr("PlannedFailover"), + // to.Ptr("UnplannedFailover"), + // to.Ptr("DisableProtection"), + // to.Ptr("TestFailover")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/None"), + // ScenarioName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1753-01-01T01:01:01Z"); return t}()), + // }, + // FailoverRecoveryPointID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b/recoveryPoints/b22134ea-620c-474b-9fa5-3c1cb47708e3"), + // FriendlyName: to.Ptr("vm1"), + // LastSuccessfulFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T06:37:23.1578655Z"); return t}()), + // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-25T09:57:57.0357829Z"); return t}()), + // PolicyFriendlyName: to.Ptr("protectionprofile1"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryProtectionContainerFriendlyName: to.Ptr("cloud1"), + // ProtectableItemID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectableItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // ProtectedItemType: to.Ptr("HyperVVirtualMachine"), + // ProtectionState: to.Ptr("Protected"), + // ProtectionStateDescription: to.Ptr("Protected"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzureReplicationDetails{ + // InstanceType: to.Ptr("HyperVReplicaAzure"), + // }, + // RecoveryContainerID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5/replicationProtectionContainers/d38048d4-b460-4791-8ece-108395ee8478"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // RecoveryProtectionContainerFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/241641e6-ee7b-4ee4-8141-821fadda43fa"), + // ReplicationHealth: to.Ptr("Normal"), + // TestFailoverState: to.Ptr("MarkedForDeletion"), + // TestFailoverStateDescription: to.Ptr("Cleaning up test environment"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_UnplannedFailover.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_UnplannedFailover.json func ExampleReplicationProtectedItemsClient_BeginUnplannedFailover() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectedItemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUnplannedFailover(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.UnplannedFailoverInput{ + poller, err := clientFactory.NewReplicationProtectedItemsClient().BeginUnplannedFailover(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "f8491e4f-817a-40dd-a90c-af773978c75b", armrecoveryservicessiterecovery.UnplannedFailoverInput{ Properties: &armrecoveryservicessiterecovery.UnplannedFailoverInputProperties{ FailoverDirection: to.Ptr("PrimaryToRecovery"), ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzureUnplannedFailoverInput{ @@ -558,22 +1211,64 @@ func ExampleReplicationProtectedItemsClient_BeginUnplannedFailover() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReplicationProtectedItem = armrecoveryservicessiterecovery.ReplicationProtectedItem{ + // Name: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectedItemProperties{ + // ActiveLocation: to.Ptr("Recovery"), + // AllowedOperations: []*string{ + // to.Ptr("CompleteMigration"), + // to.Ptr("Commit"), + // to.Ptr("DisableProtection"), + // to.Ptr("ChangePit")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/None"), + // ScenarioName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1753-01-01T01:01:01Z"); return t}()), + // }, + // FailoverRecoveryPointID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b/recoveryPoints/b2c7b208-0999-40a4-804f-8ee1019c8f76"), + // FriendlyName: to.Ptr("vm1"), + // LastSuccessfulFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-26T08:42:33.0996129Z"); return t}()), + // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-25T09:57:57.0357829Z"); return t}()), + // PolicyFriendlyName: to.Ptr("protectionprofile1"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryProtectionContainerFriendlyName: to.Ptr("cloud1"), + // ProtectableItemID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectableItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // ProtectedItemType: to.Ptr("HyperVVirtualMachine"), + // ProtectionState: to.Ptr("UnplannedFailoverCommitPendingStatesBegin"), + // ProtectionStateDescription: to.Ptr("Failover completed"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzureReplicationDetails{ + // InstanceType: to.Ptr("HyperVReplicaAzure"), + // }, + // RecoveryContainerID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5/replicationProtectionContainers/d38048d4-b460-4791-8ece-108395ee8478"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // RecoveryProtectionContainerFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/241641e6-ee7b-4ee4-8141-821fadda43fa"), + // ReplicationHealth: to.Ptr("Normal"), + // TestFailoverState: to.Ptr("MarkedForDeletion"), + // TestFailoverStateDescription: to.Ptr("Cleaning up test environment"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_UpdateAppliance.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_UpdateAppliance.json func ExampleReplicationProtectedItemsClient_BeginUpdateAppliance() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectedItemsClient("Ayan-0106-SA-Vault", "Ayan-0106-SA-RG", "7c943c1b-5122-4097-90c8-861411bdd574", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdateAppliance(ctx, "Ayan-0106-SA-Vaultreplicationfabric", "Ayan-0106-SA-Vaultreplicationcontainer", "idclab-vcen67_50158124-8857-3e08-0893-2ddf8ebb8c1f", armrecoveryservicessiterecovery.UpdateApplianceForReplicationProtectedItemInput{ + poller, err := clientFactory.NewReplicationProtectedItemsClient().BeginUpdateAppliance(ctx, "Ayan-0106-SA-Vault", "Ayan-0106-SA-RG", "Ayan-0106-SA-Vaultreplicationfabric", "Ayan-0106-SA-Vaultreplicationcontainer", "idclab-vcen67_50158124-8857-3e08-0893-2ddf8ebb8c1f", armrecoveryservicessiterecovery.UpdateApplianceForReplicationProtectedItemInput{ Properties: &armrecoveryservicessiterecovery.UpdateApplianceForReplicationProtectedItemInputProperties{ ProviderSpecificDetails: &armrecoveryservicessiterecovery.InMageRcmUpdateApplianceForReplicationProtectedItemInput{ InstanceType: to.Ptr("InMageRcm"), @@ -589,22 +1284,64 @@ func ExampleReplicationProtectedItemsClient_BeginUpdateAppliance() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReplicationProtectedItem = armrecoveryservicessiterecovery.ReplicationProtectedItem{ + // Name: to.Ptr("idclab-vcen67_50158124-8857-3e08-0893-2ddf8ebb8c1f"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems"), + // ID: to.Ptr("/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/Ayan-0106-SA-RG/providers/Microsoft.RecoveryServices/vaults/Ayan-0106-SA-Vault/replicationFabrics/Ayan-0106-SA-Vaultreplicationfabric/replicationProtectionContainers/Ayan-0106-SA-Vaultreplicationcontainer/replicationProtectedItems/idclab-vcen67_50158124-8857-3e08-0893-2ddf8ebb8c1f"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectedItemProperties{ + // ActiveLocation: to.Ptr("Primary"), + // AllowedOperations: []*string{ + // to.Ptr("UnplannedFailover"), + // to.Ptr("DisableProtection"), + // to.Ptr("TestFailover")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/Ayan-0106-SA-RG/providers/Microsoft.RecoveryServices/vaults/Ayan-0106-SA-Vault/replicationJobs/None"), + // ScenarioName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1753-01-01T01:01:01Z"); return t}()), + // }, + // EventCorrelationID: to.Ptr("fb40d161-cffd-44d9-a252-0b7978e1f73c"), + // FailoverHealth: to.Ptr("Normal"), + // FriendlyName: to.Ptr("Ayan-RHEL7-Test2"), + // HealthErrors: []*armrecoveryservicessiterecovery.HealthError{ + // }, + // PolicyFriendlyName: to.Ptr("24-hour-replication-policy"), + // PolicyID: to.Ptr("/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/Ayan-0106-SA-RG/providers/Microsoft.RecoveryServices/vaults/Ayan-0106-SA-Vault/replicationPolicies/24-hour-replication-policy"), + // PrimaryFabricFriendlyName: to.Ptr("Ayan-0106-SA-Vaultreplicationfabric"), + // PrimaryFabricProvider: to.Ptr("InMageRcmFabric"), + // PrimaryProtectionContainerFriendlyName: to.Ptr("Ayan-0106-SA-Vaultreplicationcontainer"), + // ProtectedItemType: to.Ptr(""), + // ProtectionState: to.Ptr("Protected"), + // ProtectionStateDescription: to.Ptr("Protected"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.InMageRcmReplicationDetails{ + // InstanceType: to.Ptr("InMageRcm"), + // }, + // RecoveryContainerID: to.Ptr("/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/Ayan-0106-SA-RG/providers/Microsoft.RecoveryServices/vaults/Ayan-0106-SA-Vault/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5/replicationProtectionContainers/d38048d4-b460-4791-8ece-108395ee8478"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // RecoveryProtectionContainerFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/Ayan-0106-SA-RG/providers/Microsoft.RecoveryServices/vaults/Ayan-0106-SA-Vault/replicationFabrics/Ayan-0106-SA-Vaultreplicationfabric/replicationRecoveryServicesProviders/a552cf2d-bbb3-4d78-8145-e1992ecb31d1"), + // ReplicationHealth: to.Ptr("Normal"), + // TestFailoverState: to.Ptr("None"), + // TestFailoverStateDescription: to.Ptr("None"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_UpdateMobilityService.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_UpdateMobilityService.json func ExampleReplicationProtectedItemsClient_BeginUpdateMobilityService() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectedItemsClient("WCUSVault", "wcusValidations", "b364ed8d-4279-4bf8-8fd1-56f8fa0ae05c", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdateMobilityService(ctx, "WIN-JKKJ31QI8U2", "cloud_c6780228-83bd-4f3e-a70e-cb46b7da33a0", "79dd20ab-2b40-11e7-9791-0050568f387e", armrecoveryservicessiterecovery.UpdateMobilityServiceRequest{ + poller, err := clientFactory.NewReplicationProtectedItemsClient().BeginUpdateMobilityService(ctx, "WCUSVault", "wcusValidations", "WIN-JKKJ31QI8U2", "cloud_c6780228-83bd-4f3e-a70e-cb46b7da33a0", "79dd20ab-2b40-11e7-9791-0050568f387e", armrecoveryservicessiterecovery.UpdateMobilityServiceRequest{ Properties: &armrecoveryservicessiterecovery.UpdateMobilityServiceRequestProperties{ RunAsAccountID: to.Ptr("2"), }, @@ -616,32 +1353,112 @@ func ExampleReplicationProtectedItemsClient_BeginUpdateMobilityService() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReplicationProtectedItem = armrecoveryservicessiterecovery.ReplicationProtectedItem{ + // Name: to.Ptr("79dd20ab-2b40-11e7-9791-0050568f387e"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems"), + // ID: to.Ptr("/Subscriptions/b364ed8d-4279-4bf8-8fd1-56f8fa0ae05c/resourceGroups/wcusValidations/providers/Microsoft.RecoveryServices/vaults/WCUSVault/replicationFabrics/d70b0326a201008a953505ef271dc908e5e23468bc7356862ea178696f5f15c7/replicationProtectionContainers/cloud_c6780228-83bd-4f3e-a70e-cb46b7da33a0/replicationProtectedItems/79dd20ab-2b40-11e7-9791-0050568f387e"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectedItemProperties{ + // ActiveLocation: to.Ptr("Primary"), + // AllowedOperations: []*string{ + // to.Ptr("UnplannedFailover"), + // to.Ptr("DisableProtection"), + // to.Ptr("TestFailover")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/b364ed8d-4279-4bf8-8fd1-56f8fa0ae05c/resourceGroups/wcusValidations/providers/Microsoft.RecoveryServices/vaults/WCUSVault/replicationJobs/None"), + // ScenarioName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1753-01-01T01:01:01Z"); return t}()), + // }, + // FriendlyName: to.Ptr("MMR-LIN-V2A-3"), + // PolicyFriendlyName: to.Ptr("MadhaviPolicyNew"), + // PolicyID: to.Ptr("/Subscriptions/b364ed8d-4279-4bf8-8fd1-56f8fa0ae05c/resourceGroups/wcusValidations/providers/Microsoft.RecoveryServices/vaults/WCUSVault/replicationPolicies/MadhaviPolicyNew"), + // PrimaryFabricFriendlyName: to.Ptr("WIN-JKKJ31QI8U2"), + // PrimaryProtectionContainerFriendlyName: to.Ptr("WIN-JKKJ31QI8U2"), + // ProtectableItemID: to.Ptr("/Subscriptions/b364ed8d-4279-4bf8-8fd1-56f8fa0ae05c/resourceGroups/wcusValidations/providers/Microsoft.RecoveryServices/vaults/WCUSVault/replicationFabrics/d70b0326a201008a953505ef271dc908e5e23468bc7356862ea178696f5f15c7/replicationProtectionContainers/cloud_c6780228-83bd-4f3e-a70e-cb46b7da33a0/replicationProtectableItems/79dd20ab-2b40-11e7-9791-0050568f387e"), + // ProtectedItemType: to.Ptr(""), + // ProtectionState: to.Ptr("Protected"), + // ProtectionStateDescription: to.Ptr("Protected"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.InMageAzureV2ReplicationDetails{ + // InstanceType: to.Ptr("InMageAzureV2"), + // }, + // RecoveryContainerID: to.Ptr("/Subscriptions/b364ed8d-4279-4bf8-8fd1-56f8fa0ae05c/resourceGroups/wcusValidations/providers/Microsoft.RecoveryServices/vaults/WCUSVault/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5/replicationProtectionContainers/d38048d4-b460-4791-8ece-108395ee8478"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // RecoveryProtectionContainerFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/b364ed8d-4279-4bf8-8fd1-56f8fa0ae05c/resourceGroups/wcusValidations/providers/Microsoft.RecoveryServices/vaults/WCUSVault/replicationFabrics/d70b0326a201008a953505ef271dc908e5e23468bc7356862ea178696f5f15c7/replicationRecoveryServicesProviders/c6780228-83bd-4f3e-a70e-cb46b7da33a0"), + // ReplicationHealth: to.Ptr("Normal"), + // TestFailoverState: to.Ptr("None"), + // TestFailoverStateDescription: to.Ptr("None"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_List.json func ExampleReplicationProtectedItemsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectedItemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(&armrecoveryservicessiterecovery.ReplicationProtectedItemsClientListOptions{SkipToken: nil, + pager := clientFactory.NewReplicationProtectedItemsClient().NewListPager("vault1", "resourceGroupPS1", &armrecoveryservicessiterecovery.ReplicationProtectedItemsClientListOptions{SkipToken: nil, Filter: nil, }) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.ReplicationProtectedItemCollection = armrecoveryservicessiterecovery.ReplicationProtectedItemCollection{ + // Value: []*armrecoveryservicessiterecovery.ReplicationProtectedItem{ + // { + // Name: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectedItemProperties{ + // ActiveLocation: to.Ptr("Primary"), + // AllowedOperations: []*string{ + // to.Ptr("PlannedFailover"), + // to.Ptr("UnplannedFailover"), + // to.Ptr("DisableProtection"), + // to.Ptr("TestFailover")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/None"), + // ScenarioName: to.Ptr("None"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1753-01-01T01:01:01Z"); return t}()), + // }, + // FriendlyName: to.Ptr("vm1"), + // PolicyFriendlyName: to.Ptr("protectionprofile1"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryProtectionContainerFriendlyName: to.Ptr("cloud1"), + // ProtectableItemID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectableItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // ProtectedItemType: to.Ptr("HyperVVirtualMachine"), + // ProtectionState: to.Ptr("Protected"), + // ProtectionStateDescription: to.Ptr("Protected"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.HyperVReplicaAzureReplicationDetails{ + // InstanceType: to.Ptr("HyperVReplicaAzure"), + // }, + // RecoveryContainerID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/d49858f157601230a6ac5862fbbc6e63bf38d23ecd96cf953767945d457fe9d5/replicationProtectionContainers/d38048d4-b460-4791-8ece-108395ee8478"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // RecoveryProtectionContainerFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryServicesProviderID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/241641e6-ee7b-4ee4-8141-821fadda43fa"), + // ReplicationHealth: to.Ptr("Normal"), + // TestFailoverState: to.Ptr("None"), + // TestFailoverStateDescription: to.Ptr("None"), + // }, + // }}, + // } } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectioncontainermappings_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectioncontainermappings_client.go index 6d05e4899956..34d429d63661 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectioncontainermappings_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectioncontainermappings_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,71 +24,60 @@ import ( // ReplicationProtectionContainerMappingsClient contains the methods for the ReplicationProtectionContainerMappings group. // Don't use this type directly, use NewReplicationProtectionContainerMappingsClient() instead. type ReplicationProtectionContainerMappingsClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationProtectionContainerMappingsClient creates a new instance of ReplicationProtectionContainerMappingsClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationProtectionContainerMappingsClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationProtectionContainerMappingsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationProtectionContainerMappingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationProtectionContainerMappingsClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationProtectionContainerMappingsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationProtectionContainerMappingsClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // BeginCreate - The operation to create a protection container mapping. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// mappingName - Protection container mapping name. -// creationInput - Mapping creation input. -// options - ReplicationProtectionContainerMappingsClientBeginCreateOptions contains the optional parameters for the ReplicationProtectionContainerMappingsClient.BeginCreate -// method. -func (client *ReplicationProtectionContainerMappingsClient) BeginCreate(ctx context.Context, fabricName string, protectionContainerName string, mappingName string, creationInput CreateProtectionContainerMappingInput, options *ReplicationProtectionContainerMappingsClientBeginCreateOptions) (*runtime.Poller[ReplicationProtectionContainerMappingsClientCreateResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - mappingName - Protection container mapping name. +// - creationInput - Mapping creation input. +// - options - ReplicationProtectionContainerMappingsClientBeginCreateOptions contains the optional parameters for the ReplicationProtectionContainerMappingsClient.BeginCreate +// method. +func (client *ReplicationProtectionContainerMappingsClient) BeginCreate(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, mappingName string, creationInput CreateProtectionContainerMappingInput, options *ReplicationProtectionContainerMappingsClientBeginCreateOptions) (*runtime.Poller[ReplicationProtectionContainerMappingsClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, fabricName, protectionContainerName, mappingName, creationInput, options) + resp, err := client.create(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, creationInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectionContainerMappingsClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectionContainerMappingsClientCreateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectionContainerMappingsClientCreateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectionContainerMappingsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Create - The operation to create a protection container mapping. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectionContainerMappingsClient) create(ctx context.Context, fabricName string, protectionContainerName string, mappingName string, creationInput CreateProtectionContainerMappingInput, options *ReplicationProtectionContainerMappingsClientBeginCreateOptions) (*http.Response, error) { - req, err := client.createCreateRequest(ctx, fabricName, protectionContainerName, mappingName, creationInput, options) +func (client *ReplicationProtectionContainerMappingsClient) create(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, mappingName string, creationInput CreateProtectionContainerMappingInput, options *ReplicationProtectionContainerMappingsClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, creationInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -101,16 +88,16 @@ func (client *ReplicationProtectionContainerMappingsClient) create(ctx context.C } // createCreateRequest creates the Create request. -func (client *ReplicationProtectionContainerMappingsClient) createCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, mappingName string, creationInput CreateProtectionContainerMappingInput, options *ReplicationProtectionContainerMappingsClientBeginCreateOptions) (*policy.Request, error) { +func (client *ReplicationProtectionContainerMappingsClient) createCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, mappingName string, creationInput CreateProtectionContainerMappingInput, options *ReplicationProtectionContainerMappingsClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -127,7 +114,7 @@ func (client *ReplicationProtectionContainerMappingsClient) createCreateRequest( return nil, errors.New("parameter mappingName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{mappingName}", url.PathEscape(mappingName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -140,34 +127,38 @@ func (client *ReplicationProtectionContainerMappingsClient) createCreateRequest( // BeginDelete - The operation to delete or remove a protection container mapping. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// mappingName - Protection container mapping name. -// removalInput - Removal input. -// options - ReplicationProtectionContainerMappingsClientBeginDeleteOptions contains the optional parameters for the ReplicationProtectionContainerMappingsClient.BeginDelete -// method. -func (client *ReplicationProtectionContainerMappingsClient) BeginDelete(ctx context.Context, fabricName string, protectionContainerName string, mappingName string, removalInput RemoveProtectionContainerMappingInput, options *ReplicationProtectionContainerMappingsClientBeginDeleteOptions) (*runtime.Poller[ReplicationProtectionContainerMappingsClientDeleteResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - mappingName - Protection container mapping name. +// - removalInput - Removal input. +// - options - ReplicationProtectionContainerMappingsClientBeginDeleteOptions contains the optional parameters for the ReplicationProtectionContainerMappingsClient.BeginDelete +// method. +func (client *ReplicationProtectionContainerMappingsClient) BeginDelete(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, mappingName string, removalInput RemoveProtectionContainerMappingInput, options *ReplicationProtectionContainerMappingsClientBeginDeleteOptions) (*runtime.Poller[ReplicationProtectionContainerMappingsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, fabricName, protectionContainerName, mappingName, removalInput, options) + resp, err := client.deleteOperation(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, removalInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectionContainerMappingsClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectionContainerMappingsClientDeleteResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectionContainerMappingsClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectionContainerMappingsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - The operation to delete or remove a protection container mapping. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectionContainerMappingsClient) deleteOperation(ctx context.Context, fabricName string, protectionContainerName string, mappingName string, removalInput RemoveProtectionContainerMappingInput, options *ReplicationProtectionContainerMappingsClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, fabricName, protectionContainerName, mappingName, removalInput, options) +func (client *ReplicationProtectionContainerMappingsClient) deleteOperation(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, mappingName string, removalInput RemoveProtectionContainerMappingInput, options *ReplicationProtectionContainerMappingsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, removalInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -178,16 +169,16 @@ func (client *ReplicationProtectionContainerMappingsClient) deleteOperation(ctx } // deleteCreateRequest creates the Delete request. -func (client *ReplicationProtectionContainerMappingsClient) deleteCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, mappingName string, removalInput RemoveProtectionContainerMappingInput, options *ReplicationProtectionContainerMappingsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ReplicationProtectionContainerMappingsClient) deleteCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, mappingName string, removalInput RemoveProtectionContainerMappingInput, options *ReplicationProtectionContainerMappingsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}/remove" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -204,7 +195,7 @@ func (client *ReplicationProtectionContainerMappingsClient) deleteCreateRequest( return nil, errors.New("parameter mappingName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{mappingName}", url.PathEscape(mappingName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -216,18 +207,21 @@ func (client *ReplicationProtectionContainerMappingsClient) deleteCreateRequest( // Get - Gets the details of a protection container mapping. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// mappingName - Protection Container mapping name. -// options - ReplicationProtectionContainerMappingsClientGetOptions contains the optional parameters for the ReplicationProtectionContainerMappingsClient.Get -// method. -func (client *ReplicationProtectionContainerMappingsClient) Get(ctx context.Context, fabricName string, protectionContainerName string, mappingName string, options *ReplicationProtectionContainerMappingsClientGetOptions) (ReplicationProtectionContainerMappingsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, fabricName, protectionContainerName, mappingName, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - mappingName - Protection Container mapping name. +// - options - ReplicationProtectionContainerMappingsClientGetOptions contains the optional parameters for the ReplicationProtectionContainerMappingsClient.Get +// method. +func (client *ReplicationProtectionContainerMappingsClient) Get(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, mappingName string, options *ReplicationProtectionContainerMappingsClientGetOptions) (ReplicationProtectionContainerMappingsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, options) if err != nil { return ReplicationProtectionContainerMappingsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationProtectionContainerMappingsClientGetResponse{}, err } @@ -238,16 +232,16 @@ func (client *ReplicationProtectionContainerMappingsClient) Get(ctx context.Cont } // getCreateRequest creates the Get request. -func (client *ReplicationProtectionContainerMappingsClient) getCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, mappingName string, options *ReplicationProtectionContainerMappingsClientGetOptions) (*policy.Request, error) { +func (client *ReplicationProtectionContainerMappingsClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, mappingName string, options *ReplicationProtectionContainerMappingsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -264,7 +258,7 @@ func (client *ReplicationProtectionContainerMappingsClient) getCreateRequest(ctx return nil, errors.New("parameter mappingName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{mappingName}", url.PathEscape(mappingName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -285,10 +279,13 @@ func (client *ReplicationProtectionContainerMappingsClient) getHandleResponse(re } // NewListPager - Lists the protection container mappings in the vault. +// // Generated from API version 2022-10-01 -// options - ReplicationProtectionContainerMappingsClientListOptions contains the optional parameters for the ReplicationProtectionContainerMappingsClient.List -// method. -func (client *ReplicationProtectionContainerMappingsClient) NewListPager(options *ReplicationProtectionContainerMappingsClientListOptions) *runtime.Pager[ReplicationProtectionContainerMappingsClientListResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - ReplicationProtectionContainerMappingsClientListOptions contains the optional parameters for the ReplicationProtectionContainerMappingsClient.NewListPager +// method. +func (client *ReplicationProtectionContainerMappingsClient) NewListPager(resourceName string, resourceGroupName string, options *ReplicationProtectionContainerMappingsClientListOptions) *runtime.Pager[ReplicationProtectionContainerMappingsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationProtectionContainerMappingsClientListResponse]{ More: func(page ReplicationProtectionContainerMappingsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -297,14 +294,14 @@ func (client *ReplicationProtectionContainerMappingsClient) NewListPager(options var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, resourceName, resourceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationProtectionContainerMappingsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationProtectionContainerMappingsClientListResponse{}, err } @@ -317,21 +314,21 @@ func (client *ReplicationProtectionContainerMappingsClient) NewListPager(options } // listCreateRequest creates the List request. -func (client *ReplicationProtectionContainerMappingsClient) listCreateRequest(ctx context.Context, options *ReplicationProtectionContainerMappingsClientListOptions) (*policy.Request, error) { +func (client *ReplicationProtectionContainerMappingsClient) listCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationProtectionContainerMappingsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainerMappings" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -352,12 +349,15 @@ func (client *ReplicationProtectionContainerMappingsClient) listHandleResponse(r } // NewListByReplicationProtectionContainersPager - Lists the protection container mappings for a protection container. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// options - ReplicationProtectionContainerMappingsClientListByReplicationProtectionContainersOptions contains the optional -// parameters for the ReplicationProtectionContainerMappingsClient.ListByReplicationProtectionContainers method. -func (client *ReplicationProtectionContainerMappingsClient) NewListByReplicationProtectionContainersPager(fabricName string, protectionContainerName string, options *ReplicationProtectionContainerMappingsClientListByReplicationProtectionContainersOptions) *runtime.Pager[ReplicationProtectionContainerMappingsClientListByReplicationProtectionContainersResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - options - ReplicationProtectionContainerMappingsClientListByReplicationProtectionContainersOptions contains the optional +// parameters for the ReplicationProtectionContainerMappingsClient.NewListByReplicationProtectionContainersPager method. +func (client *ReplicationProtectionContainerMappingsClient) NewListByReplicationProtectionContainersPager(resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, options *ReplicationProtectionContainerMappingsClientListByReplicationProtectionContainersOptions) *runtime.Pager[ReplicationProtectionContainerMappingsClientListByReplicationProtectionContainersResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationProtectionContainerMappingsClientListByReplicationProtectionContainersResponse]{ More: func(page ReplicationProtectionContainerMappingsClientListByReplicationProtectionContainersResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -366,14 +366,14 @@ func (client *ReplicationProtectionContainerMappingsClient) NewListByReplication var req *policy.Request var err error if page == nil { - req, err = client.listByReplicationProtectionContainersCreateRequest(ctx, fabricName, protectionContainerName, options) + req, err = client.listByReplicationProtectionContainersCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationProtectionContainerMappingsClientListByReplicationProtectionContainersResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationProtectionContainerMappingsClientListByReplicationProtectionContainersResponse{}, err } @@ -386,16 +386,16 @@ func (client *ReplicationProtectionContainerMappingsClient) NewListByReplication } // listByReplicationProtectionContainersCreateRequest creates the ListByReplicationProtectionContainers request. -func (client *ReplicationProtectionContainerMappingsClient) listByReplicationProtectionContainersCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, options *ReplicationProtectionContainerMappingsClientListByReplicationProtectionContainersOptions) (*policy.Request, error) { +func (client *ReplicationProtectionContainerMappingsClient) listByReplicationProtectionContainersCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, options *ReplicationProtectionContainerMappingsClientListByReplicationProtectionContainersOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -408,7 +408,7 @@ func (client *ReplicationProtectionContainerMappingsClient) listByReplicationPro return nil, errors.New("parameter protectionContainerName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{protectionContainerName}", url.PathEscape(protectionContainerName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -430,33 +430,37 @@ func (client *ReplicationProtectionContainerMappingsClient) listByReplicationPro // BeginPurge - The operation to purge(force delete) a protection container mapping. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// mappingName - Protection container mapping name. -// options - ReplicationProtectionContainerMappingsClientBeginPurgeOptions contains the optional parameters for the ReplicationProtectionContainerMappingsClient.BeginPurge -// method. -func (client *ReplicationProtectionContainerMappingsClient) BeginPurge(ctx context.Context, fabricName string, protectionContainerName string, mappingName string, options *ReplicationProtectionContainerMappingsClientBeginPurgeOptions) (*runtime.Poller[ReplicationProtectionContainerMappingsClientPurgeResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - mappingName - Protection container mapping name. +// - options - ReplicationProtectionContainerMappingsClientBeginPurgeOptions contains the optional parameters for the ReplicationProtectionContainerMappingsClient.BeginPurge +// method. +func (client *ReplicationProtectionContainerMappingsClient) BeginPurge(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, mappingName string, options *ReplicationProtectionContainerMappingsClientBeginPurgeOptions) (*runtime.Poller[ReplicationProtectionContainerMappingsClientPurgeResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.purge(ctx, fabricName, protectionContainerName, mappingName, options) + resp, err := client.purge(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectionContainerMappingsClientPurgeResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectionContainerMappingsClientPurgeResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectionContainerMappingsClientPurgeResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectionContainerMappingsClientPurgeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Purge - The operation to purge(force delete) a protection container mapping. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectionContainerMappingsClient) purge(ctx context.Context, fabricName string, protectionContainerName string, mappingName string, options *ReplicationProtectionContainerMappingsClientBeginPurgeOptions) (*http.Response, error) { - req, err := client.purgeCreateRequest(ctx, fabricName, protectionContainerName, mappingName, options) +func (client *ReplicationProtectionContainerMappingsClient) purge(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, mappingName string, options *ReplicationProtectionContainerMappingsClientBeginPurgeOptions) (*http.Response, error) { + req, err := client.purgeCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -467,16 +471,16 @@ func (client *ReplicationProtectionContainerMappingsClient) purge(ctx context.Co } // purgeCreateRequest creates the Purge request. -func (client *ReplicationProtectionContainerMappingsClient) purgeCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, mappingName string, options *ReplicationProtectionContainerMappingsClientBeginPurgeOptions) (*policy.Request, error) { +func (client *ReplicationProtectionContainerMappingsClient) purgeCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, mappingName string, options *ReplicationProtectionContainerMappingsClientBeginPurgeOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -493,7 +497,7 @@ func (client *ReplicationProtectionContainerMappingsClient) purgeCreateRequest(c return nil, errors.New("parameter mappingName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{mappingName}", url.PathEscape(mappingName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -505,34 +509,38 @@ func (client *ReplicationProtectionContainerMappingsClient) purgeCreateRequest(c // BeginUpdate - The operation to update protection container mapping. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// mappingName - Protection container mapping name. -// updateInput - Mapping update input. -// options - ReplicationProtectionContainerMappingsClientBeginUpdateOptions contains the optional parameters for the ReplicationProtectionContainerMappingsClient.BeginUpdate -// method. -func (client *ReplicationProtectionContainerMappingsClient) BeginUpdate(ctx context.Context, fabricName string, protectionContainerName string, mappingName string, updateInput UpdateProtectionContainerMappingInput, options *ReplicationProtectionContainerMappingsClientBeginUpdateOptions) (*runtime.Poller[ReplicationProtectionContainerMappingsClientUpdateResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - mappingName - Protection container mapping name. +// - updateInput - Mapping update input. +// - options - ReplicationProtectionContainerMappingsClientBeginUpdateOptions contains the optional parameters for the ReplicationProtectionContainerMappingsClient.BeginUpdate +// method. +func (client *ReplicationProtectionContainerMappingsClient) BeginUpdate(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, mappingName string, updateInput UpdateProtectionContainerMappingInput, options *ReplicationProtectionContainerMappingsClientBeginUpdateOptions) (*runtime.Poller[ReplicationProtectionContainerMappingsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, fabricName, protectionContainerName, mappingName, updateInput, options) + resp, err := client.update(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, updateInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectionContainerMappingsClientUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectionContainerMappingsClientUpdateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectionContainerMappingsClientUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectionContainerMappingsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Update - The operation to update protection container mapping. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectionContainerMappingsClient) update(ctx context.Context, fabricName string, protectionContainerName string, mappingName string, updateInput UpdateProtectionContainerMappingInput, options *ReplicationProtectionContainerMappingsClientBeginUpdateOptions) (*http.Response, error) { - req, err := client.updateCreateRequest(ctx, fabricName, protectionContainerName, mappingName, updateInput, options) +func (client *ReplicationProtectionContainerMappingsClient) update(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, mappingName string, updateInput UpdateProtectionContainerMappingInput, options *ReplicationProtectionContainerMappingsClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, mappingName, updateInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -543,16 +551,16 @@ func (client *ReplicationProtectionContainerMappingsClient) update(ctx context.C } // updateCreateRequest creates the Update request. -func (client *ReplicationProtectionContainerMappingsClient) updateCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, mappingName string, updateInput UpdateProtectionContainerMappingInput, options *ReplicationProtectionContainerMappingsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *ReplicationProtectionContainerMappingsClient) updateCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, mappingName string, updateInput UpdateProtectionContainerMappingInput, options *ReplicationProtectionContainerMappingsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -569,7 +577,7 @@ func (client *ReplicationProtectionContainerMappingsClient) updateCreateRequest( return nil, errors.New("parameter mappingName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{mappingName}", url.PathEscape(mappingName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectioncontainermappings_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectioncontainermappings_client_example_test.go index 8d850805a459..e04c9773469b 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectioncontainermappings_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectioncontainermappings_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -14,64 +15,105 @@ import ( "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/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_ListByReplicationProtectionContainers.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_ListByReplicationProtectionContainers.json func ExampleReplicationProtectionContainerMappingsClient_NewListByReplicationProtectionContainersPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectionContainerMappingsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByReplicationProtectionContainersPager("cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", nil) + pager := clientFactory.NewReplicationProtectionContainerMappingsClient().NewListByReplicationProtectionContainersPager("vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.ProtectionContainerMappingCollection = armrecoveryservicessiterecovery.ProtectionContainerMappingCollection{ + // Value: []*armrecoveryservicessiterecovery.ProtectionContainerMapping{ + // { + // Name: to.Ptr("cloud1protectionprofile1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectionContainerMappings"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectionContainerMappings/cloud1protectionprofile1"), + // Properties: &armrecoveryservicessiterecovery.ProtectionContainerMappingProperties{ + // Health: to.Ptr("Normal"), + // HealthErrorDetails: []*armrecoveryservicessiterecovery.HealthError{ + // }, + // PolicyFriendlyName: to.Ptr("protectionprofile1"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // SourceFabricFriendlyName: to.Ptr("cloud1"), + // SourceProtectionContainerFriendlyName: to.Ptr("cloud1"), + // State: to.Ptr("Paired"), + // TargetFabricFriendlyName: to.Ptr("Microsoft Azure"), + // TargetProtectionContainerFriendlyName: to.Ptr("Microsoft Azure"), + // TargetProtectionContainerID: to.Ptr("Microsoft Azure"), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_Get.json func ExampleReplicationProtectionContainerMappingsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectionContainerMappingsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "cloud1protectionprofile1", nil) + res, err := clientFactory.NewReplicationProtectionContainerMappingsClient().Get(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "cloud1protectionprofile1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ProtectionContainerMapping = armrecoveryservicessiterecovery.ProtectionContainerMapping{ + // Name: to.Ptr("cloud1protectionprofile1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectionContainerMappings"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectionContainerMappings/cloud1protectionprofile1"), + // Properties: &armrecoveryservicessiterecovery.ProtectionContainerMappingProperties{ + // Health: to.Ptr("Normal"), + // HealthErrorDetails: []*armrecoveryservicessiterecovery.HealthError{ + // }, + // PolicyFriendlyName: to.Ptr("protectionprofile1"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // SourceFabricFriendlyName: to.Ptr("cloud1"), + // SourceProtectionContainerFriendlyName: to.Ptr("cloud1"), + // State: to.Ptr("Paired"), + // TargetFabricFriendlyName: to.Ptr("Microsoft Azure"), + // TargetProtectionContainerFriendlyName: to.Ptr("Microsoft Azure"), + // TargetProtectionContainerID: to.Ptr("Microsoft Azure"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_Create.json func ExampleReplicationProtectionContainerMappingsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectionContainerMappingsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreate(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "cloud1protectionprofile1", armrecoveryservicessiterecovery.CreateProtectionContainerMappingInput{ + poller, err := clientFactory.NewReplicationProtectionContainerMappingsClient().BeginCreate(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "cloud1protectionprofile1", armrecoveryservicessiterecovery.CreateProtectionContainerMappingInput{ Properties: &armrecoveryservicessiterecovery.CreateProtectionContainerMappingInputProperties{ PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), ProviderSpecificInput: &armrecoveryservicessiterecovery.ReplicationProviderSpecificContainerMappingInput{ @@ -87,22 +129,41 @@ func ExampleReplicationProtectionContainerMappingsClient_BeginCreate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ProtectionContainerMapping = armrecoveryservicessiterecovery.ProtectionContainerMapping{ + // Name: to.Ptr("cloud1protectionprofile1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectionContainerMappings"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectionContainerMappings/cloud1protectionprofile1"), + // Properties: &armrecoveryservicessiterecovery.ProtectionContainerMappingProperties{ + // Health: to.Ptr("Normal"), + // HealthErrorDetails: []*armrecoveryservicessiterecovery.HealthError{ + // }, + // PolicyFriendlyName: to.Ptr("protectionprofile1"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // SourceFabricFriendlyName: to.Ptr("cloud1"), + // SourceProtectionContainerFriendlyName: to.Ptr("cloud1"), + // State: to.Ptr("Paired"), + // TargetFabricFriendlyName: to.Ptr("Microsoft Azure"), + // TargetProtectionContainerFriendlyName: to.Ptr("Microsoft Azure"), + // TargetProtectionContainerID: to.Ptr("Microsoft Azure"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_Purge.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_Purge.json func ExampleReplicationProtectionContainerMappingsClient_BeginPurge() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectionContainerMappingsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginPurge(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "cloud1protectionprofile1", nil) + poller, err := clientFactory.NewReplicationProtectionContainerMappingsClient().BeginPurge(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "cloud1protectionprofile1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -112,18 +173,18 @@ func ExampleReplicationProtectionContainerMappingsClient_BeginPurge() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_Update.json func ExampleReplicationProtectionContainerMappingsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectionContainerMappingsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "cloud1protectionprofile1", armrecoveryservicessiterecovery.UpdateProtectionContainerMappingInput{ + poller, err := clientFactory.NewReplicationProtectionContainerMappingsClient().BeginUpdate(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "cloud1protectionprofile1", armrecoveryservicessiterecovery.UpdateProtectionContainerMappingInput{ Properties: &armrecoveryservicessiterecovery.UpdateProtectionContainerMappingInputProperties{ ProviderSpecificInput: &armrecoveryservicessiterecovery.A2AUpdateContainerMappingInput{ InstanceType: to.Ptr("A2A"), @@ -139,22 +200,48 @@ func ExampleReplicationProtectionContainerMappingsClient_BeginUpdate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ProtectionContainerMapping = armrecoveryservicessiterecovery.ProtectionContainerMapping{ + // Name: to.Ptr("cloud1protectionprofile1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectionContainerMappings"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectionContainerMappings/cloud1protectionprofile1"), + // Properties: &armrecoveryservicessiterecovery.ProtectionContainerMappingProperties{ + // Health: to.Ptr("Normal"), + // HealthErrorDetails: []*armrecoveryservicessiterecovery.HealthError{ + // }, + // PolicyFriendlyName: to.Ptr("protectionprofile1"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.A2AProtectionContainerMappingDetails{ + // InstanceType: to.Ptr("A2A"), + // AgentAutoUpdateStatus: to.Ptr(armrecoveryservicessiterecovery.AgentAutoUpdateStatusEnabled), + // AutomationAccountArmID: to.Ptr("/subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/automationrg1/providers/Microsoft.Automation/automationAccounts/automationaccount1"), + // JobScheduleName: to.Ptr("ffd503ec-5f88-4b58-97c8-841466e7aa47"), + // ScheduleName: to.Ptr("cloud1protectionprofile1_a85ea38f-62a8-471b-93cc-69b74fd9578c"), + // }, + // SourceFabricFriendlyName: to.Ptr("cloud1"), + // SourceProtectionContainerFriendlyName: to.Ptr("cloud1"), + // State: to.Ptr("Paired"), + // TargetFabricFriendlyName: to.Ptr("Microsoft Azure"), + // TargetProtectionContainerFriendlyName: to.Ptr("Microsoft Azure"), + // TargetProtectionContainerID: to.Ptr("Microsoft Azure"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_Delete.json func ExampleReplicationProtectionContainerMappingsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectionContainerMappingsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "cloud1protectionprofile1", armrecoveryservicessiterecovery.RemoveProtectionContainerMappingInput{ + poller, err := clientFactory.NewReplicationProtectionContainerMappingsClient().BeginDelete(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", "cloud1protectionprofile1", armrecoveryservicessiterecovery.RemoveProtectionContainerMappingInput{ Properties: &armrecoveryservicessiterecovery.RemoveProtectionContainerMappingInputProperties{ ProviderSpecificInput: &armrecoveryservicessiterecovery.ReplicationProviderContainerUnmappingInput{}, }, @@ -168,26 +255,48 @@ func ExampleReplicationProtectionContainerMappingsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_List.json func ExampleReplicationProtectionContainerMappingsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectionContainerMappingsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(nil) + pager := clientFactory.NewReplicationProtectionContainerMappingsClient().NewListPager("vault1", "resourceGroupPS1", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.ProtectionContainerMappingCollection = armrecoveryservicessiterecovery.ProtectionContainerMappingCollection{ + // Value: []*armrecoveryservicessiterecovery.ProtectionContainerMapping{ + // { + // Name: to.Ptr("cloud1protectionprofile1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationProtectionContainerMappings"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectionContainerMappings/cloud1protectionprofile1"), + // Properties: &armrecoveryservicessiterecovery.ProtectionContainerMappingProperties{ + // Health: to.Ptr("Normal"), + // HealthErrorDetails: []*armrecoveryservicessiterecovery.HealthError{ + // }, + // PolicyFriendlyName: to.Ptr("protectionprofile1"), + // PolicyID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationPolicies/protectionprofile1"), + // SourceFabricFriendlyName: to.Ptr("cloud1"), + // SourceProtectionContainerFriendlyName: to.Ptr("cloud1"), + // State: to.Ptr("Paired"), + // TargetFabricFriendlyName: to.Ptr("Microsoft Azure"), + // TargetProtectionContainerFriendlyName: to.Ptr("Microsoft Azure"), + // TargetProtectionContainerID: to.Ptr("Microsoft Azure"), + // }, + // }}, + // } } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectioncontainers_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectioncontainers_client.go index 272f556ddc86..6ba1902face0 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectioncontainers_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectioncontainers_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,70 +24,59 @@ import ( // ReplicationProtectionContainersClient contains the methods for the ReplicationProtectionContainers group. // Don't use this type directly, use NewReplicationProtectionContainersClient() instead. type ReplicationProtectionContainersClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationProtectionContainersClient creates a new instance of ReplicationProtectionContainersClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationProtectionContainersClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationProtectionContainersClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationProtectionContainersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationProtectionContainersClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationProtectionContainersClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationProtectionContainersClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // BeginCreate - Operation to create a protection container. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Unique fabric ARM name. -// protectionContainerName - Unique protection container ARM name. -// creationInput - Creation input. -// options - ReplicationProtectionContainersClientBeginCreateOptions contains the optional parameters for the ReplicationProtectionContainersClient.BeginCreate -// method. -func (client *ReplicationProtectionContainersClient) BeginCreate(ctx context.Context, fabricName string, protectionContainerName string, creationInput CreateProtectionContainerInput, options *ReplicationProtectionContainersClientBeginCreateOptions) (*runtime.Poller[ReplicationProtectionContainersClientCreateResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Unique fabric ARM name. +// - protectionContainerName - Unique protection container ARM name. +// - creationInput - Creation input. +// - options - ReplicationProtectionContainersClientBeginCreateOptions contains the optional parameters for the ReplicationProtectionContainersClient.BeginCreate +// method. +func (client *ReplicationProtectionContainersClient) BeginCreate(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, creationInput CreateProtectionContainerInput, options *ReplicationProtectionContainersClientBeginCreateOptions) (*runtime.Poller[ReplicationProtectionContainersClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, fabricName, protectionContainerName, creationInput, options) + resp, err := client.create(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, creationInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectionContainersClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectionContainersClientCreateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectionContainersClientCreateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectionContainersClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Create - Operation to create a protection container. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectionContainersClient) create(ctx context.Context, fabricName string, protectionContainerName string, creationInput CreateProtectionContainerInput, options *ReplicationProtectionContainersClientBeginCreateOptions) (*http.Response, error) { - req, err := client.createCreateRequest(ctx, fabricName, protectionContainerName, creationInput, options) +func (client *ReplicationProtectionContainersClient) create(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, creationInput CreateProtectionContainerInput, options *ReplicationProtectionContainersClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, creationInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -100,16 +87,16 @@ func (client *ReplicationProtectionContainersClient) create(ctx context.Context, } // createCreateRequest creates the Create request. -func (client *ReplicationProtectionContainersClient) createCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, creationInput CreateProtectionContainerInput, options *ReplicationProtectionContainersClientBeginCreateOptions) (*policy.Request, error) { +func (client *ReplicationProtectionContainersClient) createCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, creationInput CreateProtectionContainerInput, options *ReplicationProtectionContainersClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -122,7 +109,7 @@ func (client *ReplicationProtectionContainersClient) createCreateRequest(ctx con return nil, errors.New("parameter protectionContainerName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{protectionContainerName}", url.PathEscape(protectionContainerName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -135,32 +122,36 @@ func (client *ReplicationProtectionContainersClient) createCreateRequest(ctx con // BeginDelete - Operation to remove a protection container. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Unique fabric ARM name. -// protectionContainerName - Unique protection container ARM name. -// options - ReplicationProtectionContainersClientBeginDeleteOptions contains the optional parameters for the ReplicationProtectionContainersClient.BeginDelete -// method. -func (client *ReplicationProtectionContainersClient) BeginDelete(ctx context.Context, fabricName string, protectionContainerName string, options *ReplicationProtectionContainersClientBeginDeleteOptions) (*runtime.Poller[ReplicationProtectionContainersClientDeleteResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Unique fabric ARM name. +// - protectionContainerName - Unique protection container ARM name. +// - options - ReplicationProtectionContainersClientBeginDeleteOptions contains the optional parameters for the ReplicationProtectionContainersClient.BeginDelete +// method. +func (client *ReplicationProtectionContainersClient) BeginDelete(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, options *ReplicationProtectionContainersClientBeginDeleteOptions) (*runtime.Poller[ReplicationProtectionContainersClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, fabricName, protectionContainerName, options) + resp, err := client.deleteOperation(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectionContainersClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectionContainersClientDeleteResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectionContainersClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectionContainersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - Operation to remove a protection container. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectionContainersClient) deleteOperation(ctx context.Context, fabricName string, protectionContainerName string, options *ReplicationProtectionContainersClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, fabricName, protectionContainerName, options) +func (client *ReplicationProtectionContainersClient) deleteOperation(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, options *ReplicationProtectionContainersClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -171,16 +162,16 @@ func (client *ReplicationProtectionContainersClient) deleteOperation(ctx context } // deleteCreateRequest creates the Delete request. -func (client *ReplicationProtectionContainersClient) deleteCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, options *ReplicationProtectionContainersClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ReplicationProtectionContainersClient) deleteCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, options *ReplicationProtectionContainersClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/remove" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -193,7 +184,7 @@ func (client *ReplicationProtectionContainersClient) deleteCreateRequest(ctx con return nil, errors.New("parameter protectionContainerName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{protectionContainerName}", url.PathEscape(protectionContainerName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -205,33 +196,37 @@ func (client *ReplicationProtectionContainersClient) deleteCreateRequest(ctx con // BeginDiscoverProtectableItem - The operation to a add a protectable item to a protection container(Add physical server). // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - The name of the fabric. -// protectionContainerName - The name of the protection container. -// discoverProtectableItemRequest - The request object to add a protectable item. -// options - ReplicationProtectionContainersClientBeginDiscoverProtectableItemOptions contains the optional parameters for -// the ReplicationProtectionContainersClient.BeginDiscoverProtectableItem method. -func (client *ReplicationProtectionContainersClient) BeginDiscoverProtectableItem(ctx context.Context, fabricName string, protectionContainerName string, discoverProtectableItemRequest DiscoverProtectableItemRequest, options *ReplicationProtectionContainersClientBeginDiscoverProtectableItemOptions) (*runtime.Poller[ReplicationProtectionContainersClientDiscoverProtectableItemResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - The name of the fabric. +// - protectionContainerName - The name of the protection container. +// - discoverProtectableItemRequest - The request object to add a protectable item. +// - options - ReplicationProtectionContainersClientBeginDiscoverProtectableItemOptions contains the optional parameters for +// the ReplicationProtectionContainersClient.BeginDiscoverProtectableItem method. +func (client *ReplicationProtectionContainersClient) BeginDiscoverProtectableItem(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, discoverProtectableItemRequest DiscoverProtectableItemRequest, options *ReplicationProtectionContainersClientBeginDiscoverProtectableItemOptions) (*runtime.Poller[ReplicationProtectionContainersClientDiscoverProtectableItemResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.discoverProtectableItem(ctx, fabricName, protectionContainerName, discoverProtectableItemRequest, options) + resp, err := client.discoverProtectableItem(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, discoverProtectableItemRequest, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectionContainersClientDiscoverProtectableItemResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectionContainersClientDiscoverProtectableItemResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectionContainersClientDiscoverProtectableItemResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectionContainersClientDiscoverProtectableItemResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // DiscoverProtectableItem - The operation to a add a protectable item to a protection container(Add physical server). // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectionContainersClient) discoverProtectableItem(ctx context.Context, fabricName string, protectionContainerName string, discoverProtectableItemRequest DiscoverProtectableItemRequest, options *ReplicationProtectionContainersClientBeginDiscoverProtectableItemOptions) (*http.Response, error) { - req, err := client.discoverProtectableItemCreateRequest(ctx, fabricName, protectionContainerName, discoverProtectableItemRequest, options) +func (client *ReplicationProtectionContainersClient) discoverProtectableItem(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, discoverProtectableItemRequest DiscoverProtectableItemRequest, options *ReplicationProtectionContainersClientBeginDiscoverProtectableItemOptions) (*http.Response, error) { + req, err := client.discoverProtectableItemCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, discoverProtectableItemRequest, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -242,16 +237,16 @@ func (client *ReplicationProtectionContainersClient) discoverProtectableItem(ctx } // discoverProtectableItemCreateRequest creates the DiscoverProtectableItem request. -func (client *ReplicationProtectionContainersClient) discoverProtectableItemCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, discoverProtectableItemRequest DiscoverProtectableItemRequest, options *ReplicationProtectionContainersClientBeginDiscoverProtectableItemOptions) (*policy.Request, error) { +func (client *ReplicationProtectionContainersClient) discoverProtectableItemCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, discoverProtectableItemRequest DiscoverProtectableItemRequest, options *ReplicationProtectionContainersClientBeginDiscoverProtectableItemOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/discoverProtectableItem" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -264,7 +259,7 @@ func (client *ReplicationProtectionContainersClient) discoverProtectableItemCrea return nil, errors.New("parameter protectionContainerName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{protectionContainerName}", url.PathEscape(protectionContainerName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -277,17 +272,20 @@ func (client *ReplicationProtectionContainersClient) discoverProtectableItemCrea // Get - Gets the details of a protection container. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - Protection container name. -// options - ReplicationProtectionContainersClientGetOptions contains the optional parameters for the ReplicationProtectionContainersClient.Get -// method. -func (client *ReplicationProtectionContainersClient) Get(ctx context.Context, fabricName string, protectionContainerName string, options *ReplicationProtectionContainersClientGetOptions) (ReplicationProtectionContainersClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, fabricName, protectionContainerName, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - Protection container name. +// - options - ReplicationProtectionContainersClientGetOptions contains the optional parameters for the ReplicationProtectionContainersClient.Get +// method. +func (client *ReplicationProtectionContainersClient) Get(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, options *ReplicationProtectionContainersClientGetOptions) (ReplicationProtectionContainersClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, options) if err != nil { return ReplicationProtectionContainersClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationProtectionContainersClientGetResponse{}, err } @@ -298,16 +296,16 @@ func (client *ReplicationProtectionContainersClient) Get(ctx context.Context, fa } // getCreateRequest creates the Get request. -func (client *ReplicationProtectionContainersClient) getCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, options *ReplicationProtectionContainersClientGetOptions) (*policy.Request, error) { +func (client *ReplicationProtectionContainersClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, options *ReplicationProtectionContainersClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -320,7 +318,7 @@ func (client *ReplicationProtectionContainersClient) getCreateRequest(ctx contex return nil, errors.New("parameter protectionContainerName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{protectionContainerName}", url.PathEscape(protectionContainerName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -341,10 +339,13 @@ func (client *ReplicationProtectionContainersClient) getHandleResponse(resp *htt } // NewListPager - Lists the protection containers in a vault. +// // Generated from API version 2022-10-01 -// options - ReplicationProtectionContainersClientListOptions contains the optional parameters for the ReplicationProtectionContainersClient.List -// method. -func (client *ReplicationProtectionContainersClient) NewListPager(options *ReplicationProtectionContainersClientListOptions) *runtime.Pager[ReplicationProtectionContainersClientListResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - ReplicationProtectionContainersClientListOptions contains the optional parameters for the ReplicationProtectionContainersClient.NewListPager +// method. +func (client *ReplicationProtectionContainersClient) NewListPager(resourceName string, resourceGroupName string, options *ReplicationProtectionContainersClientListOptions) *runtime.Pager[ReplicationProtectionContainersClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationProtectionContainersClientListResponse]{ More: func(page ReplicationProtectionContainersClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -353,14 +354,14 @@ func (client *ReplicationProtectionContainersClient) NewListPager(options *Repli var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, resourceName, resourceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationProtectionContainersClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationProtectionContainersClientListResponse{}, err } @@ -373,21 +374,21 @@ func (client *ReplicationProtectionContainersClient) NewListPager(options *Repli } // listCreateRequest creates the List request. -func (client *ReplicationProtectionContainersClient) listCreateRequest(ctx context.Context, options *ReplicationProtectionContainersClientListOptions) (*policy.Request, error) { +func (client *ReplicationProtectionContainersClient) listCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationProtectionContainersClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainers" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -408,11 +409,14 @@ func (client *ReplicationProtectionContainersClient) listHandleResponse(resp *ht } // NewListByReplicationFabricsPager - Lists the protection containers in the specified fabric. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// options - ReplicationProtectionContainersClientListByReplicationFabricsOptions contains the optional parameters for the -// ReplicationProtectionContainersClient.ListByReplicationFabrics method. -func (client *ReplicationProtectionContainersClient) NewListByReplicationFabricsPager(fabricName string, options *ReplicationProtectionContainersClientListByReplicationFabricsOptions) *runtime.Pager[ReplicationProtectionContainersClientListByReplicationFabricsResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - options - ReplicationProtectionContainersClientListByReplicationFabricsOptions contains the optional parameters for the +// ReplicationProtectionContainersClient.NewListByReplicationFabricsPager method. +func (client *ReplicationProtectionContainersClient) NewListByReplicationFabricsPager(resourceName string, resourceGroupName string, fabricName string, options *ReplicationProtectionContainersClientListByReplicationFabricsOptions) *runtime.Pager[ReplicationProtectionContainersClientListByReplicationFabricsResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationProtectionContainersClientListByReplicationFabricsResponse]{ More: func(page ReplicationProtectionContainersClientListByReplicationFabricsResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -421,14 +425,14 @@ func (client *ReplicationProtectionContainersClient) NewListByReplicationFabrics var req *policy.Request var err error if page == nil { - req, err = client.listByReplicationFabricsCreateRequest(ctx, fabricName, options) + req, err = client.listByReplicationFabricsCreateRequest(ctx, resourceName, resourceGroupName, fabricName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationProtectionContainersClientListByReplicationFabricsResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationProtectionContainersClientListByReplicationFabricsResponse{}, err } @@ -441,16 +445,16 @@ func (client *ReplicationProtectionContainersClient) NewListByReplicationFabrics } // listByReplicationFabricsCreateRequest creates the ListByReplicationFabrics request. -func (client *ReplicationProtectionContainersClient) listByReplicationFabricsCreateRequest(ctx context.Context, fabricName string, options *ReplicationProtectionContainersClientListByReplicationFabricsOptions) (*policy.Request, error) { +func (client *ReplicationProtectionContainersClient) listByReplicationFabricsCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, options *ReplicationProtectionContainersClientListByReplicationFabricsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -459,7 +463,7 @@ func (client *ReplicationProtectionContainersClient) listByReplicationFabricsCre return nil, errors.New("parameter fabricName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -481,33 +485,37 @@ func (client *ReplicationProtectionContainersClient) listByReplicationFabricsHan // BeginSwitchProtection - Operation to switch protection from one container to another or one replication provider to another. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Unique fabric name. -// protectionContainerName - Protection container name. -// switchInput - Switch protection input. -// options - ReplicationProtectionContainersClientBeginSwitchProtectionOptions contains the optional parameters for the ReplicationProtectionContainersClient.BeginSwitchProtection -// method. -func (client *ReplicationProtectionContainersClient) BeginSwitchProtection(ctx context.Context, fabricName string, protectionContainerName string, switchInput SwitchProtectionInput, options *ReplicationProtectionContainersClientBeginSwitchProtectionOptions) (*runtime.Poller[ReplicationProtectionContainersClientSwitchProtectionResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Unique fabric name. +// - protectionContainerName - Protection container name. +// - switchInput - Switch protection input. +// - options - ReplicationProtectionContainersClientBeginSwitchProtectionOptions contains the optional parameters for the ReplicationProtectionContainersClient.BeginSwitchProtection +// method. +func (client *ReplicationProtectionContainersClient) BeginSwitchProtection(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, switchInput SwitchProtectionInput, options *ReplicationProtectionContainersClientBeginSwitchProtectionOptions) (*runtime.Poller[ReplicationProtectionContainersClientSwitchProtectionResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.switchProtection(ctx, fabricName, protectionContainerName, switchInput, options) + resp, err := client.switchProtection(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, switchInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationProtectionContainersClientSwitchProtectionResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationProtectionContainersClientSwitchProtectionResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationProtectionContainersClientSwitchProtectionResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationProtectionContainersClientSwitchProtectionResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // SwitchProtection - Operation to switch protection from one container to another or one replication provider to another. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationProtectionContainersClient) switchProtection(ctx context.Context, fabricName string, protectionContainerName string, switchInput SwitchProtectionInput, options *ReplicationProtectionContainersClientBeginSwitchProtectionOptions) (*http.Response, error) { - req, err := client.switchProtectionCreateRequest(ctx, fabricName, protectionContainerName, switchInput, options) +func (client *ReplicationProtectionContainersClient) switchProtection(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, switchInput SwitchProtectionInput, options *ReplicationProtectionContainersClientBeginSwitchProtectionOptions) (*http.Response, error) { + req, err := client.switchProtectionCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, switchInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -518,16 +526,16 @@ func (client *ReplicationProtectionContainersClient) switchProtection(ctx contex } // switchProtectionCreateRequest creates the SwitchProtection request. -func (client *ReplicationProtectionContainersClient) switchProtectionCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, switchInput SwitchProtectionInput, options *ReplicationProtectionContainersClientBeginSwitchProtectionOptions) (*policy.Request, error) { +func (client *ReplicationProtectionContainersClient) switchProtectionCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, switchInput SwitchProtectionInput, options *ReplicationProtectionContainersClientBeginSwitchProtectionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/switchprotection" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -540,7 +548,7 @@ func (client *ReplicationProtectionContainersClient) switchProtectionCreateReque return nil, errors.New("parameter protectionContainerName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{protectionContainerName}", url.PathEscape(protectionContainerName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectioncontainers_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectioncontainers_client_example_test.go index 375cdf5b9499..692645f52a40 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectioncontainers_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectioncontainers_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -14,64 +15,95 @@ import ( "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/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_ListByReplicationFabrics.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_ListByReplicationFabrics.json func ExampleReplicationProtectionContainersClient_NewListByReplicationFabricsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectionContainersClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByReplicationFabricsPager("cloud1", nil) + pager := clientFactory.NewReplicationProtectionContainersClient().NewListByReplicationFabricsPager("vault1", "resourceGroupPS1", "cloud1", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.ProtectionContainerCollection = armrecoveryservicessiterecovery.ProtectionContainerCollection{ + // Value: []*armrecoveryservicessiterecovery.ProtectionContainer{ + // { + // Name: to.Ptr("cloud_6d224fc6-f326-5d35-96de-fbf51efb3179"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179"), + // Properties: &armrecoveryservicessiterecovery.ProtectionContainerProperties{ + // FabricFriendlyName: to.Ptr("cloud1"), + // FabricType: to.Ptr("HyperVSite"), + // FriendlyName: to.Ptr("cloud1"), + // PairingStatus: to.Ptr("NotPaired"), + // ProtectedItemCount: to.Ptr[int32](0), + // Role: to.Ptr(""), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_Get.json func ExampleReplicationProtectionContainersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectionContainersClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", nil) + res, err := clientFactory.NewReplicationProtectionContainersClient().Get(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ProtectionContainer = armrecoveryservicessiterecovery.ProtectionContainer{ + // Name: to.Ptr("cloud_6d224fc6-f326-5d35-96de-fbf51efb3179"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179"), + // Properties: &armrecoveryservicessiterecovery.ProtectionContainerProperties{ + // FabricFriendlyName: to.Ptr("cloud1"), + // FabricType: to.Ptr("HyperVSite"), + // FriendlyName: to.Ptr("cloud1"), + // PairingStatus: to.Ptr("NotPaired"), + // ProtectedItemCount: to.Ptr[int32](0), + // Role: to.Ptr(""), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_Create.json func ExampleReplicationProtectionContainersClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectionContainersClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreate(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", armrecoveryservicessiterecovery.CreateProtectionContainerInput{ + poller, err := clientFactory.NewReplicationProtectionContainersClient().BeginCreate(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", armrecoveryservicessiterecovery.CreateProtectionContainerInput{ Properties: &armrecoveryservicessiterecovery.CreateProtectionContainerInputProperties{ ProviderSpecificInput: []armrecoveryservicessiterecovery.ReplicationProviderSpecificContainerCreationInputClassification{ &armrecoveryservicessiterecovery.ReplicationProviderSpecificContainerCreationInput{ @@ -86,22 +118,36 @@ func ExampleReplicationProtectionContainersClient_BeginCreate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ProtectionContainer = armrecoveryservicessiterecovery.ProtectionContainer{ + // Name: to.Ptr("cloud_6d224fc6-f326-5d35-96de-fbf51efb3179"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179"), + // Properties: &armrecoveryservicessiterecovery.ProtectionContainerProperties{ + // FabricFriendlyName: to.Ptr("cloud1"), + // FabricType: to.Ptr("HyperVSite"), + // FriendlyName: to.Ptr("cloud1"), + // PairingStatus: to.Ptr("NotPaired"), + // ProtectedItemCount: to.Ptr[int32](0), + // Role: to.Ptr(""), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_DiscoverProtectableItem.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_DiscoverProtectableItem.json func ExampleReplicationProtectionContainersClient_BeginDiscoverProtectableItem() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectionContainersClient("MadhaviVault", "MadhaviVRG", "7c943c1b-5122-4097-90c8-861411bdd574", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDiscoverProtectableItem(ctx, "V2A-W2K12-660", "cloud_7328549c-5c37-4459-a3c2-e35f9ef6893c", armrecoveryservicessiterecovery.DiscoverProtectableItemRequest{ + poller, err := clientFactory.NewReplicationProtectionContainersClient().BeginDiscoverProtectableItem(ctx, "MadhaviVault", "MadhaviVRG", "V2A-W2K12-660", "cloud_7328549c-5c37-4459-a3c2-e35f9ef6893c", armrecoveryservicessiterecovery.DiscoverProtectableItemRequest{ Properties: &armrecoveryservicessiterecovery.DiscoverProtectableItemRequestProperties{ FriendlyName: to.Ptr("Test"), IPAddress: to.Ptr("10.150.2.3"), @@ -115,22 +161,36 @@ func ExampleReplicationProtectionContainersClient_BeginDiscoverProtectableItem() if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ProtectionContainer = armrecoveryservicessiterecovery.ProtectionContainer{ + // Name: to.Ptr("cloud_7328549c-5c37-4459-a3c2-e35f9ef6893c"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers"), + // ID: to.Ptr("/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/MadhaviVRG/providers/Microsoft.RecoveryServices/vaults/MadhaviVault/replicationFabrics/239f778f368e34f78216d81f030725cdf2033174b47879b9f2eeede06fdd9c4d/replicationProtectionContainers/cloud_7328549c-5c37-4459-a3c2-e35f9ef6893c"), + // Properties: &armrecoveryservicessiterecovery.ProtectionContainerProperties{ + // FabricFriendlyName: to.Ptr("V2A-W2K12-660"), + // FabricType: to.Ptr("VMware"), + // FriendlyName: to.Ptr("V2A-W2K12-660"), + // PairingStatus: to.Ptr("Paired"), + // ProtectedItemCount: to.Ptr[int32](2), + // Role: to.Ptr("Primary"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_Delete.json func ExampleReplicationProtectionContainersClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectionContainersClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", nil) + poller, err := clientFactory.NewReplicationProtectionContainersClient().BeginDelete(ctx, "vault1", "resourceGroupPS1", "cloud1", "cloud_6d224fc6-f326-5d35-96de-fbf51efb3179", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -140,18 +200,18 @@ func ExampleReplicationProtectionContainersClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_SwitchProtection.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_SwitchProtection.json func ExampleReplicationProtectionContainersClient_BeginSwitchProtection() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectionContainersClient("priyanponeboxvault", "priyanprg", "42195872-7e70-4f8a-837f-84b28ecbb78b", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginSwitchProtection(ctx, "CentralUSCanSite", "CentralUSCancloud", armrecoveryservicessiterecovery.SwitchProtectionInput{ + poller, err := clientFactory.NewReplicationProtectionContainersClient().BeginSwitchProtection(ctx, "priyanponeboxvault", "priyanprg", "CentralUSCanSite", "CentralUSCancloud", armrecoveryservicessiterecovery.SwitchProtectionInput{ Properties: &armrecoveryservicessiterecovery.SwitchProtectionInputProperties{ ProviderSpecificDetails: &armrecoveryservicessiterecovery.A2ASwitchProtectionInput{ InstanceType: to.Ptr("A2A"), @@ -165,30 +225,61 @@ func ExampleReplicationProtectionContainersClient_BeginSwitchProtection() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ProtectionContainer = armrecoveryservicessiterecovery.ProtectionContainer{ + // Name: to.Ptr("euscancloud"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers"), + // ID: to.Ptr("/Subscriptions/42195872-7e70-4f8a-837f-84b28ecbb78b/resourceGroups/priyanprg/providers/Microsoft.RecoveryServices/vaults/priyanponeboxvault/replicationFabrics/EUSCanSite/replicationProtectionContainers/euscancloud"), + // Properties: &armrecoveryservicessiterecovery.ProtectionContainerProperties{ + // FabricFriendlyName: to.Ptr("East US 2 EUAP"), + // FabricType: to.Ptr("Azure"), + // FriendlyName: to.Ptr("euscancloud"), + // PairingStatus: to.Ptr("Paired"), + // ProtectedItemCount: to.Ptr[int32](0), + // Role: to.Ptr("Primary"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_List.json func ExampleReplicationProtectionContainersClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectionContainersClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(nil) + pager := clientFactory.NewReplicationProtectionContainersClient().NewListPager("vault1", "resourceGroupPS1", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.ProtectionContainerCollection = armrecoveryservicessiterecovery.ProtectionContainerCollection{ + // Value: []*armrecoveryservicessiterecovery.ProtectionContainer{ + // { + // Name: to.Ptr("cloud_6d224fc6-f326-5d35-96de-fbf51efb3179"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationProtectionContainers"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179"), + // Properties: &armrecoveryservicessiterecovery.ProtectionContainerProperties{ + // FabricFriendlyName: to.Ptr("cloud1"), + // FabricType: to.Ptr("HyperVSite"), + // FriendlyName: to.Ptr("cloud1"), + // PairingStatus: to.Ptr("NotPaired"), + // ProtectedItemCount: to.Ptr[int32](0), + // Role: to.Ptr(""), + // }, + // }}, + // } } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectionintents_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectionintents_client.go index 8a19524b22ae..2ff0eeb70f7b 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectionintents_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectionintents_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,54 +24,42 @@ import ( // ReplicationProtectionIntentsClient contains the methods for the ReplicationProtectionIntents group. // Don't use this type directly, use NewReplicationProtectionIntentsClient() instead. type ReplicationProtectionIntentsClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationProtectionIntentsClient creates a new instance of ReplicationProtectionIntentsClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationProtectionIntentsClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationProtectionIntentsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationProtectionIntentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationProtectionIntentsClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationProtectionIntentsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationProtectionIntentsClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // Create - The operation to create an ASR replication protection intent item. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// intentObjectName - A name for the replication protection item. -// input - Create Protection Intent Input. -// options - ReplicationProtectionIntentsClientCreateOptions contains the optional parameters for the ReplicationProtectionIntentsClient.Create -// method. -func (client *ReplicationProtectionIntentsClient) Create(ctx context.Context, intentObjectName string, input CreateProtectionIntentInput, options *ReplicationProtectionIntentsClientCreateOptions) (ReplicationProtectionIntentsClientCreateResponse, error) { - req, err := client.createCreateRequest(ctx, intentObjectName, input, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - intentObjectName - A name for the replication protection item. +// - input - Create Protection Intent Input. +// - options - ReplicationProtectionIntentsClientCreateOptions contains the optional parameters for the ReplicationProtectionIntentsClient.Create +// method. +func (client *ReplicationProtectionIntentsClient) Create(ctx context.Context, resourceName string, resourceGroupName string, intentObjectName string, input CreateProtectionIntentInput, options *ReplicationProtectionIntentsClientCreateOptions) (ReplicationProtectionIntentsClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceName, resourceGroupName, intentObjectName, input, options) if err != nil { return ReplicationProtectionIntentsClientCreateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationProtectionIntentsClientCreateResponse{}, err } @@ -84,16 +70,16 @@ func (client *ReplicationProtectionIntentsClient) Create(ctx context.Context, in } // createCreateRequest creates the Create request. -func (client *ReplicationProtectionIntentsClient) createCreateRequest(ctx context.Context, intentObjectName string, input CreateProtectionIntentInput, options *ReplicationProtectionIntentsClientCreateOptions) (*policy.Request, error) { +func (client *ReplicationProtectionIntentsClient) createCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, intentObjectName string, input CreateProtectionIntentInput, options *ReplicationProtectionIntentsClientCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -102,7 +88,7 @@ func (client *ReplicationProtectionIntentsClient) createCreateRequest(ctx contex return nil, errors.New("parameter intentObjectName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{intentObjectName}", url.PathEscape(intentObjectName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -124,16 +110,19 @@ func (client *ReplicationProtectionIntentsClient) createHandleResponse(resp *htt // Get - Gets the details of an ASR replication protection intent. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// intentObjectName - Replication protection intent name. -// options - ReplicationProtectionIntentsClientGetOptions contains the optional parameters for the ReplicationProtectionIntentsClient.Get -// method. -func (client *ReplicationProtectionIntentsClient) Get(ctx context.Context, intentObjectName string, options *ReplicationProtectionIntentsClientGetOptions) (ReplicationProtectionIntentsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, intentObjectName, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - intentObjectName - Replication protection intent name. +// - options - ReplicationProtectionIntentsClientGetOptions contains the optional parameters for the ReplicationProtectionIntentsClient.Get +// method. +func (client *ReplicationProtectionIntentsClient) Get(ctx context.Context, resourceName string, resourceGroupName string, intentObjectName string, options *ReplicationProtectionIntentsClientGetOptions) (ReplicationProtectionIntentsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, intentObjectName, options) if err != nil { return ReplicationProtectionIntentsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationProtectionIntentsClientGetResponse{}, err } @@ -144,16 +133,16 @@ func (client *ReplicationProtectionIntentsClient) Get(ctx context.Context, inten } // getCreateRequest creates the Get request. -func (client *ReplicationProtectionIntentsClient) getCreateRequest(ctx context.Context, intentObjectName string, options *ReplicationProtectionIntentsClientGetOptions) (*policy.Request, error) { +func (client *ReplicationProtectionIntentsClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, intentObjectName string, options *ReplicationProtectionIntentsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -162,7 +151,7 @@ func (client *ReplicationProtectionIntentsClient) getCreateRequest(ctx context.C return nil, errors.New("parameter intentObjectName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{intentObjectName}", url.PathEscape(intentObjectName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -183,10 +172,13 @@ func (client *ReplicationProtectionIntentsClient) getHandleResponse(resp *http.R } // NewListPager - Gets the list of ASR replication protection intent objects in the vault. +// // Generated from API version 2022-10-01 -// options - ReplicationProtectionIntentsClientListOptions contains the optional parameters for the ReplicationProtectionIntentsClient.List -// method. -func (client *ReplicationProtectionIntentsClient) NewListPager(options *ReplicationProtectionIntentsClientListOptions) *runtime.Pager[ReplicationProtectionIntentsClientListResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - ReplicationProtectionIntentsClientListOptions contains the optional parameters for the ReplicationProtectionIntentsClient.NewListPager +// method. +func (client *ReplicationProtectionIntentsClient) NewListPager(resourceName string, resourceGroupName string, options *ReplicationProtectionIntentsClientListOptions) *runtime.Pager[ReplicationProtectionIntentsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationProtectionIntentsClientListResponse]{ More: func(page ReplicationProtectionIntentsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -195,14 +187,14 @@ func (client *ReplicationProtectionIntentsClient) NewListPager(options *Replicat var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, resourceName, resourceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationProtectionIntentsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationProtectionIntentsClientListResponse{}, err } @@ -215,21 +207,21 @@ func (client *ReplicationProtectionIntentsClient) NewListPager(options *Replicat } // listCreateRequest creates the List request. -func (client *ReplicationProtectionIntentsClient) listCreateRequest(ctx context.Context, options *ReplicationProtectionIntentsClientListOptions) (*policy.Request, error) { +func (client *ReplicationProtectionIntentsClient) listCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationProtectionIntentsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectionintents_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectionintents_client_example_test.go index de91abd60727..975a748436f1 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectionintents_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationprotectionintents_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -14,66 +15,107 @@ import ( "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/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionIntents_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionIntents_List.json func ExampleReplicationProtectionIntentsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectionIntentsClient("2007vttp", "resourceGroupPS1", "509099b2-9d2c-4636-b43e-bd5cafb6be69", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(&armrecoveryservicessiterecovery.ReplicationProtectionIntentsClientListOptions{SkipToken: nil, + pager := clientFactory.NewReplicationProtectionIntentsClient().NewListPager("2007vttp", "resourceGroupPS1", &armrecoveryservicessiterecovery.ReplicationProtectionIntentsClientListOptions{SkipToken: nil, TakeToken: nil, }) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.ReplicationProtectionIntentCollection = armrecoveryservicessiterecovery.ReplicationProtectionIntentCollection{ + // Value: []*armrecoveryservicessiterecovery.ReplicationProtectionIntent{ + // { + // Name: to.Ptr("vm1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationProtectionIntents"), + // ID: to.Ptr("/Subscriptions/509099b2-9d2c-4636-b43e-bd5cafb6be69/resourceGroups/2007vttp/providers/Microsoft.RecoveryServices/vaults/tp2007vt/replicationProtectionIntents/vm1"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectionIntentProperties{ + // FriendlyName: to.Ptr("vm1"), + // JobID: to.Ptr("/Subscriptions/d90d145a-4cdd-45a3-b2c4-971d69775278/resourceGroups/a2acl-rg-vault-prod-gip-ccy/providers/Microsoft.RecoveryServices/vaults/a2acl-vault-prod-gip-ccy/replicationJobs/02004ea7-d498-4bb4-bdeb-cdb611706867"), + // JobState: to.Ptr("InProgress"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.A2AReplicationIntentDetails{ + // InstanceType: to.Ptr("A2A"), + // FabricObjectID: to.Ptr("/subscriptions/509099b2-9d2c-4636-b43e-bd5cafb6be69/resourceGroups/removeOne/providers/Microsoft.Compute/virtualMachines/vmPpgAv5"), + // PrimaryLocation: to.Ptr("eastUs2"), + // RecoveryAvailabilityType: to.Ptr("Single"), + // RecoveryLocation: to.Ptr("westus2"), + // RecoverySubscriptionID: to.Ptr("ed5bcdf6-d61e-47bd-8ea9-f2bd379a2640"), + // }, + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionIntents_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionIntents_Get.json func ExampleReplicationProtectionIntentsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectionIntentsClient("vault1", "resourceGroupPS1", "509099b2-9d2c-4636-b43e-bd5cafb6be69", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "vm1", nil) + res, err := clientFactory.NewReplicationProtectionIntentsClient().Get(ctx, "vault1", "resourceGroupPS1", "vm1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReplicationProtectionIntent = armrecoveryservicessiterecovery.ReplicationProtectionIntent{ + // Name: to.Ptr("vm1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationProtectionIntents"), + // ID: to.Ptr("/Subscriptions/509099b2-9d2c-4636-b43e-bd5cafb6be69/resourceGroups/2007vttp/providers/Microsoft.RecoveryServices/vaults/tp2007vt/replicationProtectionIntents/vm1"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectionIntentProperties{ + // FriendlyName: to.Ptr("vm1"), + // JobID: to.Ptr("/Subscriptions/d90d145a-4cdd-45a3-b2c4-971d69775278/resourceGroups/a2acl-rg-vault-prod-gip-ccy/providers/Microsoft.RecoveryServices/vaults/a2acl-vault-prod-gip-ccy/replicationJobs/02004ea7-d498-4bb4-bdeb-cdb611706867"), + // JobState: to.Ptr("InProgress"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.A2AReplicationIntentDetails{ + // InstanceType: to.Ptr("A2A"), + // FabricObjectID: to.Ptr("/subscriptions/509099b2-9d2c-4636-b43e-bd5cafb6be69/resourceGroups/removeOne/providers/Microsoft.Compute/virtualMachines/vmPpgAv5"), + // PrimaryLocation: to.Ptr("eastUs2"), + // RecoveryAvailabilityType: to.Ptr("Single"), + // RecoveryLocation: to.Ptr("westus2"), + // RecoverySubscriptionID: to.Ptr("ed5bcdf6-d61e-47bd-8ea9-f2bd379a2640"), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionIntents_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionIntents_Create.json func ExampleReplicationProtectionIntentsClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationProtectionIntentsClient("vault1", "resourceGroupPS1", "509099b2-9d2c-4636-b43e-bd5cafb6be69", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Create(ctx, "vm1", armrecoveryservicessiterecovery.CreateProtectionIntentInput{ + res, err := clientFactory.NewReplicationProtectionIntentsClient().Create(ctx, "vault1", "resourceGroupPS1", "vm1", armrecoveryservicessiterecovery.CreateProtectionIntentInput{ Properties: &armrecoveryservicessiterecovery.CreateProtectionIntentProperties{ ProviderSpecificDetails: &armrecoveryservicessiterecovery.A2ACreateProtectionIntentInput{ InstanceType: to.Ptr("A2A"), @@ -89,6 +131,21 @@ func ExampleReplicationProtectionIntentsClient_Create() { if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ReplicationProtectionIntent = armrecoveryservicessiterecovery.ReplicationProtectionIntent{ + // Name: to.Ptr("vm1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationProtectionIntents"), + // ID: to.Ptr("/Subscriptions/509099b2-9d2c-4636-b43e-bd5cafb6be69/resourceGroups/2007vttp/providers/Microsoft.RecoveryServices/vaults/tp2007vt/replicationProtectionIntents/vm1"), + // Properties: &armrecoveryservicessiterecovery.ReplicationProtectionIntentProperties{ + // FriendlyName: to.Ptr("vm1"), + // JobID: to.Ptr("/Subscriptions/d90d145a-4cdd-45a3-b2c4-971d69775278/resourceGroups/a2acl-rg-vault-prod-gip-ccy/providers/Microsoft.RecoveryServices/vaults/a2acl-vault-prod-gip-ccy/replicationJobs/02004ea7-d498-4bb4-bdeb-cdb611706867"), + // JobState: to.Ptr("InProgress"), + // ProviderSpecificDetails: &armrecoveryservicessiterecovery.A2AReplicationIntentDetails{ + // InstanceType: to.Ptr("A2A"), + // RecoveryAvailabilityType: to.Ptr("Single"), + // }, + // }, + // } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationrecoveryplans_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationrecoveryplans_client.go index 4ca3fd03e44d..88a9175e4e14 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationrecoveryplans_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationrecoveryplans_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,69 +24,58 @@ import ( // ReplicationRecoveryPlansClient contains the methods for the ReplicationRecoveryPlans group. // Don't use this type directly, use NewReplicationRecoveryPlansClient() instead. type ReplicationRecoveryPlansClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationRecoveryPlansClient creates a new instance of ReplicationRecoveryPlansClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationRecoveryPlansClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationRecoveryPlansClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationRecoveryPlansClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationRecoveryPlansClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationRecoveryPlansClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationRecoveryPlansClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // BeginCreate - The operation to create a recovery plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// recoveryPlanName - Recovery plan name. -// input - Recovery Plan creation input. -// options - ReplicationRecoveryPlansClientBeginCreateOptions contains the optional parameters for the ReplicationRecoveryPlansClient.BeginCreate -// method. -func (client *ReplicationRecoveryPlansClient) BeginCreate(ctx context.Context, recoveryPlanName string, input CreateRecoveryPlanInput, options *ReplicationRecoveryPlansClientBeginCreateOptions) (*runtime.Poller[ReplicationRecoveryPlansClientCreateResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - recoveryPlanName - Recovery plan name. +// - input - Recovery Plan creation input. +// - options - ReplicationRecoveryPlansClientBeginCreateOptions contains the optional parameters for the ReplicationRecoveryPlansClient.BeginCreate +// method. +func (client *ReplicationRecoveryPlansClient) BeginCreate(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, input CreateRecoveryPlanInput, options *ReplicationRecoveryPlansClientBeginCreateOptions) (*runtime.Poller[ReplicationRecoveryPlansClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, recoveryPlanName, input, options) + resp, err := client.create(ctx, resourceName, resourceGroupName, recoveryPlanName, input, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationRecoveryPlansClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationRecoveryPlansClientCreateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationRecoveryPlansClientCreateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationRecoveryPlansClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Create - The operation to create a recovery plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationRecoveryPlansClient) create(ctx context.Context, recoveryPlanName string, input CreateRecoveryPlanInput, options *ReplicationRecoveryPlansClientBeginCreateOptions) (*http.Response, error) { - req, err := client.createCreateRequest(ctx, recoveryPlanName, input, options) +func (client *ReplicationRecoveryPlansClient) create(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, input CreateRecoveryPlanInput, options *ReplicationRecoveryPlansClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceName, resourceGroupName, recoveryPlanName, input, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -99,16 +86,16 @@ func (client *ReplicationRecoveryPlansClient) create(ctx context.Context, recove } // createCreateRequest creates the Create request. -func (client *ReplicationRecoveryPlansClient) createCreateRequest(ctx context.Context, recoveryPlanName string, input CreateRecoveryPlanInput, options *ReplicationRecoveryPlansClientBeginCreateOptions) (*policy.Request, error) { +func (client *ReplicationRecoveryPlansClient) createCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, input CreateRecoveryPlanInput, options *ReplicationRecoveryPlansClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -117,7 +104,7 @@ func (client *ReplicationRecoveryPlansClient) createCreateRequest(ctx context.Co return nil, errors.New("parameter recoveryPlanName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{recoveryPlanName}", url.PathEscape(recoveryPlanName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -130,31 +117,35 @@ func (client *ReplicationRecoveryPlansClient) createCreateRequest(ctx context.Co // BeginDelete - Delete a recovery plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// recoveryPlanName - Recovery plan name. -// options - ReplicationRecoveryPlansClientBeginDeleteOptions contains the optional parameters for the ReplicationRecoveryPlansClient.BeginDelete -// method. -func (client *ReplicationRecoveryPlansClient) BeginDelete(ctx context.Context, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginDeleteOptions) (*runtime.Poller[ReplicationRecoveryPlansClientDeleteResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - recoveryPlanName - Recovery plan name. +// - options - ReplicationRecoveryPlansClientBeginDeleteOptions contains the optional parameters for the ReplicationRecoveryPlansClient.BeginDelete +// method. +func (client *ReplicationRecoveryPlansClient) BeginDelete(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginDeleteOptions) (*runtime.Poller[ReplicationRecoveryPlansClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, recoveryPlanName, options) + resp, err := client.deleteOperation(ctx, resourceName, resourceGroupName, recoveryPlanName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationRecoveryPlansClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationRecoveryPlansClientDeleteResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationRecoveryPlansClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationRecoveryPlansClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - Delete a recovery plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationRecoveryPlansClient) deleteOperation(ctx context.Context, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, recoveryPlanName, options) +func (client *ReplicationRecoveryPlansClient) deleteOperation(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceName, resourceGroupName, recoveryPlanName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -165,16 +156,16 @@ func (client *ReplicationRecoveryPlansClient) deleteOperation(ctx context.Contex } // deleteCreateRequest creates the Delete request. -func (client *ReplicationRecoveryPlansClient) deleteCreateRequest(ctx context.Context, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ReplicationRecoveryPlansClient) deleteCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -183,7 +174,7 @@ func (client *ReplicationRecoveryPlansClient) deleteCreateRequest(ctx context.Co return nil, errors.New("parameter recoveryPlanName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{recoveryPlanName}", url.PathEscape(recoveryPlanName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -195,31 +186,35 @@ func (client *ReplicationRecoveryPlansClient) deleteCreateRequest(ctx context.Co // BeginFailoverCancel - The operation to cancel the failover of a recovery plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// recoveryPlanName - Recovery plan name. -// options - ReplicationRecoveryPlansClientBeginFailoverCancelOptions contains the optional parameters for the ReplicationRecoveryPlansClient.BeginFailoverCancel -// method. -func (client *ReplicationRecoveryPlansClient) BeginFailoverCancel(ctx context.Context, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginFailoverCancelOptions) (*runtime.Poller[ReplicationRecoveryPlansClientFailoverCancelResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - recoveryPlanName - Recovery plan name. +// - options - ReplicationRecoveryPlansClientBeginFailoverCancelOptions contains the optional parameters for the ReplicationRecoveryPlansClient.BeginFailoverCancel +// method. +func (client *ReplicationRecoveryPlansClient) BeginFailoverCancel(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginFailoverCancelOptions) (*runtime.Poller[ReplicationRecoveryPlansClientFailoverCancelResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.failoverCancel(ctx, recoveryPlanName, options) + resp, err := client.failoverCancel(ctx, resourceName, resourceGroupName, recoveryPlanName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationRecoveryPlansClientFailoverCancelResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationRecoveryPlansClientFailoverCancelResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationRecoveryPlansClientFailoverCancelResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationRecoveryPlansClientFailoverCancelResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // FailoverCancel - The operation to cancel the failover of a recovery plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationRecoveryPlansClient) failoverCancel(ctx context.Context, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginFailoverCancelOptions) (*http.Response, error) { - req, err := client.failoverCancelCreateRequest(ctx, recoveryPlanName, options) +func (client *ReplicationRecoveryPlansClient) failoverCancel(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginFailoverCancelOptions) (*http.Response, error) { + req, err := client.failoverCancelCreateRequest(ctx, resourceName, resourceGroupName, recoveryPlanName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -230,16 +225,16 @@ func (client *ReplicationRecoveryPlansClient) failoverCancel(ctx context.Context } // failoverCancelCreateRequest creates the FailoverCancel request. -func (client *ReplicationRecoveryPlansClient) failoverCancelCreateRequest(ctx context.Context, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginFailoverCancelOptions) (*policy.Request, error) { +func (client *ReplicationRecoveryPlansClient) failoverCancelCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginFailoverCancelOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCancel" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -248,7 +243,7 @@ func (client *ReplicationRecoveryPlansClient) failoverCancelCreateRequest(ctx co return nil, errors.New("parameter recoveryPlanName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{recoveryPlanName}", url.PathEscape(recoveryPlanName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -261,31 +256,35 @@ func (client *ReplicationRecoveryPlansClient) failoverCancelCreateRequest(ctx co // BeginFailoverCommit - The operation to commit the failover of a recovery plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// recoveryPlanName - Recovery plan name. -// options - ReplicationRecoveryPlansClientBeginFailoverCommitOptions contains the optional parameters for the ReplicationRecoveryPlansClient.BeginFailoverCommit -// method. -func (client *ReplicationRecoveryPlansClient) BeginFailoverCommit(ctx context.Context, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginFailoverCommitOptions) (*runtime.Poller[ReplicationRecoveryPlansClientFailoverCommitResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - recoveryPlanName - Recovery plan name. +// - options - ReplicationRecoveryPlansClientBeginFailoverCommitOptions contains the optional parameters for the ReplicationRecoveryPlansClient.BeginFailoverCommit +// method. +func (client *ReplicationRecoveryPlansClient) BeginFailoverCommit(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginFailoverCommitOptions) (*runtime.Poller[ReplicationRecoveryPlansClientFailoverCommitResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.failoverCommit(ctx, recoveryPlanName, options) + resp, err := client.failoverCommit(ctx, resourceName, resourceGroupName, recoveryPlanName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationRecoveryPlansClientFailoverCommitResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationRecoveryPlansClientFailoverCommitResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationRecoveryPlansClientFailoverCommitResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationRecoveryPlansClientFailoverCommitResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // FailoverCommit - The operation to commit the failover of a recovery plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationRecoveryPlansClient) failoverCommit(ctx context.Context, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginFailoverCommitOptions) (*http.Response, error) { - req, err := client.failoverCommitCreateRequest(ctx, recoveryPlanName, options) +func (client *ReplicationRecoveryPlansClient) failoverCommit(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginFailoverCommitOptions) (*http.Response, error) { + req, err := client.failoverCommitCreateRequest(ctx, resourceName, resourceGroupName, recoveryPlanName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -296,16 +295,16 @@ func (client *ReplicationRecoveryPlansClient) failoverCommit(ctx context.Context } // failoverCommitCreateRequest creates the FailoverCommit request. -func (client *ReplicationRecoveryPlansClient) failoverCommitCreateRequest(ctx context.Context, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginFailoverCommitOptions) (*policy.Request, error) { +func (client *ReplicationRecoveryPlansClient) failoverCommitCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginFailoverCommitOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCommit" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -314,7 +313,7 @@ func (client *ReplicationRecoveryPlansClient) failoverCommitCreateRequest(ctx co return nil, errors.New("parameter recoveryPlanName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{recoveryPlanName}", url.PathEscape(recoveryPlanName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -327,16 +326,19 @@ func (client *ReplicationRecoveryPlansClient) failoverCommitCreateRequest(ctx co // Get - Gets the details of the recovery plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// recoveryPlanName - Name of the recovery plan. -// options - ReplicationRecoveryPlansClientGetOptions contains the optional parameters for the ReplicationRecoveryPlansClient.Get -// method. -func (client *ReplicationRecoveryPlansClient) Get(ctx context.Context, recoveryPlanName string, options *ReplicationRecoveryPlansClientGetOptions) (ReplicationRecoveryPlansClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, recoveryPlanName, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - recoveryPlanName - Name of the recovery plan. +// - options - ReplicationRecoveryPlansClientGetOptions contains the optional parameters for the ReplicationRecoveryPlansClient.Get +// method. +func (client *ReplicationRecoveryPlansClient) Get(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, options *ReplicationRecoveryPlansClientGetOptions) (ReplicationRecoveryPlansClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, recoveryPlanName, options) if err != nil { return ReplicationRecoveryPlansClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationRecoveryPlansClientGetResponse{}, err } @@ -347,16 +349,16 @@ func (client *ReplicationRecoveryPlansClient) Get(ctx context.Context, recoveryP } // getCreateRequest creates the Get request. -func (client *ReplicationRecoveryPlansClient) getCreateRequest(ctx context.Context, recoveryPlanName string, options *ReplicationRecoveryPlansClientGetOptions) (*policy.Request, error) { +func (client *ReplicationRecoveryPlansClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, options *ReplicationRecoveryPlansClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -365,7 +367,7 @@ func (client *ReplicationRecoveryPlansClient) getCreateRequest(ctx context.Conte return nil, errors.New("parameter recoveryPlanName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{recoveryPlanName}", url.PathEscape(recoveryPlanName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -386,10 +388,13 @@ func (client *ReplicationRecoveryPlansClient) getHandleResponse(resp *http.Respo } // NewListPager - Lists the recovery plans in the vault. +// // Generated from API version 2022-10-01 -// options - ReplicationRecoveryPlansClientListOptions contains the optional parameters for the ReplicationRecoveryPlansClient.List -// method. -func (client *ReplicationRecoveryPlansClient) NewListPager(options *ReplicationRecoveryPlansClientListOptions) *runtime.Pager[ReplicationRecoveryPlansClientListResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - ReplicationRecoveryPlansClientListOptions contains the optional parameters for the ReplicationRecoveryPlansClient.NewListPager +// method. +func (client *ReplicationRecoveryPlansClient) NewListPager(resourceName string, resourceGroupName string, options *ReplicationRecoveryPlansClientListOptions) *runtime.Pager[ReplicationRecoveryPlansClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationRecoveryPlansClientListResponse]{ More: func(page ReplicationRecoveryPlansClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -398,14 +403,14 @@ func (client *ReplicationRecoveryPlansClient) NewListPager(options *ReplicationR var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, resourceName, resourceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationRecoveryPlansClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationRecoveryPlansClientListResponse{}, err } @@ -418,21 +423,21 @@ func (client *ReplicationRecoveryPlansClient) NewListPager(options *ReplicationR } // listCreateRequest creates the List request. -func (client *ReplicationRecoveryPlansClient) listCreateRequest(ctx context.Context, options *ReplicationRecoveryPlansClientListOptions) (*policy.Request, error) { +func (client *ReplicationRecoveryPlansClient) listCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationRecoveryPlansClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -454,32 +459,36 @@ func (client *ReplicationRecoveryPlansClient) listHandleResponse(resp *http.Resp // BeginPlannedFailover - The operation to start the planned failover of a recovery plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// recoveryPlanName - Recovery plan name. -// input - Failover input. -// options - ReplicationRecoveryPlansClientBeginPlannedFailoverOptions contains the optional parameters for the ReplicationRecoveryPlansClient.BeginPlannedFailover -// method. -func (client *ReplicationRecoveryPlansClient) BeginPlannedFailover(ctx context.Context, recoveryPlanName string, input RecoveryPlanPlannedFailoverInput, options *ReplicationRecoveryPlansClientBeginPlannedFailoverOptions) (*runtime.Poller[ReplicationRecoveryPlansClientPlannedFailoverResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - recoveryPlanName - Recovery plan name. +// - input - Failover input. +// - options - ReplicationRecoveryPlansClientBeginPlannedFailoverOptions contains the optional parameters for the ReplicationRecoveryPlansClient.BeginPlannedFailover +// method. +func (client *ReplicationRecoveryPlansClient) BeginPlannedFailover(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, input RecoveryPlanPlannedFailoverInput, options *ReplicationRecoveryPlansClientBeginPlannedFailoverOptions) (*runtime.Poller[ReplicationRecoveryPlansClientPlannedFailoverResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.plannedFailover(ctx, recoveryPlanName, input, options) + resp, err := client.plannedFailover(ctx, resourceName, resourceGroupName, recoveryPlanName, input, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationRecoveryPlansClientPlannedFailoverResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationRecoveryPlansClientPlannedFailoverResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationRecoveryPlansClientPlannedFailoverResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationRecoveryPlansClientPlannedFailoverResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // PlannedFailover - The operation to start the planned failover of a recovery plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationRecoveryPlansClient) plannedFailover(ctx context.Context, recoveryPlanName string, input RecoveryPlanPlannedFailoverInput, options *ReplicationRecoveryPlansClientBeginPlannedFailoverOptions) (*http.Response, error) { - req, err := client.plannedFailoverCreateRequest(ctx, recoveryPlanName, input, options) +func (client *ReplicationRecoveryPlansClient) plannedFailover(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, input RecoveryPlanPlannedFailoverInput, options *ReplicationRecoveryPlansClientBeginPlannedFailoverOptions) (*http.Response, error) { + req, err := client.plannedFailoverCreateRequest(ctx, resourceName, resourceGroupName, recoveryPlanName, input, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -490,16 +499,16 @@ func (client *ReplicationRecoveryPlansClient) plannedFailover(ctx context.Contex } // plannedFailoverCreateRequest creates the PlannedFailover request. -func (client *ReplicationRecoveryPlansClient) plannedFailoverCreateRequest(ctx context.Context, recoveryPlanName string, input RecoveryPlanPlannedFailoverInput, options *ReplicationRecoveryPlansClientBeginPlannedFailoverOptions) (*policy.Request, error) { +func (client *ReplicationRecoveryPlansClient) plannedFailoverCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, input RecoveryPlanPlannedFailoverInput, options *ReplicationRecoveryPlansClientBeginPlannedFailoverOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/plannedFailover" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -508,7 +517,7 @@ func (client *ReplicationRecoveryPlansClient) plannedFailoverCreateRequest(ctx c return nil, errors.New("parameter recoveryPlanName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{recoveryPlanName}", url.PathEscape(recoveryPlanName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -521,31 +530,35 @@ func (client *ReplicationRecoveryPlansClient) plannedFailoverCreateRequest(ctx c // BeginReprotect - The operation to reprotect(reverse replicate) a recovery plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// recoveryPlanName - Recovery plan name. -// options - ReplicationRecoveryPlansClientBeginReprotectOptions contains the optional parameters for the ReplicationRecoveryPlansClient.BeginReprotect -// method. -func (client *ReplicationRecoveryPlansClient) BeginReprotect(ctx context.Context, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginReprotectOptions) (*runtime.Poller[ReplicationRecoveryPlansClientReprotectResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - recoveryPlanName - Recovery plan name. +// - options - ReplicationRecoveryPlansClientBeginReprotectOptions contains the optional parameters for the ReplicationRecoveryPlansClient.BeginReprotect +// method. +func (client *ReplicationRecoveryPlansClient) BeginReprotect(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginReprotectOptions) (*runtime.Poller[ReplicationRecoveryPlansClientReprotectResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.reprotect(ctx, recoveryPlanName, options) + resp, err := client.reprotect(ctx, resourceName, resourceGroupName, recoveryPlanName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationRecoveryPlansClientReprotectResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationRecoveryPlansClientReprotectResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationRecoveryPlansClientReprotectResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationRecoveryPlansClientReprotectResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Reprotect - The operation to reprotect(reverse replicate) a recovery plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationRecoveryPlansClient) reprotect(ctx context.Context, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginReprotectOptions) (*http.Response, error) { - req, err := client.reprotectCreateRequest(ctx, recoveryPlanName, options) +func (client *ReplicationRecoveryPlansClient) reprotect(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginReprotectOptions) (*http.Response, error) { + req, err := client.reprotectCreateRequest(ctx, resourceName, resourceGroupName, recoveryPlanName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -556,16 +569,16 @@ func (client *ReplicationRecoveryPlansClient) reprotect(ctx context.Context, rec } // reprotectCreateRequest creates the Reprotect request. -func (client *ReplicationRecoveryPlansClient) reprotectCreateRequest(ctx context.Context, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginReprotectOptions) (*policy.Request, error) { +func (client *ReplicationRecoveryPlansClient) reprotectCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, options *ReplicationRecoveryPlansClientBeginReprotectOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/reProtect" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -574,7 +587,7 @@ func (client *ReplicationRecoveryPlansClient) reprotectCreateRequest(ctx context return nil, errors.New("parameter recoveryPlanName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{recoveryPlanName}", url.PathEscape(recoveryPlanName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -587,32 +600,36 @@ func (client *ReplicationRecoveryPlansClient) reprotectCreateRequest(ctx context // BeginTestFailover - The operation to start the test failover of a recovery plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// recoveryPlanName - Recovery plan name. -// input - Recovery plan test failover input. -// options - ReplicationRecoveryPlansClientBeginTestFailoverOptions contains the optional parameters for the ReplicationRecoveryPlansClient.BeginTestFailover -// method. -func (client *ReplicationRecoveryPlansClient) BeginTestFailover(ctx context.Context, recoveryPlanName string, input RecoveryPlanTestFailoverInput, options *ReplicationRecoveryPlansClientBeginTestFailoverOptions) (*runtime.Poller[ReplicationRecoveryPlansClientTestFailoverResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - recoveryPlanName - Recovery plan name. +// - input - Recovery plan test failover input. +// - options - ReplicationRecoveryPlansClientBeginTestFailoverOptions contains the optional parameters for the ReplicationRecoveryPlansClient.BeginTestFailover +// method. +func (client *ReplicationRecoveryPlansClient) BeginTestFailover(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, input RecoveryPlanTestFailoverInput, options *ReplicationRecoveryPlansClientBeginTestFailoverOptions) (*runtime.Poller[ReplicationRecoveryPlansClientTestFailoverResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.testFailover(ctx, recoveryPlanName, input, options) + resp, err := client.testFailover(ctx, resourceName, resourceGroupName, recoveryPlanName, input, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationRecoveryPlansClientTestFailoverResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationRecoveryPlansClientTestFailoverResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationRecoveryPlansClientTestFailoverResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationRecoveryPlansClientTestFailoverResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // TestFailover - The operation to start the test failover of a recovery plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationRecoveryPlansClient) testFailover(ctx context.Context, recoveryPlanName string, input RecoveryPlanTestFailoverInput, options *ReplicationRecoveryPlansClientBeginTestFailoverOptions) (*http.Response, error) { - req, err := client.testFailoverCreateRequest(ctx, recoveryPlanName, input, options) +func (client *ReplicationRecoveryPlansClient) testFailover(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, input RecoveryPlanTestFailoverInput, options *ReplicationRecoveryPlansClientBeginTestFailoverOptions) (*http.Response, error) { + req, err := client.testFailoverCreateRequest(ctx, resourceName, resourceGroupName, recoveryPlanName, input, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -623,16 +640,16 @@ func (client *ReplicationRecoveryPlansClient) testFailover(ctx context.Context, } // testFailoverCreateRequest creates the TestFailover request. -func (client *ReplicationRecoveryPlansClient) testFailoverCreateRequest(ctx context.Context, recoveryPlanName string, input RecoveryPlanTestFailoverInput, options *ReplicationRecoveryPlansClientBeginTestFailoverOptions) (*policy.Request, error) { +func (client *ReplicationRecoveryPlansClient) testFailoverCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, input RecoveryPlanTestFailoverInput, options *ReplicationRecoveryPlansClientBeginTestFailoverOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailover" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -641,7 +658,7 @@ func (client *ReplicationRecoveryPlansClient) testFailoverCreateRequest(ctx cont return nil, errors.New("parameter recoveryPlanName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{recoveryPlanName}", url.PathEscape(recoveryPlanName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -654,32 +671,36 @@ func (client *ReplicationRecoveryPlansClient) testFailoverCreateRequest(ctx cont // BeginTestFailoverCleanup - The operation to cleanup test failover of a recovery plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// recoveryPlanName - Recovery plan name. -// input - Recovery plan test failover cleanup input. -// options - ReplicationRecoveryPlansClientBeginTestFailoverCleanupOptions contains the optional parameters for the ReplicationRecoveryPlansClient.BeginTestFailoverCleanup -// method. -func (client *ReplicationRecoveryPlansClient) BeginTestFailoverCleanup(ctx context.Context, recoveryPlanName string, input RecoveryPlanTestFailoverCleanupInput, options *ReplicationRecoveryPlansClientBeginTestFailoverCleanupOptions) (*runtime.Poller[ReplicationRecoveryPlansClientTestFailoverCleanupResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - recoveryPlanName - Recovery plan name. +// - input - Recovery plan test failover cleanup input. +// - options - ReplicationRecoveryPlansClientBeginTestFailoverCleanupOptions contains the optional parameters for the ReplicationRecoveryPlansClient.BeginTestFailoverCleanup +// method. +func (client *ReplicationRecoveryPlansClient) BeginTestFailoverCleanup(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, input RecoveryPlanTestFailoverCleanupInput, options *ReplicationRecoveryPlansClientBeginTestFailoverCleanupOptions) (*runtime.Poller[ReplicationRecoveryPlansClientTestFailoverCleanupResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.testFailoverCleanup(ctx, recoveryPlanName, input, options) + resp, err := client.testFailoverCleanup(ctx, resourceName, resourceGroupName, recoveryPlanName, input, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationRecoveryPlansClientTestFailoverCleanupResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationRecoveryPlansClientTestFailoverCleanupResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationRecoveryPlansClientTestFailoverCleanupResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationRecoveryPlansClientTestFailoverCleanupResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // TestFailoverCleanup - The operation to cleanup test failover of a recovery plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationRecoveryPlansClient) testFailoverCleanup(ctx context.Context, recoveryPlanName string, input RecoveryPlanTestFailoverCleanupInput, options *ReplicationRecoveryPlansClientBeginTestFailoverCleanupOptions) (*http.Response, error) { - req, err := client.testFailoverCleanupCreateRequest(ctx, recoveryPlanName, input, options) +func (client *ReplicationRecoveryPlansClient) testFailoverCleanup(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, input RecoveryPlanTestFailoverCleanupInput, options *ReplicationRecoveryPlansClientBeginTestFailoverCleanupOptions) (*http.Response, error) { + req, err := client.testFailoverCleanupCreateRequest(ctx, resourceName, resourceGroupName, recoveryPlanName, input, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -690,16 +711,16 @@ func (client *ReplicationRecoveryPlansClient) testFailoverCleanup(ctx context.Co } // testFailoverCleanupCreateRequest creates the TestFailoverCleanup request. -func (client *ReplicationRecoveryPlansClient) testFailoverCleanupCreateRequest(ctx context.Context, recoveryPlanName string, input RecoveryPlanTestFailoverCleanupInput, options *ReplicationRecoveryPlansClientBeginTestFailoverCleanupOptions) (*policy.Request, error) { +func (client *ReplicationRecoveryPlansClient) testFailoverCleanupCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, input RecoveryPlanTestFailoverCleanupInput, options *ReplicationRecoveryPlansClientBeginTestFailoverCleanupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailoverCleanup" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -708,7 +729,7 @@ func (client *ReplicationRecoveryPlansClient) testFailoverCleanupCreateRequest(c return nil, errors.New("parameter recoveryPlanName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{recoveryPlanName}", url.PathEscape(recoveryPlanName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -721,32 +742,36 @@ func (client *ReplicationRecoveryPlansClient) testFailoverCleanupCreateRequest(c // BeginUnplannedFailover - The operation to start the unplanned failover of a recovery plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// recoveryPlanName - Recovery plan name. -// input - Recovery plan unplanned failover input. -// options - ReplicationRecoveryPlansClientBeginUnplannedFailoverOptions contains the optional parameters for the ReplicationRecoveryPlansClient.BeginUnplannedFailover -// method. -func (client *ReplicationRecoveryPlansClient) BeginUnplannedFailover(ctx context.Context, recoveryPlanName string, input RecoveryPlanUnplannedFailoverInput, options *ReplicationRecoveryPlansClientBeginUnplannedFailoverOptions) (*runtime.Poller[ReplicationRecoveryPlansClientUnplannedFailoverResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - recoveryPlanName - Recovery plan name. +// - input - Recovery plan unplanned failover input. +// - options - ReplicationRecoveryPlansClientBeginUnplannedFailoverOptions contains the optional parameters for the ReplicationRecoveryPlansClient.BeginUnplannedFailover +// method. +func (client *ReplicationRecoveryPlansClient) BeginUnplannedFailover(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, input RecoveryPlanUnplannedFailoverInput, options *ReplicationRecoveryPlansClientBeginUnplannedFailoverOptions) (*runtime.Poller[ReplicationRecoveryPlansClientUnplannedFailoverResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.unplannedFailover(ctx, recoveryPlanName, input, options) + resp, err := client.unplannedFailover(ctx, resourceName, resourceGroupName, recoveryPlanName, input, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationRecoveryPlansClientUnplannedFailoverResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationRecoveryPlansClientUnplannedFailoverResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationRecoveryPlansClientUnplannedFailoverResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationRecoveryPlansClientUnplannedFailoverResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // UnplannedFailover - The operation to start the unplanned failover of a recovery plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationRecoveryPlansClient) unplannedFailover(ctx context.Context, recoveryPlanName string, input RecoveryPlanUnplannedFailoverInput, options *ReplicationRecoveryPlansClientBeginUnplannedFailoverOptions) (*http.Response, error) { - req, err := client.unplannedFailoverCreateRequest(ctx, recoveryPlanName, input, options) +func (client *ReplicationRecoveryPlansClient) unplannedFailover(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, input RecoveryPlanUnplannedFailoverInput, options *ReplicationRecoveryPlansClientBeginUnplannedFailoverOptions) (*http.Response, error) { + req, err := client.unplannedFailoverCreateRequest(ctx, resourceName, resourceGroupName, recoveryPlanName, input, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -757,16 +782,16 @@ func (client *ReplicationRecoveryPlansClient) unplannedFailover(ctx context.Cont } // unplannedFailoverCreateRequest creates the UnplannedFailover request. -func (client *ReplicationRecoveryPlansClient) unplannedFailoverCreateRequest(ctx context.Context, recoveryPlanName string, input RecoveryPlanUnplannedFailoverInput, options *ReplicationRecoveryPlansClientBeginUnplannedFailoverOptions) (*policy.Request, error) { +func (client *ReplicationRecoveryPlansClient) unplannedFailoverCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, input RecoveryPlanUnplannedFailoverInput, options *ReplicationRecoveryPlansClientBeginUnplannedFailoverOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/unplannedFailover" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -775,7 +800,7 @@ func (client *ReplicationRecoveryPlansClient) unplannedFailoverCreateRequest(ctx return nil, errors.New("parameter recoveryPlanName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{recoveryPlanName}", url.PathEscape(recoveryPlanName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -788,32 +813,36 @@ func (client *ReplicationRecoveryPlansClient) unplannedFailoverCreateRequest(ctx // BeginUpdate - The operation to update a recovery plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// recoveryPlanName - Recovery plan name. -// input - Update recovery plan input. -// options - ReplicationRecoveryPlansClientBeginUpdateOptions contains the optional parameters for the ReplicationRecoveryPlansClient.BeginUpdate -// method. -func (client *ReplicationRecoveryPlansClient) BeginUpdate(ctx context.Context, recoveryPlanName string, input UpdateRecoveryPlanInput, options *ReplicationRecoveryPlansClientBeginUpdateOptions) (*runtime.Poller[ReplicationRecoveryPlansClientUpdateResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - recoveryPlanName - Recovery plan name. +// - input - Update recovery plan input. +// - options - ReplicationRecoveryPlansClientBeginUpdateOptions contains the optional parameters for the ReplicationRecoveryPlansClient.BeginUpdate +// method. +func (client *ReplicationRecoveryPlansClient) BeginUpdate(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, input UpdateRecoveryPlanInput, options *ReplicationRecoveryPlansClientBeginUpdateOptions) (*runtime.Poller[ReplicationRecoveryPlansClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, recoveryPlanName, input, options) + resp, err := client.update(ctx, resourceName, resourceGroupName, recoveryPlanName, input, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationRecoveryPlansClientUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationRecoveryPlansClientUpdateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationRecoveryPlansClientUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationRecoveryPlansClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Update - The operation to update a recovery plan. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationRecoveryPlansClient) update(ctx context.Context, recoveryPlanName string, input UpdateRecoveryPlanInput, options *ReplicationRecoveryPlansClientBeginUpdateOptions) (*http.Response, error) { - req, err := client.updateCreateRequest(ctx, recoveryPlanName, input, options) +func (client *ReplicationRecoveryPlansClient) update(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, input UpdateRecoveryPlanInput, options *ReplicationRecoveryPlansClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceName, resourceGroupName, recoveryPlanName, input, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -824,16 +853,16 @@ func (client *ReplicationRecoveryPlansClient) update(ctx context.Context, recove } // updateCreateRequest creates the Update request. -func (client *ReplicationRecoveryPlansClient) updateCreateRequest(ctx context.Context, recoveryPlanName string, input UpdateRecoveryPlanInput, options *ReplicationRecoveryPlansClientBeginUpdateOptions) (*policy.Request, error) { +func (client *ReplicationRecoveryPlansClient) updateCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, recoveryPlanName string, input UpdateRecoveryPlanInput, options *ReplicationRecoveryPlansClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -842,7 +871,7 @@ func (client *ReplicationRecoveryPlansClient) updateCreateRequest(ctx context.Co return nil, errors.New("parameter recoveryPlanName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{recoveryPlanName}", url.PathEscape(recoveryPlanName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationrecoveryplans_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationrecoveryplans_client_example_test.go index 22c0e8650ae9..bb56d6d37e17 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationrecoveryplans_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationrecoveryplans_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -14,64 +15,152 @@ import ( "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/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_List.json func ExampleReplicationRecoveryPlansClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationRecoveryPlansClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(nil) + pager := clientFactory.NewReplicationRecoveryPlansClient().NewListPager("vault1", "resourceGroupPS1", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.RecoveryPlanCollection = armrecoveryservicessiterecovery.RecoveryPlanCollection{ + // Value: []*armrecoveryservicessiterecovery.RecoveryPlan{ + // { + // Name: to.Ptr("RPtest1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationRecoveryPlans"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationRecoveryPlans/RPtest1"), + // Properties: &armrecoveryservicessiterecovery.RecoveryPlanProperties{ + // AllowedOperations: []*string{ + // to.Ptr("PlannedFailover"), + // to.Ptr("UnplannedFailover"), + // to.Ptr("TestFailover")}, + // FailoverDeploymentModel: to.Ptr("ResourceManager"), + // FriendlyName: to.Ptr("RPtest1"), + // Groups: []*armrecoveryservicessiterecovery.RecoveryPlanGroup{ + // }, + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryFabricID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // ReplicationProviders: []*string{ + // to.Ptr("HyperVReplicaAzure")}, + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_Get.json func ExampleReplicationRecoveryPlansClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationRecoveryPlansClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "RPtest1", nil) + res, err := clientFactory.NewReplicationRecoveryPlansClient().Get(ctx, "vault1", "resourceGroupPS1", "RPtest1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RecoveryPlan = armrecoveryservicessiterecovery.RecoveryPlan{ + // Name: to.Ptr("RPtest1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationRecoveryPlans"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationRecoveryPlans/RPtest1"), + // Properties: &armrecoveryservicessiterecovery.RecoveryPlanProperties{ + // AllowedOperations: []*string{ + // to.Ptr("PlannedFailover"), + // to.Ptr("UnplannedFailover"), + // to.Ptr("TestFailover")}, + // FailoverDeploymentModel: to.Ptr("ResourceManager"), + // FriendlyName: to.Ptr("RPtest1"), + // Groups: []*armrecoveryservicessiterecovery.RecoveryPlanGroup{ + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeShutdown), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // }, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeFailover), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // }, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeBoot), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // { + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // VirtualMachineID: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // }}, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeBoot), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // { + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/c0c14913-3d7a-48ea-9531-cc99e0e686e6"), + // VirtualMachineID: to.Ptr("c0c14913-3d7a-48ea-9531-cc99e0e686e6"), + // }}, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }}, + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryFabricID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // ReplicationProviders: []*string{ + // to.Ptr("HyperVReplicaAzure")}, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_Create.json func ExampleReplicationRecoveryPlansClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationRecoveryPlansClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreate(ctx, "RPtest1", armrecoveryservicessiterecovery.CreateRecoveryPlanInput{ + poller, err := clientFactory.NewReplicationRecoveryPlansClient().BeginCreate(ctx, "vault1", "resourceGroupPS1", "RPtest1", armrecoveryservicessiterecovery.CreateRecoveryPlanInput{ Properties: &armrecoveryservicessiterecovery.CreateRecoveryPlanInputProperties{ FailoverDeploymentModel: to.Ptr(armrecoveryservicessiterecovery.FailoverDeploymentModelResourceManager), Groups: []*armrecoveryservicessiterecovery.RecoveryPlanGroup{ @@ -96,22 +185,73 @@ func ExampleReplicationRecoveryPlansClient_BeginCreate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RecoveryPlan = armrecoveryservicessiterecovery.RecoveryPlan{ + // Name: to.Ptr("RPtest1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationRecoveryPlans"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationRecoveryPlans/RPtest1"), + // Properties: &armrecoveryservicessiterecovery.RecoveryPlanProperties{ + // AllowedOperations: []*string{ + // to.Ptr("PlannedFailover"), + // to.Ptr("UnplannedFailover"), + // to.Ptr("TestFailover")}, + // FailoverDeploymentModel: to.Ptr("ResourceManager"), + // FriendlyName: to.Ptr("RPtest1"), + // Groups: []*armrecoveryservicessiterecovery.RecoveryPlanGroup{ + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeShutdown), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // }, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeFailover), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // }, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeBoot), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // { + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // VirtualMachineID: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // }}, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }}, + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryFabricID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // ReplicationProviders: []*string{ + // to.Ptr("HyperVReplicaAzure")}, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_Delete.json func ExampleReplicationRecoveryPlansClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationRecoveryPlansClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, "RPtest1", nil) + poller, err := clientFactory.NewReplicationRecoveryPlansClient().BeginDelete(ctx, "vault1", "resourceGroupPS1", "RPtest1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -121,18 +261,18 @@ func ExampleReplicationRecoveryPlansClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_Update.json func ExampleReplicationRecoveryPlansClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationRecoveryPlansClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, "RPtest1", armrecoveryservicessiterecovery.UpdateRecoveryPlanInput{ + poller, err := clientFactory.NewReplicationRecoveryPlansClient().BeginUpdate(ctx, "vault1", "resourceGroupPS1", "RPtest1", armrecoveryservicessiterecovery.UpdateRecoveryPlanInput{ Properties: &armrecoveryservicessiterecovery.UpdateRecoveryPlanInputProperties{ Groups: []*armrecoveryservicessiterecovery.RecoveryPlanGroup{ { @@ -176,22 +316,85 @@ func ExampleReplicationRecoveryPlansClient_BeginUpdate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RecoveryPlan = armrecoveryservicessiterecovery.RecoveryPlan{ + // Name: to.Ptr("RPtest1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationRecoveryPlans"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationRecoveryPlans/RPtest1"), + // Properties: &armrecoveryservicessiterecovery.RecoveryPlanProperties{ + // AllowedOperations: []*string{ + // to.Ptr("PlannedFailover"), + // to.Ptr("UnplannedFailover"), + // to.Ptr("TestFailover")}, + // FailoverDeploymentModel: to.Ptr("ResourceManager"), + // FriendlyName: to.Ptr("RPtest1"), + // Groups: []*armrecoveryservicessiterecovery.RecoveryPlanGroup{ + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeShutdown), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // }, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeFailover), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // }, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeBoot), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // { + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // VirtualMachineID: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // }}, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeBoot), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // { + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/c0c14913-3d7a-48ea-9531-cc99e0e686e6"), + // VirtualMachineID: to.Ptr("c0c14913-3d7a-48ea-9531-cc99e0e686e6"), + // }}, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }}, + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryFabricID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // ReplicationProviders: []*string{ + // to.Ptr("HyperVReplicaAzure")}, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_FailoverCancel.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_FailoverCancel.json func ExampleReplicationRecoveryPlansClient_BeginFailoverCancel() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationRecoveryPlansClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginFailoverCancel(ctx, "RPtest1", nil) + poller, err := clientFactory.NewReplicationRecoveryPlansClient().BeginFailoverCancel(ctx, "vault1", "resourceGroupPS1", "RPtest1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -199,22 +402,51 @@ func ExampleReplicationRecoveryPlansClient_BeginFailoverCancel() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RecoveryPlan = armrecoveryservicessiterecovery.RecoveryPlan{ + // Name: to.Ptr("RPtest1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationRecoveryPlans"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationRecoveryPlans/RPtest1"), + // Properties: &armrecoveryservicessiterecovery.RecoveryPlanProperties{ + // AllowedOperations: []*string{ + // to.Ptr("PlannedFailover")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/5276a7bc-12a3-43a1-bc53-9bf80e0be87b"), + // ScenarioName: to.Ptr("CancelFailover"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-02-24T08:52:42.1587592Z"); return t}()), + // }, + // CurrentScenarioStatus: to.Ptr("Succeeded"), + // CurrentScenarioStatusDescription: to.Ptr("Completed"), + // FailoverDeploymentModel: to.Ptr("ResourceManager"), + // FriendlyName: to.Ptr("RPtest1"), + // Groups: []*armrecoveryservicessiterecovery.RecoveryPlanGroup{ + // }, + // LastPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-02-24T07:33:49.1372448Z"); return t}()), + // LastTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1601-01-01T00:00:00.0000000Z"); return t}()), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryFabricID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1"), + // RecoveryFabricFriendlyName: to.Ptr("cloud1"), + // RecoveryFabricID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1"), + // ReplicationProviders: []*string{ + // to.Ptr("InMageRcmFailback")}, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_FailoverCommit.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_FailoverCommit.json func ExampleReplicationRecoveryPlansClient_BeginFailoverCommit() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationRecoveryPlansClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginFailoverCommit(ctx, "RPtest1", nil) + poller, err := clientFactory.NewReplicationRecoveryPlansClient().BeginFailoverCommit(ctx, "vault1", "resourceGroupPS1", "RPtest1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -222,22 +454,94 @@ func ExampleReplicationRecoveryPlansClient_BeginFailoverCommit() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RecoveryPlan = armrecoveryservicessiterecovery.RecoveryPlan{ + // Name: to.Ptr("RPtest1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationRecoveryPlans"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationRecoveryPlans/RPtest1"), + // Properties: &armrecoveryservicessiterecovery.RecoveryPlanProperties{ + // AllowedOperations: []*string{ + // to.Ptr("PlannedFailover"), + // to.Ptr("UnplannedFailover"), + // to.Ptr("TestFailover")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/5276a7bc-12a3-43a1-bc53-9bf80e0be87b"), + // ScenarioName: to.Ptr("CommitFailover"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T08:52:42.1587592Z"); return t}()), + // }, + // CurrentScenarioStatus: to.Ptr("Succeeded"), + // CurrentScenarioStatusDescription: to.Ptr("Completed"), + // FailoverDeploymentModel: to.Ptr("ResourceManager"), + // FriendlyName: to.Ptr("RPtest1"), + // Groups: []*armrecoveryservicessiterecovery.RecoveryPlanGroup{ + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeShutdown), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // }, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeFailover), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // }, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeBoot), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // { + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // VirtualMachineID: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // }}, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeBoot), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // { + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/c0c14913-3d7a-48ea-9531-cc99e0e686e6"), + // VirtualMachineID: to.Ptr("c0c14913-3d7a-48ea-9531-cc99e0e686e6"), + // }}, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }}, + // LastPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T07:33:49.1372448Z"); return t}()), + // LastTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T07:00:27.8354747Z"); return t}()), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryFabricID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // ReplicationProviders: []*string{ + // to.Ptr("HyperVReplicaAzure")}, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_PlannedFailover.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_PlannedFailover.json func ExampleReplicationRecoveryPlansClient_BeginPlannedFailover() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationRecoveryPlansClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginPlannedFailover(ctx, "RPtest1", armrecoveryservicessiterecovery.RecoveryPlanPlannedFailoverInput{ + poller, err := clientFactory.NewReplicationRecoveryPlansClient().BeginPlannedFailover(ctx, "vault1", "resourceGroupPS1", "RPtest1", armrecoveryservicessiterecovery.RecoveryPlanPlannedFailoverInput{ Properties: &armrecoveryservicessiterecovery.RecoveryPlanPlannedFailoverInputProperties{ FailoverDirection: to.Ptr(armrecoveryservicessiterecovery.PossibleOperationsDirectionsPrimaryToRecovery), ProviderSpecificDetails: []armrecoveryservicessiterecovery.RecoveryPlanProviderSpecificFailoverInputClassification{ @@ -253,22 +557,95 @@ func ExampleReplicationRecoveryPlansClient_BeginPlannedFailover() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RecoveryPlan = armrecoveryservicessiterecovery.RecoveryPlan{ + // Name: to.Ptr("RPtest1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationRecoveryPlans"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationRecoveryPlans/RPtest1"), + // Properties: &armrecoveryservicessiterecovery.RecoveryPlanProperties{ + // AllowedOperations: []*string{ + // to.Ptr("PlannedFailover"), + // to.Ptr("UnplannedFailover"), + // to.Ptr("TestFailover"), + // to.Ptr("Commit")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/d4821a53-90da-4fcb-bc11-a280d13e3350"), + // ScenarioName: to.Ptr("PlannedFailover"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T07:34:02.6176524Z"); return t}()), + // }, + // CurrentScenarioStatus: to.Ptr("Succeeded"), + // CurrentScenarioStatusDescription: to.Ptr("Completed"), + // FailoverDeploymentModel: to.Ptr("ResourceManager"), + // FriendlyName: to.Ptr("RPtest1"), + // Groups: []*armrecoveryservicessiterecovery.RecoveryPlanGroup{ + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeShutdown), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // }, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeFailover), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // }, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeBoot), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // { + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // VirtualMachineID: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // }}, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeBoot), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // { + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/c0c14913-3d7a-48ea-9531-cc99e0e686e6"), + // VirtualMachineID: to.Ptr("c0c14913-3d7a-48ea-9531-cc99e0e686e6"), + // }}, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }}, + // LastPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T07:33:49.1372448Z"); return t}()), + // LastTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T07:00:27.8354747Z"); return t}()), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryFabricID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // ReplicationProviders: []*string{ + // to.Ptr("HyperVReplicaAzure")}, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_Reprotect.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_Reprotect.json func ExampleReplicationRecoveryPlansClient_BeginReprotect() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationRecoveryPlansClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginReprotect(ctx, "RPtest1", nil) + poller, err := clientFactory.NewReplicationRecoveryPlansClient().BeginReprotect(ctx, "vault1", "resourceGroupPS1", "RPtest1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -276,22 +653,94 @@ func ExampleReplicationRecoveryPlansClient_BeginReprotect() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RecoveryPlan = armrecoveryservicessiterecovery.RecoveryPlan{ + // Name: to.Ptr("RPtest1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationRecoveryPlans"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationRecoveryPlans/RPtest1"), + // Properties: &armrecoveryservicessiterecovery.RecoveryPlanProperties{ + // AllowedOperations: []*string{ + // to.Ptr("PlannedFailover"), + // to.Ptr("UnplannedFailover"), + // to.Ptr("TestFailover")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/edf01dfb-b649-4802-91e4-3d55ce3bebf0"), + // ScenarioName: to.Ptr("ReverseReplication"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T09:52:16.9818841Z"); return t}()), + // }, + // CurrentScenarioStatus: to.Ptr("Succeeded"), + // CurrentScenarioStatusDescription: to.Ptr("Completed"), + // FailoverDeploymentModel: to.Ptr("ResourceManager"), + // FriendlyName: to.Ptr("RPtest1"), + // Groups: []*armrecoveryservicessiterecovery.RecoveryPlanGroup{ + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeShutdown), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // }, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeFailover), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // }, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeBoot), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // { + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // VirtualMachineID: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // }}, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeBoot), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // { + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/c0c14913-3d7a-48ea-9531-cc99e0e686e6"), + // VirtualMachineID: to.Ptr("c0c14913-3d7a-48ea-9531-cc99e0e686e6"), + // }}, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }}, + // LastPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T08:58:35.9062813Z"); return t}()), + // LastTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T07:00:27.8354747Z"); return t}()), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryFabricID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // ReplicationProviders: []*string{ + // to.Ptr("HyperVReplicaAzure")}, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_TestFailover.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_TestFailover.json func ExampleReplicationRecoveryPlansClient_BeginTestFailover() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationRecoveryPlansClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginTestFailover(ctx, "RPtest1", armrecoveryservicessiterecovery.RecoveryPlanTestFailoverInput{ + poller, err := clientFactory.NewReplicationRecoveryPlansClient().BeginTestFailover(ctx, "vault1", "resourceGroupPS1", "RPtest1", armrecoveryservicessiterecovery.RecoveryPlanTestFailoverInput{ Properties: &armrecoveryservicessiterecovery.RecoveryPlanTestFailoverInputProperties{ FailoverDirection: to.Ptr(armrecoveryservicessiterecovery.PossibleOperationsDirectionsPrimaryToRecovery), NetworkID: to.Ptr("/subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/siterecoveryProd1/providers/Microsoft.Network/virtualNetworks/vnetavrai"), @@ -309,22 +758,90 @@ func ExampleReplicationRecoveryPlansClient_BeginTestFailover() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RecoveryPlan = armrecoveryservicessiterecovery.RecoveryPlan{ + // Name: to.Ptr("RPtest1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationRecoveryPlans"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationRecoveryPlans/RPtest1"), + // Properties: &armrecoveryservicessiterecovery.RecoveryPlanProperties{ + // AllowedOperations: []*string{ + // to.Ptr("TestFailoverCleanup")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/d40bfb40-aaaa-4c0d-87d3-41b15439a84b"), + // ScenarioName: to.Ptr("TestFailover"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T07:00:58.8191916Z"); return t}()), + // }, + // CurrentScenarioStatus: to.Ptr("Suspended"), + // CurrentScenarioStatusDescription: to.Ptr("WaitingForStopTestFailover"), + // FailoverDeploymentModel: to.Ptr("ResourceManager"), + // FriendlyName: to.Ptr("RPtest1"), + // Groups: []*armrecoveryservicessiterecovery.RecoveryPlanGroup{ + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeShutdown), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // }, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeFailover), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // }, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeBoot), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // { + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // VirtualMachineID: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // }}, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeBoot), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // { + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/c0c14913-3d7a-48ea-9531-cc99e0e686e6"), + // VirtualMachineID: to.Ptr("c0c14913-3d7a-48ea-9531-cc99e0e686e6"), + // }}, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }}, + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryFabricID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // ReplicationProviders: []*string{ + // to.Ptr("HyperVReplicaAzure")}, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_TestFailoverCleanup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_TestFailoverCleanup.json func ExampleReplicationRecoveryPlansClient_BeginTestFailoverCleanup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationRecoveryPlansClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginTestFailoverCleanup(ctx, "RPtest1", armrecoveryservicessiterecovery.RecoveryPlanTestFailoverCleanupInput{ + poller, err := clientFactory.NewReplicationRecoveryPlansClient().BeginTestFailoverCleanup(ctx, "vault1", "resourceGroupPS1", "RPtest1", armrecoveryservicessiterecovery.RecoveryPlanTestFailoverCleanupInput{ Properties: &armrecoveryservicessiterecovery.RecoveryPlanTestFailoverCleanupInputProperties{ Comments: to.Ptr("Test Failover Cleanup"), }, @@ -336,22 +853,94 @@ func ExampleReplicationRecoveryPlansClient_BeginTestFailoverCleanup() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RecoveryPlan = armrecoveryservicessiterecovery.RecoveryPlan{ + // Name: to.Ptr("RPtest1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationRecoveryPlans"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationRecoveryPlans/RPtest1"), + // Properties: &armrecoveryservicessiterecovery.RecoveryPlanProperties{ + // AllowedOperations: []*string{ + // to.Ptr("PlannedFailover"), + // to.Ptr("UnplannedFailover"), + // to.Ptr("TestFailover")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/4ae8eaa8-a384-42cb-9768-152cb5b8a1ff"), + // ScenarioName: to.Ptr("TestFailoverCleanup"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T07:10:52.8424747Z"); return t}()), + // }, + // CurrentScenarioStatus: to.Ptr("Succeeded"), + // CurrentScenarioStatusDescription: to.Ptr("Completed"), + // FailoverDeploymentModel: to.Ptr("ResourceManager"), + // FriendlyName: to.Ptr("RPtest1"), + // Groups: []*armrecoveryservicessiterecovery.RecoveryPlanGroup{ + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeShutdown), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // }, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeFailover), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // }, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeBoot), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // { + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // VirtualMachineID: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // }}, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeBoot), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // { + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/c0c14913-3d7a-48ea-9531-cc99e0e686e6"), + // VirtualMachineID: to.Ptr("c0c14913-3d7a-48ea-9531-cc99e0e686e6"), + // }}, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }}, + // LastPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T07:33:49.1372448Z"); return t}()), + // LastTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T07:00:27.8354747Z"); return t}()), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryFabricID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // ReplicationProviders: []*string{ + // to.Ptr("HyperVReplicaAzure")}, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_UnplannedFailover.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_UnplannedFailover.json func ExampleReplicationRecoveryPlansClient_BeginUnplannedFailover() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationRecoveryPlansClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUnplannedFailover(ctx, "RPtest1", armrecoveryservicessiterecovery.RecoveryPlanUnplannedFailoverInput{ + poller, err := clientFactory.NewReplicationRecoveryPlansClient().BeginUnplannedFailover(ctx, "vault1", "resourceGroupPS1", "RPtest1", armrecoveryservicessiterecovery.RecoveryPlanUnplannedFailoverInput{ Properties: &armrecoveryservicessiterecovery.RecoveryPlanUnplannedFailoverInputProperties{ FailoverDirection: to.Ptr(armrecoveryservicessiterecovery.PossibleOperationsDirectionsPrimaryToRecovery), ProviderSpecificDetails: []armrecoveryservicessiterecovery.RecoveryPlanProviderSpecificFailoverInputClassification{ @@ -368,6 +957,79 @@ func ExampleReplicationRecoveryPlansClient_BeginUnplannedFailover() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RecoveryPlan = armrecoveryservicessiterecovery.RecoveryPlan{ + // Name: to.Ptr("RPtest1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationRecoveryPlans"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationRecoveryPlans/RPtest1"), + // Properties: &armrecoveryservicessiterecovery.RecoveryPlanProperties{ + // AllowedOperations: []*string{ + // to.Ptr("PlannedFailover"), + // to.Ptr("UnplannedFailover"), + // to.Ptr("TestFailover"), + // to.Ptr("Commit")}, + // CurrentScenario: &armrecoveryservicessiterecovery.CurrentScenarioDetails{ + // JobID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationJobs/60b84068-9adb-4867-a49d-88be40bff14b"), + // ScenarioName: to.Ptr("UnplannedFailover"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T10:03:03.2206946Z"); return t}()), + // }, + // CurrentScenarioStatus: to.Ptr("Succeeded"), + // CurrentScenarioStatusDescription: to.Ptr("Completed"), + // FailoverDeploymentModel: to.Ptr("ResourceManager"), + // FriendlyName: to.Ptr("RPtest1"), + // Groups: []*armrecoveryservicessiterecovery.RecoveryPlanGroup{ + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeShutdown), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // }, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeFailover), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // }, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeBoot), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // { + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/f8491e4f-817a-40dd-a90c-af773978c75b"), + // VirtualMachineID: to.Ptr("f8491e4f-817a-40dd-a90c-af773978c75b"), + // }}, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }, + // { + // EndGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // GroupType: to.Ptr(armrecoveryservicessiterecovery.RecoveryPlanGroupTypeBoot), + // ReplicationProtectedItems: []*armrecoveryservicessiterecovery.RecoveryPlanProtectedItem{ + // { + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationProtectionContainers/cloud_6d224fc6-f326-5d35-96de-fbf51efb3179/replicationProtectedItems/c0c14913-3d7a-48ea-9531-cc99e0e686e6"), + // VirtualMachineID: to.Ptr("c0c14913-3d7a-48ea-9531-cc99e0e686e6"), + // }}, + // StartGroupActions: []*armrecoveryservicessiterecovery.RecoveryPlanAction{ + // }, + // }}, + // LastPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T08:58:35.9062813Z"); return t}()), + // LastTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T07:00:27.8354747Z"); return t}()), + // PrimaryFabricFriendlyName: to.Ptr("cloud1"), + // PrimaryFabricID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1"), + // RecoveryFabricFriendlyName: to.Ptr("Microsoft Azure"), + // RecoveryFabricID: to.Ptr("Microsoft Azure"), + // ReplicationProviders: []*string{ + // to.Ptr("HyperVReplicaAzure")}, + // }, + // } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationrecoveryservicesproviders_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationrecoveryservicesproviders_client.go index afdbcadaa5d8..d104212c441e 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationrecoveryservicesproviders_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationrecoveryservicesproviders_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,70 +24,59 @@ import ( // ReplicationRecoveryServicesProvidersClient contains the methods for the ReplicationRecoveryServicesProviders group. // Don't use this type directly, use NewReplicationRecoveryServicesProvidersClient() instead. type ReplicationRecoveryServicesProvidersClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationRecoveryServicesProvidersClient creates a new instance of ReplicationRecoveryServicesProvidersClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationRecoveryServicesProvidersClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationRecoveryServicesProvidersClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationRecoveryServicesProvidersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationRecoveryServicesProvidersClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationRecoveryServicesProvidersClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationRecoveryServicesProvidersClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // BeginCreate - The operation to add a recovery services provider. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// providerName - Recovery services provider name. -// addProviderInput - Add provider input. -// options - ReplicationRecoveryServicesProvidersClientBeginCreateOptions contains the optional parameters for the ReplicationRecoveryServicesProvidersClient.BeginCreate -// method. -func (client *ReplicationRecoveryServicesProvidersClient) BeginCreate(ctx context.Context, fabricName string, providerName string, addProviderInput AddRecoveryServicesProviderInput, options *ReplicationRecoveryServicesProvidersClientBeginCreateOptions) (*runtime.Poller[ReplicationRecoveryServicesProvidersClientCreateResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - providerName - Recovery services provider name. +// - addProviderInput - Add provider input. +// - options - ReplicationRecoveryServicesProvidersClientBeginCreateOptions contains the optional parameters for the ReplicationRecoveryServicesProvidersClient.BeginCreate +// method. +func (client *ReplicationRecoveryServicesProvidersClient) BeginCreate(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, providerName string, addProviderInput AddRecoveryServicesProviderInput, options *ReplicationRecoveryServicesProvidersClientBeginCreateOptions) (*runtime.Poller[ReplicationRecoveryServicesProvidersClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, fabricName, providerName, addProviderInput, options) + resp, err := client.create(ctx, resourceName, resourceGroupName, fabricName, providerName, addProviderInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationRecoveryServicesProvidersClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationRecoveryServicesProvidersClientCreateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationRecoveryServicesProvidersClientCreateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationRecoveryServicesProvidersClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Create - The operation to add a recovery services provider. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationRecoveryServicesProvidersClient) create(ctx context.Context, fabricName string, providerName string, addProviderInput AddRecoveryServicesProviderInput, options *ReplicationRecoveryServicesProvidersClientBeginCreateOptions) (*http.Response, error) { - req, err := client.createCreateRequest(ctx, fabricName, providerName, addProviderInput, options) +func (client *ReplicationRecoveryServicesProvidersClient) create(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, providerName string, addProviderInput AddRecoveryServicesProviderInput, options *ReplicationRecoveryServicesProvidersClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceName, resourceGroupName, fabricName, providerName, addProviderInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -100,16 +87,16 @@ func (client *ReplicationRecoveryServicesProvidersClient) create(ctx context.Con } // createCreateRequest creates the Create request. -func (client *ReplicationRecoveryServicesProvidersClient) createCreateRequest(ctx context.Context, fabricName string, providerName string, addProviderInput AddRecoveryServicesProviderInput, options *ReplicationRecoveryServicesProvidersClientBeginCreateOptions) (*policy.Request, error) { +func (client *ReplicationRecoveryServicesProvidersClient) createCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, providerName string, addProviderInput AddRecoveryServicesProviderInput, options *ReplicationRecoveryServicesProvidersClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -122,7 +109,7 @@ func (client *ReplicationRecoveryServicesProvidersClient) createCreateRequest(ct return nil, errors.New("parameter providerName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{providerName}", url.PathEscape(providerName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -135,32 +122,36 @@ func (client *ReplicationRecoveryServicesProvidersClient) createCreateRequest(ct // BeginDelete - The operation to removes/delete(unregister) a recovery services provider from the vault. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// providerName - Recovery services provider name. -// options - ReplicationRecoveryServicesProvidersClientBeginDeleteOptions contains the optional parameters for the ReplicationRecoveryServicesProvidersClient.BeginDelete -// method. -func (client *ReplicationRecoveryServicesProvidersClient) BeginDelete(ctx context.Context, fabricName string, providerName string, options *ReplicationRecoveryServicesProvidersClientBeginDeleteOptions) (*runtime.Poller[ReplicationRecoveryServicesProvidersClientDeleteResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - providerName - Recovery services provider name. +// - options - ReplicationRecoveryServicesProvidersClientBeginDeleteOptions contains the optional parameters for the ReplicationRecoveryServicesProvidersClient.BeginDelete +// method. +func (client *ReplicationRecoveryServicesProvidersClient) BeginDelete(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, providerName string, options *ReplicationRecoveryServicesProvidersClientBeginDeleteOptions) (*runtime.Poller[ReplicationRecoveryServicesProvidersClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, fabricName, providerName, options) + resp, err := client.deleteOperation(ctx, resourceName, resourceGroupName, fabricName, providerName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationRecoveryServicesProvidersClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationRecoveryServicesProvidersClientDeleteResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationRecoveryServicesProvidersClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationRecoveryServicesProvidersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - The operation to removes/delete(unregister) a recovery services provider from the vault. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationRecoveryServicesProvidersClient) deleteOperation(ctx context.Context, fabricName string, providerName string, options *ReplicationRecoveryServicesProvidersClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, fabricName, providerName, options) +func (client *ReplicationRecoveryServicesProvidersClient) deleteOperation(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, providerName string, options *ReplicationRecoveryServicesProvidersClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceName, resourceGroupName, fabricName, providerName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -171,16 +162,16 @@ func (client *ReplicationRecoveryServicesProvidersClient) deleteOperation(ctx co } // deleteCreateRequest creates the Delete request. -func (client *ReplicationRecoveryServicesProvidersClient) deleteCreateRequest(ctx context.Context, fabricName string, providerName string, options *ReplicationRecoveryServicesProvidersClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ReplicationRecoveryServicesProvidersClient) deleteCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, providerName string, options *ReplicationRecoveryServicesProvidersClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/remove" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -193,7 +184,7 @@ func (client *ReplicationRecoveryServicesProvidersClient) deleteCreateRequest(ct return nil, errors.New("parameter providerName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{providerName}", url.PathEscape(providerName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -205,17 +196,20 @@ func (client *ReplicationRecoveryServicesProvidersClient) deleteCreateRequest(ct // Get - Gets the details of registered recovery services provider. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// providerName - Recovery services provider name. -// options - ReplicationRecoveryServicesProvidersClientGetOptions contains the optional parameters for the ReplicationRecoveryServicesProvidersClient.Get -// method. -func (client *ReplicationRecoveryServicesProvidersClient) Get(ctx context.Context, fabricName string, providerName string, options *ReplicationRecoveryServicesProvidersClientGetOptions) (ReplicationRecoveryServicesProvidersClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, fabricName, providerName, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - providerName - Recovery services provider name. +// - options - ReplicationRecoveryServicesProvidersClientGetOptions contains the optional parameters for the ReplicationRecoveryServicesProvidersClient.Get +// method. +func (client *ReplicationRecoveryServicesProvidersClient) Get(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, providerName string, options *ReplicationRecoveryServicesProvidersClientGetOptions) (ReplicationRecoveryServicesProvidersClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, fabricName, providerName, options) if err != nil { return ReplicationRecoveryServicesProvidersClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationRecoveryServicesProvidersClientGetResponse{}, err } @@ -226,16 +220,16 @@ func (client *ReplicationRecoveryServicesProvidersClient) Get(ctx context.Contex } // getCreateRequest creates the Get request. -func (client *ReplicationRecoveryServicesProvidersClient) getCreateRequest(ctx context.Context, fabricName string, providerName string, options *ReplicationRecoveryServicesProvidersClientGetOptions) (*policy.Request, error) { +func (client *ReplicationRecoveryServicesProvidersClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, providerName string, options *ReplicationRecoveryServicesProvidersClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -248,7 +242,7 @@ func (client *ReplicationRecoveryServicesProvidersClient) getCreateRequest(ctx c return nil, errors.New("parameter providerName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{providerName}", url.PathEscape(providerName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -269,10 +263,13 @@ func (client *ReplicationRecoveryServicesProvidersClient) getHandleResponse(resp } // NewListPager - Lists the registered recovery services providers in the vault. +// // Generated from API version 2022-10-01 -// options - ReplicationRecoveryServicesProvidersClientListOptions contains the optional parameters for the ReplicationRecoveryServicesProvidersClient.List -// method. -func (client *ReplicationRecoveryServicesProvidersClient) NewListPager(options *ReplicationRecoveryServicesProvidersClientListOptions) *runtime.Pager[ReplicationRecoveryServicesProvidersClientListResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - ReplicationRecoveryServicesProvidersClientListOptions contains the optional parameters for the ReplicationRecoveryServicesProvidersClient.NewListPager +// method. +func (client *ReplicationRecoveryServicesProvidersClient) NewListPager(resourceName string, resourceGroupName string, options *ReplicationRecoveryServicesProvidersClientListOptions) *runtime.Pager[ReplicationRecoveryServicesProvidersClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationRecoveryServicesProvidersClientListResponse]{ More: func(page ReplicationRecoveryServicesProvidersClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -281,14 +278,14 @@ func (client *ReplicationRecoveryServicesProvidersClient) NewListPager(options * var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, resourceName, resourceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationRecoveryServicesProvidersClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationRecoveryServicesProvidersClientListResponse{}, err } @@ -301,21 +298,21 @@ func (client *ReplicationRecoveryServicesProvidersClient) NewListPager(options * } // listCreateRequest creates the List request. -func (client *ReplicationRecoveryServicesProvidersClient) listCreateRequest(ctx context.Context, options *ReplicationRecoveryServicesProvidersClientListOptions) (*policy.Request, error) { +func (client *ReplicationRecoveryServicesProvidersClient) listCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationRecoveryServicesProvidersClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryServicesProviders" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -336,11 +333,14 @@ func (client *ReplicationRecoveryServicesProvidersClient) listHandleResponse(res } // NewListByReplicationFabricsPager - Lists the registered recovery services providers for the specified fabric. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// options - ReplicationRecoveryServicesProvidersClientListByReplicationFabricsOptions contains the optional parameters for -// the ReplicationRecoveryServicesProvidersClient.ListByReplicationFabrics method. -func (client *ReplicationRecoveryServicesProvidersClient) NewListByReplicationFabricsPager(fabricName string, options *ReplicationRecoveryServicesProvidersClientListByReplicationFabricsOptions) *runtime.Pager[ReplicationRecoveryServicesProvidersClientListByReplicationFabricsResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - options - ReplicationRecoveryServicesProvidersClientListByReplicationFabricsOptions contains the optional parameters for +// the ReplicationRecoveryServicesProvidersClient.NewListByReplicationFabricsPager method. +func (client *ReplicationRecoveryServicesProvidersClient) NewListByReplicationFabricsPager(resourceName string, resourceGroupName string, fabricName string, options *ReplicationRecoveryServicesProvidersClientListByReplicationFabricsOptions) *runtime.Pager[ReplicationRecoveryServicesProvidersClientListByReplicationFabricsResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationRecoveryServicesProvidersClientListByReplicationFabricsResponse]{ More: func(page ReplicationRecoveryServicesProvidersClientListByReplicationFabricsResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -349,14 +349,14 @@ func (client *ReplicationRecoveryServicesProvidersClient) NewListByReplicationFa var req *policy.Request var err error if page == nil { - req, err = client.listByReplicationFabricsCreateRequest(ctx, fabricName, options) + req, err = client.listByReplicationFabricsCreateRequest(ctx, resourceName, resourceGroupName, fabricName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationRecoveryServicesProvidersClientListByReplicationFabricsResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationRecoveryServicesProvidersClientListByReplicationFabricsResponse{}, err } @@ -369,16 +369,16 @@ func (client *ReplicationRecoveryServicesProvidersClient) NewListByReplicationFa } // listByReplicationFabricsCreateRequest creates the ListByReplicationFabrics request. -func (client *ReplicationRecoveryServicesProvidersClient) listByReplicationFabricsCreateRequest(ctx context.Context, fabricName string, options *ReplicationRecoveryServicesProvidersClientListByReplicationFabricsOptions) (*policy.Request, error) { +func (client *ReplicationRecoveryServicesProvidersClient) listByReplicationFabricsCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, options *ReplicationRecoveryServicesProvidersClientListByReplicationFabricsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -387,7 +387,7 @@ func (client *ReplicationRecoveryServicesProvidersClient) listByReplicationFabri return nil, errors.New("parameter fabricName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -409,32 +409,36 @@ func (client *ReplicationRecoveryServicesProvidersClient) listByReplicationFabri // BeginPurge - The operation to purge(force delete) a recovery services provider from the vault. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// providerName - Recovery services provider name. -// options - ReplicationRecoveryServicesProvidersClientBeginPurgeOptions contains the optional parameters for the ReplicationRecoveryServicesProvidersClient.BeginPurge -// method. -func (client *ReplicationRecoveryServicesProvidersClient) BeginPurge(ctx context.Context, fabricName string, providerName string, options *ReplicationRecoveryServicesProvidersClientBeginPurgeOptions) (*runtime.Poller[ReplicationRecoveryServicesProvidersClientPurgeResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - providerName - Recovery services provider name. +// - options - ReplicationRecoveryServicesProvidersClientBeginPurgeOptions contains the optional parameters for the ReplicationRecoveryServicesProvidersClient.BeginPurge +// method. +func (client *ReplicationRecoveryServicesProvidersClient) BeginPurge(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, providerName string, options *ReplicationRecoveryServicesProvidersClientBeginPurgeOptions) (*runtime.Poller[ReplicationRecoveryServicesProvidersClientPurgeResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.purge(ctx, fabricName, providerName, options) + resp, err := client.purge(ctx, resourceName, resourceGroupName, fabricName, providerName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationRecoveryServicesProvidersClientPurgeResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationRecoveryServicesProvidersClientPurgeResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationRecoveryServicesProvidersClientPurgeResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationRecoveryServicesProvidersClientPurgeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Purge - The operation to purge(force delete) a recovery services provider from the vault. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationRecoveryServicesProvidersClient) purge(ctx context.Context, fabricName string, providerName string, options *ReplicationRecoveryServicesProvidersClientBeginPurgeOptions) (*http.Response, error) { - req, err := client.purgeCreateRequest(ctx, fabricName, providerName, options) +func (client *ReplicationRecoveryServicesProvidersClient) purge(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, providerName string, options *ReplicationRecoveryServicesProvidersClientBeginPurgeOptions) (*http.Response, error) { + req, err := client.purgeCreateRequest(ctx, resourceName, resourceGroupName, fabricName, providerName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -445,16 +449,16 @@ func (client *ReplicationRecoveryServicesProvidersClient) purge(ctx context.Cont } // purgeCreateRequest creates the Purge request. -func (client *ReplicationRecoveryServicesProvidersClient) purgeCreateRequest(ctx context.Context, fabricName string, providerName string, options *ReplicationRecoveryServicesProvidersClientBeginPurgeOptions) (*policy.Request, error) { +func (client *ReplicationRecoveryServicesProvidersClient) purgeCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, providerName string, options *ReplicationRecoveryServicesProvidersClientBeginPurgeOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -467,7 +471,7 @@ func (client *ReplicationRecoveryServicesProvidersClient) purgeCreateRequest(ctx return nil, errors.New("parameter providerName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{providerName}", url.PathEscape(providerName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -479,32 +483,36 @@ func (client *ReplicationRecoveryServicesProvidersClient) purgeCreateRequest(ctx // BeginRefreshProvider - The operation to refresh the information from the recovery services provider. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// providerName - Recovery services provider name. -// options - ReplicationRecoveryServicesProvidersClientBeginRefreshProviderOptions contains the optional parameters for the -// ReplicationRecoveryServicesProvidersClient.BeginRefreshProvider method. -func (client *ReplicationRecoveryServicesProvidersClient) BeginRefreshProvider(ctx context.Context, fabricName string, providerName string, options *ReplicationRecoveryServicesProvidersClientBeginRefreshProviderOptions) (*runtime.Poller[ReplicationRecoveryServicesProvidersClientRefreshProviderResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - providerName - Recovery services provider name. +// - options - ReplicationRecoveryServicesProvidersClientBeginRefreshProviderOptions contains the optional parameters for the +// ReplicationRecoveryServicesProvidersClient.BeginRefreshProvider method. +func (client *ReplicationRecoveryServicesProvidersClient) BeginRefreshProvider(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, providerName string, options *ReplicationRecoveryServicesProvidersClientBeginRefreshProviderOptions) (*runtime.Poller[ReplicationRecoveryServicesProvidersClientRefreshProviderResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.refreshProvider(ctx, fabricName, providerName, options) + resp, err := client.refreshProvider(ctx, resourceName, resourceGroupName, fabricName, providerName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationRecoveryServicesProvidersClientRefreshProviderResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationRecoveryServicesProvidersClientRefreshProviderResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationRecoveryServicesProvidersClientRefreshProviderResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationRecoveryServicesProvidersClientRefreshProviderResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // RefreshProvider - The operation to refresh the information from the recovery services provider. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationRecoveryServicesProvidersClient) refreshProvider(ctx context.Context, fabricName string, providerName string, options *ReplicationRecoveryServicesProvidersClientBeginRefreshProviderOptions) (*http.Response, error) { - req, err := client.refreshProviderCreateRequest(ctx, fabricName, providerName, options) +func (client *ReplicationRecoveryServicesProvidersClient) refreshProvider(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, providerName string, options *ReplicationRecoveryServicesProvidersClientBeginRefreshProviderOptions) (*http.Response, error) { + req, err := client.refreshProviderCreateRequest(ctx, resourceName, resourceGroupName, fabricName, providerName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -515,16 +523,16 @@ func (client *ReplicationRecoveryServicesProvidersClient) refreshProvider(ctx co } // refreshProviderCreateRequest creates the RefreshProvider request. -func (client *ReplicationRecoveryServicesProvidersClient) refreshProviderCreateRequest(ctx context.Context, fabricName string, providerName string, options *ReplicationRecoveryServicesProvidersClientBeginRefreshProviderOptions) (*policy.Request, error) { +func (client *ReplicationRecoveryServicesProvidersClient) refreshProviderCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, providerName string, options *ReplicationRecoveryServicesProvidersClientBeginRefreshProviderOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/refreshProvider" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -537,7 +545,7 @@ func (client *ReplicationRecoveryServicesProvidersClient) refreshProviderCreateR return nil, errors.New("parameter providerName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{providerName}", url.PathEscape(providerName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationrecoveryservicesproviders_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationrecoveryservicesproviders_client_example_test.go index a586adfdca65..1db85a0c8cf6 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationrecoveryservicesproviders_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationrecoveryservicesproviders_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -14,64 +15,105 @@ import ( "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/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_ListByReplicationFabrics.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_ListByReplicationFabrics.json func ExampleReplicationRecoveryServicesProvidersClient_NewListByReplicationFabricsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationRecoveryServicesProvidersClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByReplicationFabricsPager("cloud1", nil) + pager := clientFactory.NewReplicationRecoveryServicesProvidersClient().NewListByReplicationFabricsPager("vault1", "resourceGroupPS1", "cloud1", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.RecoveryServicesProviderCollection = armrecoveryservicessiterecovery.RecoveryServicesProviderCollection{ + // Value: []*armrecoveryservicessiterecovery.RecoveryServicesProvider{ + // { + // Name: to.Ptr("241641e6-ee7b-4ee4-8141-821fadda43fa"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationRecoveryServicesProviders"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/241641e6-ee7b-4ee4-8141-821fadda43fa"), + // Properties: &armrecoveryservicessiterecovery.RecoveryServicesProviderProperties{ + // AllowedScenarios: []*string{ + // to.Ptr("Refresh")}, + // ConnectionStatus: to.Ptr("Connected"), + // FabricFriendlyName: to.Ptr("cloud1"), + // FabricType: to.Ptr("HyperVSite"), + // FriendlyName: to.Ptr("CP-B3L40406-12.ntdev.corp.microsoft.com"), + // LastHeartBeat: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T09:06:38.2728455Z"); return t}()), + // ProtectedItemCount: to.Ptr[int32](2), + // ProviderVersion: to.Ptr("5.1.2250.0"), + // ProviderVersionState: to.Ptr("Latest"), + // ServerVersion: to.Ptr("3.2.7510.0"), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_Get.json func ExampleReplicationRecoveryServicesProvidersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationRecoveryServicesProvidersClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "cloud1", "241641e6-ee7b-4ee4-8141-821fadda43fa", nil) + res, err := clientFactory.NewReplicationRecoveryServicesProvidersClient().Get(ctx, "vault1", "resourceGroupPS1", "cloud1", "241641e6-ee7b-4ee4-8141-821fadda43fa", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RecoveryServicesProvider = armrecoveryservicessiterecovery.RecoveryServicesProvider{ + // Name: to.Ptr("241641e6-ee7b-4ee4-8141-821fadda43fa"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationRecoveryServicesProviders"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/241641e6-ee7b-4ee4-8141-821fadda43fa"), + // Properties: &armrecoveryservicessiterecovery.RecoveryServicesProviderProperties{ + // AllowedScenarios: []*string{ + // to.Ptr("Refresh")}, + // ConnectionStatus: to.Ptr("Connected"), + // FabricFriendlyName: to.Ptr("cloud1"), + // FabricType: to.Ptr("HyperVSite"), + // FriendlyName: to.Ptr("CP-B3L40406-12.ntdev.corp.microsoft.com"), + // LastHeartBeat: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T09:16:04.9405768Z"); return t}()), + // ProtectedItemCount: to.Ptr[int32](2), + // ProviderVersion: to.Ptr("5.1.2250.0"), + // ProviderVersionState: to.Ptr("Latest"), + // ServerVersion: to.Ptr("3.2.7510.0"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_Create.json func ExampleReplicationRecoveryServicesProvidersClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationRecoveryServicesProvidersClient("migrationvault", "resourcegroup1", "cb53d0c3-bd59-4721-89bc-06916a9147ef", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreate(ctx, "vmwarefabric1", "vmwareprovider1", armrecoveryservicessiterecovery.AddRecoveryServicesProviderInput{ + poller, err := clientFactory.NewReplicationRecoveryServicesProvidersClient().BeginCreate(ctx, "migrationvault", "resourcegroup1", "vmwarefabric1", "vmwareprovider1", armrecoveryservicessiterecovery.AddRecoveryServicesProviderInput{ Properties: &armrecoveryservicessiterecovery.AddRecoveryServicesProviderInputProperties{ AuthenticationIdentityInput: &armrecoveryservicessiterecovery.IdentityProviderInput{ AADAuthority: to.Ptr("https://login.microsoftonline.com"), @@ -97,22 +139,41 @@ func ExampleReplicationRecoveryServicesProvidersClient_BeginCreate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RecoveryServicesProvider = armrecoveryservicessiterecovery.RecoveryServicesProvider{ + // Name: to.Ptr("vmwareprovider1"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationRecoveryServicesProviders"), + // ID: to.Ptr("/Subscriptions/cb53d0c3-bd59-4721-89bc-06916a9147ef/resourceGroups/resourcegroup1/providers/Microsoft.RecoveryServices/vaults/migrationvault/replicationFabrics/vmwarefabric1/replicationRecoveryServicesProviders/vmwareprovider1"), + // Properties: &armrecoveryservicessiterecovery.RecoveryServicesProviderProperties{ + // AllowedScenarios: []*string{ + // to.Ptr("Refresh")}, + // ConnectionStatus: to.Ptr("Connected"), + // FabricFriendlyName: to.Ptr("vmwarefabric1"), + // FabricType: to.Ptr("VMwareV2"), + // FriendlyName: to.Ptr("vmwareprovider1"), + // LastHeartBeat: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T09:16:04.9405768Z"); return t}()), + // ProtectedItemCount: to.Ptr[int32](2), + // ProviderVersion: to.Ptr("5.1.3688.0"), + // ProviderVersionState: to.Ptr("Latest"), + // ServerVersion: to.Ptr("3.2.7510.0"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_Purge.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_Purge.json func ExampleReplicationRecoveryServicesProvidersClient_BeginPurge() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationRecoveryServicesProvidersClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginPurge(ctx, "cloud1", "241641e6-ee7b-4ee4-8141-821fadda43fa", nil) + poller, err := clientFactory.NewReplicationRecoveryServicesProvidersClient().BeginPurge(ctx, "vault1", "resourceGroupPS1", "cloud1", "241641e6-ee7b-4ee4-8141-821fadda43fa", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -122,18 +183,18 @@ func ExampleReplicationRecoveryServicesProvidersClient_BeginPurge() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_RefreshProvider.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_RefreshProvider.json func ExampleReplicationRecoveryServicesProvidersClient_BeginRefreshProvider() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationRecoveryServicesProvidersClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginRefreshProvider(ctx, "cloud1", "241641e6-ee7b-4ee4-8141-821fadda43fa", nil) + poller, err := clientFactory.NewReplicationRecoveryServicesProvidersClient().BeginRefreshProvider(ctx, "vault1", "resourceGroupPS1", "cloud1", "241641e6-ee7b-4ee4-8141-821fadda43fa", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -141,22 +202,41 @@ func ExampleReplicationRecoveryServicesProvidersClient_BeginRefreshProvider() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RecoveryServicesProvider = armrecoveryservicessiterecovery.RecoveryServicesProvider{ + // Name: to.Ptr("241641e6-ee7b-4ee4-8141-821fadda43fa"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationRecoveryServicesProviders"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/241641e6-ee7b-4ee4-8141-821fadda43fa"), + // Properties: &armrecoveryservicessiterecovery.RecoveryServicesProviderProperties{ + // AllowedScenarios: []*string{ + // to.Ptr("Refresh")}, + // ConnectionStatus: to.Ptr("Connected"), + // FabricFriendlyName: to.Ptr("cloud1"), + // FabricType: to.Ptr("HyperVSite"), + // FriendlyName: to.Ptr("CP-B3L40406-12.ntdev.corp.microsoft.com"), + // LastHeartBeat: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T09:48:36.6528303Z"); return t}()), + // ProtectedItemCount: to.Ptr[int32](2), + // ProviderVersion: to.Ptr("5.1.2250.0"), + // ProviderVersionState: to.Ptr("Latest"), + // ServerVersion: to.Ptr("3.2.7510.0"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_Delete.json func ExampleReplicationRecoveryServicesProvidersClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationRecoveryServicesProvidersClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, "cloud1", "241641e6-ee7b-4ee4-8141-821fadda43fa", nil) + poller, err := clientFactory.NewReplicationRecoveryServicesProvidersClient().BeginDelete(ctx, "vault1", "resourceGroupPS1", "cloud1", "241641e6-ee7b-4ee4-8141-821fadda43fa", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -166,26 +246,48 @@ func ExampleReplicationRecoveryServicesProvidersClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_List.json func ExampleReplicationRecoveryServicesProvidersClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationRecoveryServicesProvidersClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(nil) + pager := clientFactory.NewReplicationRecoveryServicesProvidersClient().NewListPager("vault1", "resourceGroupPS1", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.RecoveryServicesProviderCollection = armrecoveryservicessiterecovery.RecoveryServicesProviderCollection{ + // Value: []*armrecoveryservicessiterecovery.RecoveryServicesProvider{ + // { + // Name: to.Ptr("241641e6-ee7b-4ee4-8141-821fadda43fa"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationRecoveryServicesProviders"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/cloud1/replicationRecoveryServicesProviders/241641e6-ee7b-4ee4-8141-821fadda43fa"), + // Properties: &armrecoveryservicessiterecovery.RecoveryServicesProviderProperties{ + // AllowedScenarios: []*string{ + // to.Ptr("Refresh")}, + // ConnectionStatus: to.Ptr("Connected"), + // FabricFriendlyName: to.Ptr("cloud1"), + // FabricType: to.Ptr("HyperVSite"), + // FriendlyName: to.Ptr("CP-B3L40406-12.ntdev.corp.microsoft.com"), + // LastHeartBeat: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-27T09:06:38.2728455Z"); return t}()), + // ProtectedItemCount: to.Ptr[int32](2), + // ProviderVersion: to.Ptr("5.1.2250.0"), + // ProviderVersionState: to.Ptr("Latest"), + // ServerVersion: to.Ptr("3.2.7510.0"), + // }, + // }}, + // } } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationstorageclassificationmappings_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationstorageclassificationmappings_client.go index e9897b9498d3..67a24efb187e 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationstorageclassificationmappings_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationstorageclassificationmappings_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,71 +24,60 @@ import ( // ReplicationStorageClassificationMappingsClient contains the methods for the ReplicationStorageClassificationMappings group. // Don't use this type directly, use NewReplicationStorageClassificationMappingsClient() instead. type ReplicationStorageClassificationMappingsClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationStorageClassificationMappingsClient creates a new instance of ReplicationStorageClassificationMappingsClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationStorageClassificationMappingsClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationStorageClassificationMappingsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationStorageClassificationMappingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationStorageClassificationMappingsClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationStorageClassificationMappingsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationStorageClassificationMappingsClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // BeginCreate - The operation to create a storage classification mapping. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// storageClassificationName - Storage classification name. -// storageClassificationMappingName - Storage classification mapping name. -// pairingInput - Pairing input. -// options - ReplicationStorageClassificationMappingsClientBeginCreateOptions contains the optional parameters for the ReplicationStorageClassificationMappingsClient.BeginCreate -// method. -func (client *ReplicationStorageClassificationMappingsClient) BeginCreate(ctx context.Context, fabricName string, storageClassificationName string, storageClassificationMappingName string, pairingInput StorageClassificationMappingInput, options *ReplicationStorageClassificationMappingsClientBeginCreateOptions) (*runtime.Poller[ReplicationStorageClassificationMappingsClientCreateResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - storageClassificationName - Storage classification name. +// - storageClassificationMappingName - Storage classification mapping name. +// - pairingInput - Pairing input. +// - options - ReplicationStorageClassificationMappingsClientBeginCreateOptions contains the optional parameters for the ReplicationStorageClassificationMappingsClient.BeginCreate +// method. +func (client *ReplicationStorageClassificationMappingsClient) BeginCreate(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, storageClassificationName string, storageClassificationMappingName string, pairingInput StorageClassificationMappingInput, options *ReplicationStorageClassificationMappingsClientBeginCreateOptions) (*runtime.Poller[ReplicationStorageClassificationMappingsClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, fabricName, storageClassificationName, storageClassificationMappingName, pairingInput, options) + resp, err := client.create(ctx, resourceName, resourceGroupName, fabricName, storageClassificationName, storageClassificationMappingName, pairingInput, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationStorageClassificationMappingsClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationStorageClassificationMappingsClientCreateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationStorageClassificationMappingsClientCreateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationStorageClassificationMappingsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Create - The operation to create a storage classification mapping. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationStorageClassificationMappingsClient) create(ctx context.Context, fabricName string, storageClassificationName string, storageClassificationMappingName string, pairingInput StorageClassificationMappingInput, options *ReplicationStorageClassificationMappingsClientBeginCreateOptions) (*http.Response, error) { - req, err := client.createCreateRequest(ctx, fabricName, storageClassificationName, storageClassificationMappingName, pairingInput, options) +func (client *ReplicationStorageClassificationMappingsClient) create(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, storageClassificationName string, storageClassificationMappingName string, pairingInput StorageClassificationMappingInput, options *ReplicationStorageClassificationMappingsClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceName, resourceGroupName, fabricName, storageClassificationName, storageClassificationMappingName, pairingInput, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -101,16 +88,16 @@ func (client *ReplicationStorageClassificationMappingsClient) create(ctx context } // createCreateRequest creates the Create request. -func (client *ReplicationStorageClassificationMappingsClient) createCreateRequest(ctx context.Context, fabricName string, storageClassificationName string, storageClassificationMappingName string, pairingInput StorageClassificationMappingInput, options *ReplicationStorageClassificationMappingsClientBeginCreateOptions) (*policy.Request, error) { +func (client *ReplicationStorageClassificationMappingsClient) createCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, storageClassificationName string, storageClassificationMappingName string, pairingInput StorageClassificationMappingInput, options *ReplicationStorageClassificationMappingsClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -127,7 +114,7 @@ func (client *ReplicationStorageClassificationMappingsClient) createCreateReques return nil, errors.New("parameter storageClassificationMappingName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{storageClassificationMappingName}", url.PathEscape(storageClassificationMappingName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -140,33 +127,37 @@ func (client *ReplicationStorageClassificationMappingsClient) createCreateReques // BeginDelete - The operation to delete a storage classification mapping. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// storageClassificationName - Storage classification name. -// storageClassificationMappingName - Storage classification mapping name. -// options - ReplicationStorageClassificationMappingsClientBeginDeleteOptions contains the optional parameters for the ReplicationStorageClassificationMappingsClient.BeginDelete -// method. -func (client *ReplicationStorageClassificationMappingsClient) BeginDelete(ctx context.Context, fabricName string, storageClassificationName string, storageClassificationMappingName string, options *ReplicationStorageClassificationMappingsClientBeginDeleteOptions) (*runtime.Poller[ReplicationStorageClassificationMappingsClientDeleteResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - storageClassificationName - Storage classification name. +// - storageClassificationMappingName - Storage classification mapping name. +// - options - ReplicationStorageClassificationMappingsClientBeginDeleteOptions contains the optional parameters for the ReplicationStorageClassificationMappingsClient.BeginDelete +// method. +func (client *ReplicationStorageClassificationMappingsClient) BeginDelete(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, storageClassificationName string, storageClassificationMappingName string, options *ReplicationStorageClassificationMappingsClientBeginDeleteOptions) (*runtime.Poller[ReplicationStorageClassificationMappingsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, fabricName, storageClassificationName, storageClassificationMappingName, options) + resp, err := client.deleteOperation(ctx, resourceName, resourceGroupName, fabricName, storageClassificationName, storageClassificationMappingName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationStorageClassificationMappingsClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationStorageClassificationMappingsClientDeleteResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationStorageClassificationMappingsClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationStorageClassificationMappingsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - The operation to delete a storage classification mapping. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationStorageClassificationMappingsClient) deleteOperation(ctx context.Context, fabricName string, storageClassificationName string, storageClassificationMappingName string, options *ReplicationStorageClassificationMappingsClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, fabricName, storageClassificationName, storageClassificationMappingName, options) +func (client *ReplicationStorageClassificationMappingsClient) deleteOperation(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, storageClassificationName string, storageClassificationMappingName string, options *ReplicationStorageClassificationMappingsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceName, resourceGroupName, fabricName, storageClassificationName, storageClassificationMappingName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -177,16 +168,16 @@ func (client *ReplicationStorageClassificationMappingsClient) deleteOperation(ct } // deleteCreateRequest creates the Delete request. -func (client *ReplicationStorageClassificationMappingsClient) deleteCreateRequest(ctx context.Context, fabricName string, storageClassificationName string, storageClassificationMappingName string, options *ReplicationStorageClassificationMappingsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ReplicationStorageClassificationMappingsClient) deleteCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, storageClassificationName string, storageClassificationMappingName string, options *ReplicationStorageClassificationMappingsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -203,7 +194,7 @@ func (client *ReplicationStorageClassificationMappingsClient) deleteCreateReques return nil, errors.New("parameter storageClassificationMappingName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{storageClassificationMappingName}", url.PathEscape(storageClassificationMappingName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -215,18 +206,21 @@ func (client *ReplicationStorageClassificationMappingsClient) deleteCreateReques // Get - Gets the details of the specified storage classification mapping. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// storageClassificationName - Storage classification name. -// storageClassificationMappingName - Storage classification mapping name. -// options - ReplicationStorageClassificationMappingsClientGetOptions contains the optional parameters for the ReplicationStorageClassificationMappingsClient.Get -// method. -func (client *ReplicationStorageClassificationMappingsClient) Get(ctx context.Context, fabricName string, storageClassificationName string, storageClassificationMappingName string, options *ReplicationStorageClassificationMappingsClientGetOptions) (ReplicationStorageClassificationMappingsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, fabricName, storageClassificationName, storageClassificationMappingName, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - storageClassificationName - Storage classification name. +// - storageClassificationMappingName - Storage classification mapping name. +// - options - ReplicationStorageClassificationMappingsClientGetOptions contains the optional parameters for the ReplicationStorageClassificationMappingsClient.Get +// method. +func (client *ReplicationStorageClassificationMappingsClient) Get(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, storageClassificationName string, storageClassificationMappingName string, options *ReplicationStorageClassificationMappingsClientGetOptions) (ReplicationStorageClassificationMappingsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, fabricName, storageClassificationName, storageClassificationMappingName, options) if err != nil { return ReplicationStorageClassificationMappingsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationStorageClassificationMappingsClientGetResponse{}, err } @@ -237,16 +231,16 @@ func (client *ReplicationStorageClassificationMappingsClient) Get(ctx context.Co } // getCreateRequest creates the Get request. -func (client *ReplicationStorageClassificationMappingsClient) getCreateRequest(ctx context.Context, fabricName string, storageClassificationName string, storageClassificationMappingName string, options *ReplicationStorageClassificationMappingsClientGetOptions) (*policy.Request, error) { +func (client *ReplicationStorageClassificationMappingsClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, storageClassificationName string, storageClassificationMappingName string, options *ReplicationStorageClassificationMappingsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -263,7 +257,7 @@ func (client *ReplicationStorageClassificationMappingsClient) getCreateRequest(c return nil, errors.New("parameter storageClassificationMappingName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{storageClassificationMappingName}", url.PathEscape(storageClassificationMappingName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -284,10 +278,13 @@ func (client *ReplicationStorageClassificationMappingsClient) getHandleResponse( } // NewListPager - Lists the storage classification mappings in the vault. +// // Generated from API version 2022-10-01 -// options - ReplicationStorageClassificationMappingsClientListOptions contains the optional parameters for the ReplicationStorageClassificationMappingsClient.List -// method. -func (client *ReplicationStorageClassificationMappingsClient) NewListPager(options *ReplicationStorageClassificationMappingsClientListOptions) *runtime.Pager[ReplicationStorageClassificationMappingsClientListResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - ReplicationStorageClassificationMappingsClientListOptions contains the optional parameters for the ReplicationStorageClassificationMappingsClient.NewListPager +// method. +func (client *ReplicationStorageClassificationMappingsClient) NewListPager(resourceName string, resourceGroupName string, options *ReplicationStorageClassificationMappingsClientListOptions) *runtime.Pager[ReplicationStorageClassificationMappingsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationStorageClassificationMappingsClientListResponse]{ More: func(page ReplicationStorageClassificationMappingsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -296,14 +293,14 @@ func (client *ReplicationStorageClassificationMappingsClient) NewListPager(optio var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, resourceName, resourceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationStorageClassificationMappingsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationStorageClassificationMappingsClientListResponse{}, err } @@ -316,21 +313,21 @@ func (client *ReplicationStorageClassificationMappingsClient) NewListPager(optio } // listCreateRequest creates the List request. -func (client *ReplicationStorageClassificationMappingsClient) listCreateRequest(ctx context.Context, options *ReplicationStorageClassificationMappingsClientListOptions) (*policy.Request, error) { +func (client *ReplicationStorageClassificationMappingsClient) listCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationStorageClassificationMappingsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassificationMappings" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -351,12 +348,15 @@ func (client *ReplicationStorageClassificationMappingsClient) listHandleResponse } // NewListByReplicationStorageClassificationsPager - Lists the storage classification mappings for the fabric. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// storageClassificationName - Storage classification name. -// options - ReplicationStorageClassificationMappingsClientListByReplicationStorageClassificationsOptions contains the optional -// parameters for the ReplicationStorageClassificationMappingsClient.ListByReplicationStorageClassifications method. -func (client *ReplicationStorageClassificationMappingsClient) NewListByReplicationStorageClassificationsPager(fabricName string, storageClassificationName string, options *ReplicationStorageClassificationMappingsClientListByReplicationStorageClassificationsOptions) *runtime.Pager[ReplicationStorageClassificationMappingsClientListByReplicationStorageClassificationsResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - storageClassificationName - Storage classification name. +// - options - ReplicationStorageClassificationMappingsClientListByReplicationStorageClassificationsOptions contains the optional +// parameters for the ReplicationStorageClassificationMappingsClient.NewListByReplicationStorageClassificationsPager method. +func (client *ReplicationStorageClassificationMappingsClient) NewListByReplicationStorageClassificationsPager(resourceName string, resourceGroupName string, fabricName string, storageClassificationName string, options *ReplicationStorageClassificationMappingsClientListByReplicationStorageClassificationsOptions) *runtime.Pager[ReplicationStorageClassificationMappingsClientListByReplicationStorageClassificationsResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationStorageClassificationMappingsClientListByReplicationStorageClassificationsResponse]{ More: func(page ReplicationStorageClassificationMappingsClientListByReplicationStorageClassificationsResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -365,14 +365,14 @@ func (client *ReplicationStorageClassificationMappingsClient) NewListByReplicati var req *policy.Request var err error if page == nil { - req, err = client.listByReplicationStorageClassificationsCreateRequest(ctx, fabricName, storageClassificationName, options) + req, err = client.listByReplicationStorageClassificationsCreateRequest(ctx, resourceName, resourceGroupName, fabricName, storageClassificationName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationStorageClassificationMappingsClientListByReplicationStorageClassificationsResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationStorageClassificationMappingsClientListByReplicationStorageClassificationsResponse{}, err } @@ -385,16 +385,16 @@ func (client *ReplicationStorageClassificationMappingsClient) NewListByReplicati } // listByReplicationStorageClassificationsCreateRequest creates the ListByReplicationStorageClassifications request. -func (client *ReplicationStorageClassificationMappingsClient) listByReplicationStorageClassificationsCreateRequest(ctx context.Context, fabricName string, storageClassificationName string, options *ReplicationStorageClassificationMappingsClientListByReplicationStorageClassificationsOptions) (*policy.Request, error) { +func (client *ReplicationStorageClassificationMappingsClient) listByReplicationStorageClassificationsCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, storageClassificationName string, options *ReplicationStorageClassificationMappingsClientListByReplicationStorageClassificationsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -407,7 +407,7 @@ func (client *ReplicationStorageClassificationMappingsClient) listByReplicationS return nil, errors.New("parameter storageClassificationName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{storageClassificationName}", url.PathEscape(storageClassificationName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationstorageclassificationmappings_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationstorageclassificationmappings_client_example_test.go index 5069dfb59a50..3decce91ca46 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationstorageclassificationmappings_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationstorageclassificationmappings_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -14,64 +15,85 @@ import ( "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/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassificationMappings_ListByReplicationStorageClassifications.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassificationMappings_ListByReplicationStorageClassifications.json func ExampleReplicationStorageClassificationMappingsClient_NewListByReplicationStorageClassificationsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationStorageClassificationMappingsClient("vault1", "resourceGroupPS1", "9112a37f-0f3e-46ec-9c00-060c6edca071", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByReplicationStorageClassificationsPager("2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0", "8891569e-aaef-4a46-a4a0-78c14f2d7b09", nil) + pager := clientFactory.NewReplicationStorageClassificationMappingsClient().NewListByReplicationStorageClassificationsPager("vault1", "resourceGroupPS1", "2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0", "8891569e-aaef-4a46-a4a0-78c14f2d7b09", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.StorageClassificationMappingCollection = armrecoveryservicessiterecovery.StorageClassificationMappingCollection{ + // Value: []*armrecoveryservicessiterecovery.StorageClassificationMapping{ + // { + // Name: to.Ptr("testStorageMapping"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationStorageClassifications/replicationStorageClassificationMappings"), + // ID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0/replicationStorageClassifications/8891569e-aaef-4a46-a4a0-78c14f2d7b09/replicationStorageClassificationMappings/testStorageMapping"), + // Properties: &armrecoveryservicessiterecovery.StorageClassificationMappingProperties{ + // TargetStorageClassificationID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0/replicationStorageClassifications/8891569e-aaef-4a46-a4a0-78c14f2d7b09"), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassificationMappings_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassificationMappings_Get.json func ExampleReplicationStorageClassificationMappingsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationStorageClassificationMappingsClient("vault1", "resourceGroupPS1", "9112a37f-0f3e-46ec-9c00-060c6edca071", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0", "8891569e-aaef-4a46-a4a0-78c14f2d7b09", "testStorageMapping", nil) + res, err := clientFactory.NewReplicationStorageClassificationMappingsClient().Get(ctx, "vault1", "resourceGroupPS1", "2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0", "8891569e-aaef-4a46-a4a0-78c14f2d7b09", "testStorageMapping", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.StorageClassificationMapping = armrecoveryservicessiterecovery.StorageClassificationMapping{ + // Name: to.Ptr("testStorageMapping"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationStorageClassifications/replicationStorageClassificationMappings"), + // ID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0/replicationStorageClassifications/8891569e-aaef-4a46-a4a0-78c14f2d7b09/replicationStorageClassificationMappings/testStorageMapping"), + // Properties: &armrecoveryservicessiterecovery.StorageClassificationMappingProperties{ + // TargetStorageClassificationID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0/replicationStorageClassifications/8891569e-aaef-4a46-a4a0-78c14f2d7b09"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassificationMappings_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassificationMappings_Create.json func ExampleReplicationStorageClassificationMappingsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationStorageClassificationMappingsClient("vault1", "resourceGroupPS1", "9112a37f-0f3e-46ec-9c00-060c6edca071", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreate(ctx, "2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0", "8891569e-aaef-4a46-a4a0-78c14f2d7b09", "testStorageMapping", armrecoveryservicessiterecovery.StorageClassificationMappingInput{ + poller, err := clientFactory.NewReplicationStorageClassificationMappingsClient().BeginCreate(ctx, "vault1", "resourceGroupPS1", "2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0", "8891569e-aaef-4a46-a4a0-78c14f2d7b09", "testStorageMapping", armrecoveryservicessiterecovery.StorageClassificationMappingInput{ Properties: &armrecoveryservicessiterecovery.StorageMappingInputProperties{ TargetStorageClassificationID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0/replicationStorageClassifications/8891569e-aaef-4a46-a4a0-78c14f2d7b09"), }, @@ -83,22 +105,31 @@ func ExampleReplicationStorageClassificationMappingsClient_BeginCreate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.StorageClassificationMapping = armrecoveryservicessiterecovery.StorageClassificationMapping{ + // Name: to.Ptr("testStorageMapping"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationStorageClassifications/replicationStorageClassificationMappings"), + // ID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0/replicationStorageClassifications/8891569e-aaef-4a46-a4a0-78c14f2d7b09/replicationStorageClassificationMappings/testStorageMapping"), + // Properties: &armrecoveryservicessiterecovery.StorageClassificationMappingProperties{ + // TargetStorageClassificationID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0/replicationStorageClassifications/8891569e-aaef-4a46-a4a0-78c14f2d7b09"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassificationMappings_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassificationMappings_Delete.json func ExampleReplicationStorageClassificationMappingsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationStorageClassificationMappingsClient("vault1", "resourceGroupPS1", "9112a37f-0f3e-46ec-9c00-060c6edca071", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, "2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0", "8891569e-aaef-4a46-a4a0-78c14f2d7b09", "testStorageMapping", nil) + poller, err := clientFactory.NewReplicationStorageClassificationMappingsClient().BeginDelete(ctx, "vault1", "resourceGroupPS1", "2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0", "8891569e-aaef-4a46-a4a0-78c14f2d7b09", "testStorageMapping", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -108,26 +139,38 @@ func ExampleReplicationStorageClassificationMappingsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassificationMappings_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassificationMappings_List.json func ExampleReplicationStorageClassificationMappingsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationStorageClassificationMappingsClient("vault1", "resourceGroupPS1", "9112a37f-0f3e-46ec-9c00-060c6edca071", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(nil) + pager := clientFactory.NewReplicationStorageClassificationMappingsClient().NewListPager("vault1", "resourceGroupPS1", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.StorageClassificationMappingCollection = armrecoveryservicessiterecovery.StorageClassificationMappingCollection{ + // Value: []*armrecoveryservicessiterecovery.StorageClassificationMapping{ + // { + // Name: to.Ptr("testStorageMapping"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationStorageClassifications/replicationStorageClassificationMappings"), + // ID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0/replicationStorageClassifications/8891569e-aaef-4a46-a4a0-78c14f2d7b09/replicationStorageClassificationMappings/testStorageMapping"), + // Properties: &armrecoveryservicessiterecovery.StorageClassificationMappingProperties{ + // TargetStorageClassificationID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0/replicationStorageClassifications/8891569e-aaef-4a46-a4a0-78c14f2d7b09"), + // }, + // }}, + // } } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationstorageclassifications_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationstorageclassifications_client.go index c7d722073d79..d07d27fd4b85 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationstorageclassifications_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationstorageclassifications_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,54 +24,42 @@ import ( // ReplicationStorageClassificationsClient contains the methods for the ReplicationStorageClassifications group. // Don't use this type directly, use NewReplicationStorageClassificationsClient() instead. type ReplicationStorageClassificationsClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationStorageClassificationsClient creates a new instance of ReplicationStorageClassificationsClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationStorageClassificationsClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationStorageClassificationsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationStorageClassificationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationStorageClassificationsClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationStorageClassificationsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationStorageClassificationsClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // Get - Gets the details of the specified storage classification. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// storageClassificationName - Storage classification name. -// options - ReplicationStorageClassificationsClientGetOptions contains the optional parameters for the ReplicationStorageClassificationsClient.Get -// method. -func (client *ReplicationStorageClassificationsClient) Get(ctx context.Context, fabricName string, storageClassificationName string, options *ReplicationStorageClassificationsClientGetOptions) (ReplicationStorageClassificationsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, fabricName, storageClassificationName, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - storageClassificationName - Storage classification name. +// - options - ReplicationStorageClassificationsClientGetOptions contains the optional parameters for the ReplicationStorageClassificationsClient.Get +// method. +func (client *ReplicationStorageClassificationsClient) Get(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, storageClassificationName string, options *ReplicationStorageClassificationsClientGetOptions) (ReplicationStorageClassificationsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, fabricName, storageClassificationName, options) if err != nil { return ReplicationStorageClassificationsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationStorageClassificationsClientGetResponse{}, err } @@ -84,16 +70,16 @@ func (client *ReplicationStorageClassificationsClient) Get(ctx context.Context, } // getCreateRequest creates the Get request. -func (client *ReplicationStorageClassificationsClient) getCreateRequest(ctx context.Context, fabricName string, storageClassificationName string, options *ReplicationStorageClassificationsClientGetOptions) (*policy.Request, error) { +func (client *ReplicationStorageClassificationsClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, storageClassificationName string, options *ReplicationStorageClassificationsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -106,7 +92,7 @@ func (client *ReplicationStorageClassificationsClient) getCreateRequest(ctx cont return nil, errors.New("parameter storageClassificationName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{storageClassificationName}", url.PathEscape(storageClassificationName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -127,10 +113,13 @@ func (client *ReplicationStorageClassificationsClient) getHandleResponse(resp *h } // NewListPager - Lists the storage classifications in the vault. +// // Generated from API version 2022-10-01 -// options - ReplicationStorageClassificationsClientListOptions contains the optional parameters for the ReplicationStorageClassificationsClient.List -// method. -func (client *ReplicationStorageClassificationsClient) NewListPager(options *ReplicationStorageClassificationsClientListOptions) *runtime.Pager[ReplicationStorageClassificationsClientListResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - ReplicationStorageClassificationsClientListOptions contains the optional parameters for the ReplicationStorageClassificationsClient.NewListPager +// method. +func (client *ReplicationStorageClassificationsClient) NewListPager(resourceName string, resourceGroupName string, options *ReplicationStorageClassificationsClientListOptions) *runtime.Pager[ReplicationStorageClassificationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationStorageClassificationsClientListResponse]{ More: func(page ReplicationStorageClassificationsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -139,14 +128,14 @@ func (client *ReplicationStorageClassificationsClient) NewListPager(options *Rep var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, resourceName, resourceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationStorageClassificationsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationStorageClassificationsClientListResponse{}, err } @@ -159,21 +148,21 @@ func (client *ReplicationStorageClassificationsClient) NewListPager(options *Rep } // listCreateRequest creates the List request. -func (client *ReplicationStorageClassificationsClient) listCreateRequest(ctx context.Context, options *ReplicationStorageClassificationsClientListOptions) (*policy.Request, error) { +func (client *ReplicationStorageClassificationsClient) listCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationStorageClassificationsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassifications" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -194,11 +183,14 @@ func (client *ReplicationStorageClassificationsClient) listHandleResponse(resp * } // NewListByReplicationFabricsPager - Lists the storage classifications available in the specified fabric. +// // Generated from API version 2022-10-01 -// fabricName - Site name of interest. -// options - ReplicationStorageClassificationsClientListByReplicationFabricsOptions contains the optional parameters for the -// ReplicationStorageClassificationsClient.ListByReplicationFabrics method. -func (client *ReplicationStorageClassificationsClient) NewListByReplicationFabricsPager(fabricName string, options *ReplicationStorageClassificationsClientListByReplicationFabricsOptions) *runtime.Pager[ReplicationStorageClassificationsClientListByReplicationFabricsResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Site name of interest. +// - options - ReplicationStorageClassificationsClientListByReplicationFabricsOptions contains the optional parameters for the +// ReplicationStorageClassificationsClient.NewListByReplicationFabricsPager method. +func (client *ReplicationStorageClassificationsClient) NewListByReplicationFabricsPager(resourceName string, resourceGroupName string, fabricName string, options *ReplicationStorageClassificationsClientListByReplicationFabricsOptions) *runtime.Pager[ReplicationStorageClassificationsClientListByReplicationFabricsResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationStorageClassificationsClientListByReplicationFabricsResponse]{ More: func(page ReplicationStorageClassificationsClientListByReplicationFabricsResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -207,14 +199,14 @@ func (client *ReplicationStorageClassificationsClient) NewListByReplicationFabri var req *policy.Request var err error if page == nil { - req, err = client.listByReplicationFabricsCreateRequest(ctx, fabricName, options) + req, err = client.listByReplicationFabricsCreateRequest(ctx, resourceName, resourceGroupName, fabricName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationStorageClassificationsClientListByReplicationFabricsResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationStorageClassificationsClientListByReplicationFabricsResponse{}, err } @@ -227,16 +219,16 @@ func (client *ReplicationStorageClassificationsClient) NewListByReplicationFabri } // listByReplicationFabricsCreateRequest creates the ListByReplicationFabrics request. -func (client *ReplicationStorageClassificationsClient) listByReplicationFabricsCreateRequest(ctx context.Context, fabricName string, options *ReplicationStorageClassificationsClientListByReplicationFabricsOptions) (*policy.Request, error) { +func (client *ReplicationStorageClassificationsClient) listByReplicationFabricsCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, options *ReplicationStorageClassificationsClientListByReplicationFabricsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -245,7 +237,7 @@ func (client *ReplicationStorageClassificationsClient) listByReplicationFabricsC return nil, errors.New("parameter fabricName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationstorageclassifications_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationstorageclassifications_client_example_test.go index f857013e0df6..748d409b0a00 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationstorageclassifications_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationstorageclassifications_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -13,72 +14,105 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassifications_ListByReplicationFabrics.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassifications_ListByReplicationFabrics.json func ExampleReplicationStorageClassificationsClient_NewListByReplicationFabricsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationStorageClassificationsClient("vault1", "resourceGroupPS1", "9112a37f-0f3e-46ec-9c00-060c6edca071", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByReplicationFabricsPager("2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0", nil) + pager := clientFactory.NewReplicationStorageClassificationsClient().NewListByReplicationFabricsPager("vault1", "resourceGroupPS1", "2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.StorageClassificationCollection = armrecoveryservicessiterecovery.StorageClassificationCollection{ + // Value: []*armrecoveryservicessiterecovery.StorageClassification{ + // { + // Name: to.Ptr("8891569e-aaef-4a46-a4a0-78c14f2d7b09"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationStorageClassifications"), + // ID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0/replicationStorageClassifications/8891569e-aaef-4a46-a4a0-78c14f2d7b09"), + // Properties: &armrecoveryservicessiterecovery.StorageClassificationProperties{ + // FriendlyName: to.Ptr("testStorageClassification"), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassifications_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassifications_Get.json func ExampleReplicationStorageClassificationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationStorageClassificationsClient("vault1", "resourceGroupPS1", "9112a37f-0f3e-46ec-9c00-060c6edca071", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0", "8891569e-aaef-4a46-a4a0-78c14f2d7b09", nil) + res, err := clientFactory.NewReplicationStorageClassificationsClient().Get(ctx, "vault1", "resourceGroupPS1", "2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0", "8891569e-aaef-4a46-a4a0-78c14f2d7b09", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.StorageClassification = armrecoveryservicessiterecovery.StorageClassification{ + // Name: to.Ptr("8891569e-aaef-4a46-a4a0-78c14f2d7b09"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationStorageClassifications"), + // ID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0/replicationStorageClassifications/8891569e-aaef-4a46-a4a0-78c14f2d7b09"), + // Properties: &armrecoveryservicessiterecovery.StorageClassificationProperties{ + // FriendlyName: to.Ptr("testStorageClassification"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassifications_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassifications_List.json func ExampleReplicationStorageClassificationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationStorageClassificationsClient("vault1", "resourceGroupPS1", "9112a37f-0f3e-46ec-9c00-060c6edca071", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(nil) + pager := clientFactory.NewReplicationStorageClassificationsClient().NewListPager("vault1", "resourceGroupPS1", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.StorageClassificationCollection = armrecoveryservicessiterecovery.StorageClassificationCollection{ + // Value: []*armrecoveryservicessiterecovery.StorageClassification{ + // { + // Name: to.Ptr("8891569e-aaef-4a46-a4a0-78c14f2d7b09"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationStorageClassifications"), + // ID: to.Ptr("/Subscriptions/9112a37f-0f3e-46ec-9c00-060c6edca071/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationFabrics/2a48e3770ac08aa2be8bfbd94fcfb1cbf2dcc487b78fb9d3bd778304441b06a0/replicationStorageClassifications/8891569e-aaef-4a46-a4a0-78c14f2d7b09"), + // Properties: &armrecoveryservicessiterecovery.StorageClassificationProperties{ + // FriendlyName: to.Ptr("testStorageClassification"), + // }, + // }}, + // } } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvaulthealth_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvaulthealth_client.go index 97fc7079dc75..d1c6f84004b8 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvaulthealth_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvaulthealth_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,52 +24,40 @@ import ( // ReplicationVaultHealthClient contains the methods for the ReplicationVaultHealth group. // Don't use this type directly, use NewReplicationVaultHealthClient() instead. type ReplicationVaultHealthClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationVaultHealthClient creates a new instance of ReplicationVaultHealthClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationVaultHealthClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationVaultHealthClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationVaultHealthClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationVaultHealthClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationVaultHealthClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationVaultHealthClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // Get - Gets the health details of the vault. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// options - ReplicationVaultHealthClientGetOptions contains the optional parameters for the ReplicationVaultHealthClient.Get -// method. -func (client *ReplicationVaultHealthClient) Get(ctx context.Context, options *ReplicationVaultHealthClientGetOptions) (ReplicationVaultHealthClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - ReplicationVaultHealthClientGetOptions contains the optional parameters for the ReplicationVaultHealthClient.Get +// method. +func (client *ReplicationVaultHealthClient) Get(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationVaultHealthClientGetOptions) (ReplicationVaultHealthClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, options) if err != nil { return ReplicationVaultHealthClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationVaultHealthClientGetResponse{}, err } @@ -82,21 +68,21 @@ func (client *ReplicationVaultHealthClient) Get(ctx context.Context, options *Re } // getCreateRequest creates the Get request. -func (client *ReplicationVaultHealthClient) getCreateRequest(ctx context.Context, options *ReplicationVaultHealthClientGetOptions) (*policy.Request, error) { +func (client *ReplicationVaultHealthClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationVaultHealthClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -118,30 +104,34 @@ func (client *ReplicationVaultHealthClient) getHandleResponse(resp *http.Respons // BeginRefresh - Refreshes health summary of the vault. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// options - ReplicationVaultHealthClientBeginRefreshOptions contains the optional parameters for the ReplicationVaultHealthClient.BeginRefresh -// method. -func (client *ReplicationVaultHealthClient) BeginRefresh(ctx context.Context, options *ReplicationVaultHealthClientBeginRefreshOptions) (*runtime.Poller[ReplicationVaultHealthClientRefreshResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - ReplicationVaultHealthClientBeginRefreshOptions contains the optional parameters for the ReplicationVaultHealthClient.BeginRefresh +// method. +func (client *ReplicationVaultHealthClient) BeginRefresh(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationVaultHealthClientBeginRefreshOptions) (*runtime.Poller[ReplicationVaultHealthClientRefreshResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.refresh(ctx, options) + resp, err := client.refresh(ctx, resourceName, resourceGroupName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationVaultHealthClientRefreshResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationVaultHealthClientRefreshResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationVaultHealthClientRefreshResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationVaultHealthClientRefreshResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Refresh - Refreshes health summary of the vault. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationVaultHealthClient) refresh(ctx context.Context, options *ReplicationVaultHealthClientBeginRefreshOptions) (*http.Response, error) { - req, err := client.refreshCreateRequest(ctx, options) +func (client *ReplicationVaultHealthClient) refresh(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationVaultHealthClientBeginRefreshOptions) (*http.Response, error) { + req, err := client.refreshCreateRequest(ctx, resourceName, resourceGroupName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -152,21 +142,21 @@ func (client *ReplicationVaultHealthClient) refresh(ctx context.Context, options } // refreshCreateRequest creates the Refresh request. -func (client *ReplicationVaultHealthClient) refreshCreateRequest(ctx context.Context, options *ReplicationVaultHealthClientBeginRefreshOptions) (*policy.Request, error) { +func (client *ReplicationVaultHealthClient) refreshCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationVaultHealthClientBeginRefreshOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth/default/refresh" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvaulthealth_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvaulthealth_client_example_test.go index 53759cacf056..0bf43ecd516f 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvaulthealth_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvaulthealth_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -13,40 +14,70 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationVaultHealth_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationVaultHealth_Get.json func ExampleReplicationVaultHealthClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationVaultHealthClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, nil) + res, err := clientFactory.NewReplicationVaultHealthClient().Get(ctx, "vault1", "resourceGroupPS1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.VaultHealthDetails = armrecoveryservicessiterecovery.VaultHealthDetails{ + // Name: to.Ptr("Default"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationVaultHealth"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationVaultHealth/Default"), + // Properties: &armrecoveryservicessiterecovery.VaultHealthProperties{ + // FabricsHealth: &armrecoveryservicessiterecovery.ResourceHealthSummary{ + // Issues: []*armrecoveryservicessiterecovery.HealthErrorSummary{ + // }, + // ResourceCount: to.Ptr[int32](1), + // }, + // ProtectedItemsHealth: &armrecoveryservicessiterecovery.ResourceHealthSummary{ + // Issues: []*armrecoveryservicessiterecovery.HealthErrorSummary{ + // { + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("c183865e-6077-46f2-a3b1-deb0f4f4650a"), + // to.Ptr("c183865e-6077-46f2-a3b1-ceb0a4c3751e")}, + // AffectedResourceSubtype: to.Ptr(""), + // AffectedResourceType: to.Ptr("replicationProtectedItems"), + // Category: to.Ptr(armrecoveryservicessiterecovery.HealthErrorCategoryReplication), + // Severity: to.Ptr(armrecoveryservicessiterecovery.SeverityError), + // SummaryCode: to.Ptr("10008"), + // SummaryMessage: to.Ptr("RPO Throttled"), + // }}, + // ResourceCount: to.Ptr[int32](6), + // }, + // VaultErrors: []*armrecoveryservicessiterecovery.HealthError{ + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationVaultHealth_Refresh.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationVaultHealth_Refresh.json func ExampleReplicationVaultHealthClient_BeginRefresh() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationVaultHealthClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginRefresh(ctx, nil) + poller, err := clientFactory.NewReplicationVaultHealthClient().BeginRefresh(ctx, "vault1", "resourceGroupPS1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -54,6 +85,26 @@ func ExampleReplicationVaultHealthClient_BeginRefresh() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.VaultHealthDetails = armrecoveryservicessiterecovery.VaultHealthDetails{ + // Name: to.Ptr("Default"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationVaultHealth"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationVaultHealth/Default"), + // Properties: &armrecoveryservicessiterecovery.VaultHealthProperties{ + // FabricsHealth: &armrecoveryservicessiterecovery.ResourceHealthSummary{ + // Issues: []*armrecoveryservicessiterecovery.HealthErrorSummary{ + // }, + // ResourceCount: to.Ptr[int32](1), + // }, + // ProtectedItemsHealth: &armrecoveryservicessiterecovery.ResourceHealthSummary{ + // Issues: []*armrecoveryservicessiterecovery.HealthErrorSummary{ + // }, + // ResourceCount: to.Ptr[int32](2), + // }, + // VaultErrors: []*armrecoveryservicessiterecovery.HealthError{ + // }, + // }, + // } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvaultsetting_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvaultsetting_client.go index b51b3b041567..511f7992bcb0 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvaultsetting_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvaultsetting_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,69 +24,58 @@ import ( // ReplicationVaultSettingClient contains the methods for the ReplicationVaultSetting group. // Don't use this type directly, use NewReplicationVaultSettingClient() instead. type ReplicationVaultSettingClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationVaultSettingClient creates a new instance of ReplicationVaultSettingClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationVaultSettingClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationVaultSettingClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationVaultSettingClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationVaultSettingClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationVaultSettingClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationVaultSettingClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // BeginCreate - The operation to configure vault setting. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// vaultSettingName - Vault setting name. -// input - Vault setting creation input. -// options - ReplicationVaultSettingClientBeginCreateOptions contains the optional parameters for the ReplicationVaultSettingClient.BeginCreate -// method. -func (client *ReplicationVaultSettingClient) BeginCreate(ctx context.Context, vaultSettingName string, input VaultSettingCreationInput, options *ReplicationVaultSettingClientBeginCreateOptions) (*runtime.Poller[ReplicationVaultSettingClientCreateResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - vaultSettingName - Vault setting name. +// - input - Vault setting creation input. +// - options - ReplicationVaultSettingClientBeginCreateOptions contains the optional parameters for the ReplicationVaultSettingClient.BeginCreate +// method. +func (client *ReplicationVaultSettingClient) BeginCreate(ctx context.Context, resourceName string, resourceGroupName string, vaultSettingName string, input VaultSettingCreationInput, options *ReplicationVaultSettingClientBeginCreateOptions) (*runtime.Poller[ReplicationVaultSettingClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, vaultSettingName, input, options) + resp, err := client.create(ctx, resourceName, resourceGroupName, vaultSettingName, input, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationVaultSettingClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationVaultSettingClientCreateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationVaultSettingClientCreateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationVaultSettingClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Create - The operation to configure vault setting. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationVaultSettingClient) create(ctx context.Context, vaultSettingName string, input VaultSettingCreationInput, options *ReplicationVaultSettingClientBeginCreateOptions) (*http.Response, error) { - req, err := client.createCreateRequest(ctx, vaultSettingName, input, options) +func (client *ReplicationVaultSettingClient) create(ctx context.Context, resourceName string, resourceGroupName string, vaultSettingName string, input VaultSettingCreationInput, options *ReplicationVaultSettingClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceName, resourceGroupName, vaultSettingName, input, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -99,16 +86,16 @@ func (client *ReplicationVaultSettingClient) create(ctx context.Context, vaultSe } // createCreateRequest creates the Create request. -func (client *ReplicationVaultSettingClient) createCreateRequest(ctx context.Context, vaultSettingName string, input VaultSettingCreationInput, options *ReplicationVaultSettingClientBeginCreateOptions) (*policy.Request, error) { +func (client *ReplicationVaultSettingClient) createCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, vaultSettingName string, input VaultSettingCreationInput, options *ReplicationVaultSettingClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -117,7 +104,7 @@ func (client *ReplicationVaultSettingClient) createCreateRequest(ctx context.Con return nil, errors.New("parameter vaultSettingName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{vaultSettingName}", url.PathEscape(vaultSettingName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -130,16 +117,19 @@ func (client *ReplicationVaultSettingClient) createCreateRequest(ctx context.Con // Get - Gets the vault setting. This includes the Migration Hub connection settings. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// vaultSettingName - Vault setting name. -// options - ReplicationVaultSettingClientGetOptions contains the optional parameters for the ReplicationVaultSettingClient.Get -// method. -func (client *ReplicationVaultSettingClient) Get(ctx context.Context, vaultSettingName string, options *ReplicationVaultSettingClientGetOptions) (ReplicationVaultSettingClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, vaultSettingName, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - vaultSettingName - Vault setting name. +// - options - ReplicationVaultSettingClientGetOptions contains the optional parameters for the ReplicationVaultSettingClient.Get +// method. +func (client *ReplicationVaultSettingClient) Get(ctx context.Context, resourceName string, resourceGroupName string, vaultSettingName string, options *ReplicationVaultSettingClientGetOptions) (ReplicationVaultSettingClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, vaultSettingName, options) if err != nil { return ReplicationVaultSettingClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationVaultSettingClientGetResponse{}, err } @@ -150,16 +140,16 @@ func (client *ReplicationVaultSettingClient) Get(ctx context.Context, vaultSetti } // getCreateRequest creates the Get request. -func (client *ReplicationVaultSettingClient) getCreateRequest(ctx context.Context, vaultSettingName string, options *ReplicationVaultSettingClientGetOptions) (*policy.Request, error) { +func (client *ReplicationVaultSettingClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, vaultSettingName string, options *ReplicationVaultSettingClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -168,7 +158,7 @@ func (client *ReplicationVaultSettingClient) getCreateRequest(ctx context.Contex return nil, errors.New("parameter vaultSettingName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{vaultSettingName}", url.PathEscape(vaultSettingName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -189,10 +179,13 @@ func (client *ReplicationVaultSettingClient) getHandleResponse(resp *http.Respon } // NewListPager - Gets the list of vault setting. This includes the Migration Hub connection settings. +// // Generated from API version 2022-10-01 -// options - ReplicationVaultSettingClientListOptions contains the optional parameters for the ReplicationVaultSettingClient.List -// method. -func (client *ReplicationVaultSettingClient) NewListPager(options *ReplicationVaultSettingClientListOptions) *runtime.Pager[ReplicationVaultSettingClientListResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - ReplicationVaultSettingClientListOptions contains the optional parameters for the ReplicationVaultSettingClient.NewListPager +// method. +func (client *ReplicationVaultSettingClient) NewListPager(resourceName string, resourceGroupName string, options *ReplicationVaultSettingClientListOptions) *runtime.Pager[ReplicationVaultSettingClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationVaultSettingClientListResponse]{ More: func(page ReplicationVaultSettingClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -201,14 +194,14 @@ func (client *ReplicationVaultSettingClient) NewListPager(options *ReplicationVa var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, resourceName, resourceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationVaultSettingClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationVaultSettingClientListResponse{}, err } @@ -221,21 +214,21 @@ func (client *ReplicationVaultSettingClient) NewListPager(options *ReplicationVa } // listCreateRequest creates the List request. -func (client *ReplicationVaultSettingClient) listCreateRequest(ctx context.Context, options *ReplicationVaultSettingClientListOptions) (*policy.Request, error) { +func (client *ReplicationVaultSettingClient) listCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationVaultSettingClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvaultsetting_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvaultsetting_client_example_test.go index 24795df0029f..de54affc5b0e 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvaultsetting_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvaultsetting_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -14,64 +15,85 @@ import ( "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/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationVaultSetting_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationVaultSetting_List.json func ExampleReplicationVaultSettingClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationVaultSettingClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(nil) + pager := clientFactory.NewReplicationVaultSettingClient().NewListPager("vault1", "resourceGroupPS1", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.VaultSettingCollection = armrecoveryservicessiterecovery.VaultSettingCollection{ + // Value: []*armrecoveryservicessiterecovery.VaultSetting{ + // { + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationVaultSettings"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationVaultSettings/default"), + // Properties: &armrecoveryservicessiterecovery.VaultSettingProperties{ + // MigrationSolutionID: to.Ptr("/subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.Migrate/MigrateProjects/resourceGroupPS1-MigrateProject/Solutions/Servers-Migration-ServerMigration"), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationVaultSetting_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationVaultSetting_Get.json func ExampleReplicationVaultSettingClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationVaultSettingClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "default", nil) + res, err := clientFactory.NewReplicationVaultSettingClient().Get(ctx, "vault1", "resourceGroupPS1", "default", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.VaultSetting = armrecoveryservicessiterecovery.VaultSetting{ + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationVaultSettings"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationVaultSettings/default"), + // Properties: &armrecoveryservicessiterecovery.VaultSettingProperties{ + // MigrationSolutionID: to.Ptr("/subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.Migrate/MigrateProjects/resourceGroupPS1-MigrateProject/Solutions/Servers-Migration-ServerMigration"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationVaultSetting_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationVaultSetting_Create.json func ExampleReplicationVaultSettingClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationVaultSettingClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreate(ctx, "default", armrecoveryservicessiterecovery.VaultSettingCreationInput{ + poller, err := clientFactory.NewReplicationVaultSettingClient().BeginCreate(ctx, "vault1", "resourceGroupPS1", "default", armrecoveryservicessiterecovery.VaultSettingCreationInput{ Properties: &armrecoveryservicessiterecovery.VaultSettingCreationInputProperties{ MigrationSolutionID: to.Ptr("/subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.Migrate/MigrateProjects/resourceGroupPS1-MigrateProject/Solutions/Servers-Migration-ServerMigration"), }, @@ -83,6 +105,15 @@ func ExampleReplicationVaultSettingClient_BeginCreate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.VaultSetting = armrecoveryservicessiterecovery.VaultSetting{ + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationVaultSettings"), + // ID: to.Ptr("/Subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.RecoveryServices/vaults/vault1/replicationVaultSettings/default"), + // Properties: &armrecoveryservicessiterecovery.VaultSettingProperties{ + // MigrationSolutionID: to.Ptr("/subscriptions/c183865e-6077-46f2-a3b1-deb0f4f4650a/resourceGroups/resourceGroupPS1/providers/Microsoft.Migrate/MigrateProjects/resourceGroupPS1-MigrateProject/Solutions/Servers-Migration-ServerMigration"), + // }, + // } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvcenters_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvcenters_client.go index 94638fa2580b..2e1bdda1e93b 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvcenters_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvcenters_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,70 +24,59 @@ import ( // ReplicationvCentersClient contains the methods for the ReplicationvCenters group. // Don't use this type directly, use NewReplicationvCentersClient() instead. type ReplicationvCentersClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewReplicationvCentersClient creates a new instance of ReplicationvCentersClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewReplicationvCentersClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationvCentersClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicationvCentersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationvCentersClient, error) { + cl, err := arm.NewClient(moduleName+".ReplicationvCentersClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ReplicationvCentersClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // BeginCreate - The operation to create a vCenter object.. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// vcenterName - vcenter name. -// addVCenterRequest - The input to the add vCenter operation. -// options - ReplicationvCentersClientBeginCreateOptions contains the optional parameters for the ReplicationvCentersClient.BeginCreate -// method. -func (client *ReplicationvCentersClient) BeginCreate(ctx context.Context, fabricName string, vcenterName string, addVCenterRequest AddVCenterRequest, options *ReplicationvCentersClientBeginCreateOptions) (*runtime.Poller[ReplicationvCentersClientCreateResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - vcenterName - vcenter name. +// - addVCenterRequest - The input to the add vCenter operation. +// - options - ReplicationvCentersClientBeginCreateOptions contains the optional parameters for the ReplicationvCentersClient.BeginCreate +// method. +func (client *ReplicationvCentersClient) BeginCreate(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, vcenterName string, addVCenterRequest AddVCenterRequest, options *ReplicationvCentersClientBeginCreateOptions) (*runtime.Poller[ReplicationvCentersClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, fabricName, vcenterName, addVCenterRequest, options) + resp, err := client.create(ctx, resourceName, resourceGroupName, fabricName, vcenterName, addVCenterRequest, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationvCentersClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationvCentersClientCreateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationvCentersClientCreateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationvCentersClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Create - The operation to create a vCenter object.. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationvCentersClient) create(ctx context.Context, fabricName string, vcenterName string, addVCenterRequest AddVCenterRequest, options *ReplicationvCentersClientBeginCreateOptions) (*http.Response, error) { - req, err := client.createCreateRequest(ctx, fabricName, vcenterName, addVCenterRequest, options) +func (client *ReplicationvCentersClient) create(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, vcenterName string, addVCenterRequest AddVCenterRequest, options *ReplicationvCentersClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceName, resourceGroupName, fabricName, vcenterName, addVCenterRequest, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -100,16 +87,16 @@ func (client *ReplicationvCentersClient) create(ctx context.Context, fabricName } // createCreateRequest creates the Create request. -func (client *ReplicationvCentersClient) createCreateRequest(ctx context.Context, fabricName string, vcenterName string, addVCenterRequest AddVCenterRequest, options *ReplicationvCentersClientBeginCreateOptions) (*policy.Request, error) { +func (client *ReplicationvCentersClient) createCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, vcenterName string, addVCenterRequest AddVCenterRequest, options *ReplicationvCentersClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -122,7 +109,7 @@ func (client *ReplicationvCentersClient) createCreateRequest(ctx context.Context return nil, errors.New("parameter vcenterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{vcenterName}", url.PathEscape(vcenterName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -135,32 +122,36 @@ func (client *ReplicationvCentersClient) createCreateRequest(ctx context.Context // BeginDelete - The operation to remove(unregister) a registered vCenter server from the vault. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// vcenterName - vcenter name. -// options - ReplicationvCentersClientBeginDeleteOptions contains the optional parameters for the ReplicationvCentersClient.BeginDelete -// method. -func (client *ReplicationvCentersClient) BeginDelete(ctx context.Context, fabricName string, vcenterName string, options *ReplicationvCentersClientBeginDeleteOptions) (*runtime.Poller[ReplicationvCentersClientDeleteResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - vcenterName - vcenter name. +// - options - ReplicationvCentersClientBeginDeleteOptions contains the optional parameters for the ReplicationvCentersClient.BeginDelete +// method. +func (client *ReplicationvCentersClient) BeginDelete(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, vcenterName string, options *ReplicationvCentersClientBeginDeleteOptions) (*runtime.Poller[ReplicationvCentersClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, fabricName, vcenterName, options) + resp, err := client.deleteOperation(ctx, resourceName, resourceGroupName, fabricName, vcenterName, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationvCentersClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationvCentersClientDeleteResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationvCentersClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationvCentersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - The operation to remove(unregister) a registered vCenter server from the vault. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationvCentersClient) deleteOperation(ctx context.Context, fabricName string, vcenterName string, options *ReplicationvCentersClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, fabricName, vcenterName, options) +func (client *ReplicationvCentersClient) deleteOperation(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, vcenterName string, options *ReplicationvCentersClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceName, resourceGroupName, fabricName, vcenterName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -171,16 +162,16 @@ func (client *ReplicationvCentersClient) deleteOperation(ctx context.Context, fa } // deleteCreateRequest creates the Delete request. -func (client *ReplicationvCentersClient) deleteCreateRequest(ctx context.Context, fabricName string, vcenterName string, options *ReplicationvCentersClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ReplicationvCentersClient) deleteCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, vcenterName string, options *ReplicationvCentersClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -193,7 +184,7 @@ func (client *ReplicationvCentersClient) deleteCreateRequest(ctx context.Context return nil, errors.New("parameter vcenterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{vcenterName}", url.PathEscape(vcenterName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -205,16 +196,19 @@ func (client *ReplicationvCentersClient) deleteCreateRequest(ctx context.Context // Get - Gets the details of a registered vCenter server(Add vCenter server). // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// vcenterName - vcenter name. -// options - ReplicationvCentersClientGetOptions contains the optional parameters for the ReplicationvCentersClient.Get method. -func (client *ReplicationvCentersClient) Get(ctx context.Context, fabricName string, vcenterName string, options *ReplicationvCentersClientGetOptions) (ReplicationvCentersClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, fabricName, vcenterName, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - vcenterName - vcenter name. +// - options - ReplicationvCentersClientGetOptions contains the optional parameters for the ReplicationvCentersClient.Get method. +func (client *ReplicationvCentersClient) Get(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, vcenterName string, options *ReplicationvCentersClientGetOptions) (ReplicationvCentersClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, fabricName, vcenterName, options) if err != nil { return ReplicationvCentersClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationvCentersClientGetResponse{}, err } @@ -225,16 +219,16 @@ func (client *ReplicationvCentersClient) Get(ctx context.Context, fabricName str } // getCreateRequest creates the Get request. -func (client *ReplicationvCentersClient) getCreateRequest(ctx context.Context, fabricName string, vcenterName string, options *ReplicationvCentersClientGetOptions) (*policy.Request, error) { +func (client *ReplicationvCentersClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, vcenterName string, options *ReplicationvCentersClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -247,7 +241,7 @@ func (client *ReplicationvCentersClient) getCreateRequest(ctx context.Context, f return nil, errors.New("parameter vcenterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{vcenterName}", url.PathEscape(vcenterName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -268,10 +262,13 @@ func (client *ReplicationvCentersClient) getHandleResponse(resp *http.Response) } // NewListPager - Lists the vCenter servers registered in the vault. +// // Generated from API version 2022-10-01 -// options - ReplicationvCentersClientListOptions contains the optional parameters for the ReplicationvCentersClient.List -// method. -func (client *ReplicationvCentersClient) NewListPager(options *ReplicationvCentersClientListOptions) *runtime.Pager[ReplicationvCentersClientListResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - ReplicationvCentersClientListOptions contains the optional parameters for the ReplicationvCentersClient.NewListPager +// method. +func (client *ReplicationvCentersClient) NewListPager(resourceName string, resourceGroupName string, options *ReplicationvCentersClientListOptions) *runtime.Pager[ReplicationvCentersClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationvCentersClientListResponse]{ More: func(page ReplicationvCentersClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -280,14 +277,14 @@ func (client *ReplicationvCentersClient) NewListPager(options *ReplicationvCente var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, resourceName, resourceGroupName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationvCentersClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationvCentersClientListResponse{}, err } @@ -300,21 +297,21 @@ func (client *ReplicationvCentersClient) NewListPager(options *ReplicationvCente } // listCreateRequest creates the List request. -func (client *ReplicationvCentersClient) listCreateRequest(ctx context.Context, options *ReplicationvCentersClientListOptions) (*policy.Request, error) { +func (client *ReplicationvCentersClient) listCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, options *ReplicationvCentersClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationvCenters" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -335,11 +332,14 @@ func (client *ReplicationvCentersClient) listHandleResponse(resp *http.Response) } // NewListByReplicationFabricsPager - Lists the vCenter servers registered in a fabric. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// options - ReplicationvCentersClientListByReplicationFabricsOptions contains the optional parameters for the ReplicationvCentersClient.ListByReplicationFabrics -// method. -func (client *ReplicationvCentersClient) NewListByReplicationFabricsPager(fabricName string, options *ReplicationvCentersClientListByReplicationFabricsOptions) *runtime.Pager[ReplicationvCentersClientListByReplicationFabricsResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - options - ReplicationvCentersClientListByReplicationFabricsOptions contains the optional parameters for the ReplicationvCentersClient.NewListByReplicationFabricsPager +// method. +func (client *ReplicationvCentersClient) NewListByReplicationFabricsPager(resourceName string, resourceGroupName string, fabricName string, options *ReplicationvCentersClientListByReplicationFabricsOptions) *runtime.Pager[ReplicationvCentersClientListByReplicationFabricsResponse] { return runtime.NewPager(runtime.PagingHandler[ReplicationvCentersClientListByReplicationFabricsResponse]{ More: func(page ReplicationvCentersClientListByReplicationFabricsResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -348,14 +348,14 @@ func (client *ReplicationvCentersClient) NewListByReplicationFabricsPager(fabric var req *policy.Request var err error if page == nil { - req, err = client.listByReplicationFabricsCreateRequest(ctx, fabricName, options) + req, err = client.listByReplicationFabricsCreateRequest(ctx, resourceName, resourceGroupName, fabricName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return ReplicationvCentersClientListByReplicationFabricsResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationvCentersClientListByReplicationFabricsResponse{}, err } @@ -368,16 +368,16 @@ func (client *ReplicationvCentersClient) NewListByReplicationFabricsPager(fabric } // listByReplicationFabricsCreateRequest creates the ListByReplicationFabrics request. -func (client *ReplicationvCentersClient) listByReplicationFabricsCreateRequest(ctx context.Context, fabricName string, options *ReplicationvCentersClientListByReplicationFabricsOptions) (*policy.Request, error) { +func (client *ReplicationvCentersClient) listByReplicationFabricsCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, options *ReplicationvCentersClientListByReplicationFabricsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -386,7 +386,7 @@ func (client *ReplicationvCentersClient) listByReplicationFabricsCreateRequest(c return nil, errors.New("parameter fabricName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -408,33 +408,37 @@ func (client *ReplicationvCentersClient) listByReplicationFabricsHandleResponse( // BeginUpdate - The operation to update a registered vCenter. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// vcenterName - vcenter name. -// updateVCenterRequest - The input to the update vCenter operation. -// options - ReplicationvCentersClientBeginUpdateOptions contains the optional parameters for the ReplicationvCentersClient.BeginUpdate -// method. -func (client *ReplicationvCentersClient) BeginUpdate(ctx context.Context, fabricName string, vcenterName string, updateVCenterRequest UpdateVCenterRequest, options *ReplicationvCentersClientBeginUpdateOptions) (*runtime.Poller[ReplicationvCentersClientUpdateResponse], error) { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - vcenterName - vcenter name. +// - updateVCenterRequest - The input to the update vCenter operation. +// - options - ReplicationvCentersClientBeginUpdateOptions contains the optional parameters for the ReplicationvCentersClient.BeginUpdate +// method. +func (client *ReplicationvCentersClient) BeginUpdate(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, vcenterName string, updateVCenterRequest UpdateVCenterRequest, options *ReplicationvCentersClientBeginUpdateOptions) (*runtime.Poller[ReplicationvCentersClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, fabricName, vcenterName, updateVCenterRequest, options) + resp, err := client.update(ctx, resourceName, resourceGroupName, fabricName, vcenterName, updateVCenterRequest, options) if err != nil { return nil, err } - return runtime.NewPoller[ReplicationvCentersClientUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller[ReplicationvCentersClientUpdateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ReplicationvCentersClientUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ReplicationvCentersClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Update - The operation to update a registered vCenter. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -func (client *ReplicationvCentersClient) update(ctx context.Context, fabricName string, vcenterName string, updateVCenterRequest UpdateVCenterRequest, options *ReplicationvCentersClientBeginUpdateOptions) (*http.Response, error) { - req, err := client.updateCreateRequest(ctx, fabricName, vcenterName, updateVCenterRequest, options) +func (client *ReplicationvCentersClient) update(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, vcenterName string, updateVCenterRequest UpdateVCenterRequest, options *ReplicationvCentersClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceName, resourceGroupName, fabricName, vcenterName, updateVCenterRequest, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -445,16 +449,16 @@ func (client *ReplicationvCentersClient) update(ctx context.Context, fabricName } // updateCreateRequest creates the Update request. -func (client *ReplicationvCentersClient) updateCreateRequest(ctx context.Context, fabricName string, vcenterName string, updateVCenterRequest UpdateVCenterRequest, options *ReplicationvCentersClientBeginUpdateOptions) (*policy.Request, error) { +func (client *ReplicationvCentersClient) updateCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, vcenterName string, updateVCenterRequest UpdateVCenterRequest, options *ReplicationvCentersClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -467,7 +471,7 @@ func (client *ReplicationvCentersClient) updateCreateRequest(ctx context.Context return nil, errors.New("parameter vcenterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{vcenterName}", url.PathEscape(vcenterName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvcenters_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvcenters_client_example_test.go index ce487e4fa424..c4da99c4e0fb 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvcenters_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/replicationvcenters_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -14,64 +15,99 @@ import ( "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/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_ListByReplicationFabrics.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_ListByReplicationFabrics.json func ExampleReplicationvCentersClient_NewListByReplicationFabricsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationvCentersClient("MadhaviVault", "MadhaviVRG", "7c943c1b-5122-4097-90c8-861411bdd574", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByReplicationFabricsPager("MadhaviFabric", nil) + pager := clientFactory.NewReplicationvCentersClient().NewListByReplicationFabricsPager("MadhaviVault", "MadhaviVRG", "MadhaviFabric", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.VCenterCollection = armrecoveryservicessiterecovery.VCenterCollection{ + // Value: []*armrecoveryservicessiterecovery.VCenter{ + // { + // Name: to.Ptr("esx-78"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationvCenters"), + // ID: to.Ptr("/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/MadhaviVRG/providers/Microsoft.RecoveryServices/vaults/MadhaviVault/replicationFabrics/239f778f368e34f78216d81f030725cdf2033174b47879b9f2eeede06fdd9c4d/replicationvCenters/esx-78"), + // Properties: &armrecoveryservicessiterecovery.VCenterProperties{ + // DiscoveryStatus: to.Ptr("Pending"), + // FabricArmResourceName: to.Ptr("239f778f368e34f78216d81f030725cdf2033174b47879b9f2eeede06fdd9c4d"), + // FriendlyName: to.Ptr("esx-78"), + // InternalID: to.Ptr("inmtest78"), + // IPAddress: to.Ptr("inmtest78"), + // Port: to.Ptr("443"), + // ProcessServerID: to.Ptr("5A720CAB-39CB-F445-BD1662B0B33164B5"), + // RunAsAccountID: to.Ptr("2"), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_Get.json func ExampleReplicationvCentersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationvCentersClient("MadhaviVault", "MadhaviVRG", "7c943c1b-5122-4097-90c8-861411bdd574", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "MadhaviFabric", "esx-78", nil) + res, err := clientFactory.NewReplicationvCentersClient().Get(ctx, "MadhaviVault", "MadhaviVRG", "MadhaviFabric", "esx-78", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.VCenter = armrecoveryservicessiterecovery.VCenter{ + // Name: to.Ptr("esx-78"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationvCenters"), + // ID: to.Ptr("/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/MadhaviVRG/providers/Microsoft.RecoveryServices/vaults/MadhaviVault/replicationFabrics/239f778f368e34f78216d81f030725cdf2033174b47879b9f2eeede06fdd9c4d/replicationvCenters/esx-78"), + // Properties: &armrecoveryservicessiterecovery.VCenterProperties{ + // DiscoveryStatus: to.Ptr("Pending"), + // FabricArmResourceName: to.Ptr("239f778f368e34f78216d81f030725cdf2033174b47879b9f2eeede06fdd9c4d"), + // FriendlyName: to.Ptr("esx-78"), + // InternalID: to.Ptr("inmtest78"), + // IPAddress: to.Ptr("inmtest78"), + // Port: to.Ptr("443"), + // ProcessServerID: to.Ptr("5A720CAB-39CB-F445-BD1662B0B33164B5"), + // RunAsAccountID: to.Ptr("2"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_Create.json func ExampleReplicationvCentersClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationvCentersClient("MadhaviVault", "MadhaviVRG", "7c943c1b-5122-4097-90c8-861411bdd574", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreate(ctx, "MadhaviFabric", "esx-78", armrecoveryservicessiterecovery.AddVCenterRequest{ + poller, err := clientFactory.NewReplicationvCentersClient().BeginCreate(ctx, "MadhaviVault", "MadhaviVRG", "MadhaviFabric", "esx-78", armrecoveryservicessiterecovery.AddVCenterRequest{ Properties: &armrecoveryservicessiterecovery.AddVCenterRequestProperties{ FriendlyName: to.Ptr("esx-78"), IPAddress: to.Ptr("inmtest78"), @@ -87,22 +123,38 @@ func ExampleReplicationvCentersClient_BeginCreate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.VCenter = armrecoveryservicessiterecovery.VCenter{ + // Name: to.Ptr("esx-78"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationvCenters"), + // ID: to.Ptr("/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/MadhaviVRG/providers/Microsoft.RecoveryServices/vaults/MadhaviVault/replicationFabrics/239f778f368e34f78216d81f030725cdf2033174b47879b9f2eeede06fdd9c4d/replicationvCenters/esx-78"), + // Properties: &armrecoveryservicessiterecovery.VCenterProperties{ + // DiscoveryStatus: to.Ptr("Pending"), + // FabricArmResourceName: to.Ptr("239f778f368e34f78216d81f030725cdf2033174b47879b9f2eeede06fdd9c4d"), + // FriendlyName: to.Ptr("esx-78"), + // InternalID: to.Ptr("inmtest78"), + // IPAddress: to.Ptr("inmtest78"), + // Port: to.Ptr("443"), + // ProcessServerID: to.Ptr("5A720CAB-39CB-F445-BD1662B0B33164B5"), + // RunAsAccountID: to.Ptr("2"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_Delete.json func ExampleReplicationvCentersClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationvCentersClient("MadhaviVault", "MadhaviVRG", "7c943c1b-5122-4097-90c8-861411bdd574", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, "MadhaviFabric", "esx-78", nil) + poller, err := clientFactory.NewReplicationvCentersClient().BeginDelete(ctx, "MadhaviVault", "MadhaviVRG", "MadhaviFabric", "esx-78", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -112,18 +164,18 @@ func ExampleReplicationvCentersClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_Update.json func ExampleReplicationvCentersClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationvCentersClient("MadhaviVault", "MadhaviVRG", "7c943c1b-5122-4097-90c8-861411bdd574", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, "MadhaviFabric", "esx-78", armrecoveryservicessiterecovery.UpdateVCenterRequest{ + poller, err := clientFactory.NewReplicationvCentersClient().BeginUpdate(ctx, "MadhaviVault", "MadhaviVRG", "MadhaviFabric", "esx-78", armrecoveryservicessiterecovery.UpdateVCenterRequest{ Properties: &armrecoveryservicessiterecovery.UpdateVCenterRequestProperties{ IPAddress: to.Ptr("10.150.109.25"), }, @@ -135,30 +187,65 @@ func ExampleReplicationvCentersClient_BeginUpdate() { if err != nil { log.Fatalf("failed to pull the result: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.VCenter = armrecoveryservicessiterecovery.VCenter{ + // Name: to.Ptr("esx-78"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationvCenters"), + // ID: to.Ptr("/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/MadhaviVRG/providers/Microsoft.RecoveryServices/vaults/MadhaviVault/replicationFabrics/239f778f368e34f78216d81f030725cdf2033174b47879b9f2eeede06fdd9c4d/replicationvCenters/esx-78"), + // Properties: &armrecoveryservicessiterecovery.VCenterProperties{ + // DiscoveryStatus: to.Ptr("Pending"), + // FabricArmResourceName: to.Ptr("239f778f368e34f78216d81f030725cdf2033174b47879b9f2eeede06fdd9c4d"), + // FriendlyName: to.Ptr("esx-78"), + // InternalID: to.Ptr("inmtest78"), + // IPAddress: to.Ptr("10.150.109.25"), + // Port: to.Ptr("443"), + // ProcessServerID: to.Ptr("5A720CAB-39CB-F445-BD1662B0B33164B5"), + // RunAsAccountID: to.Ptr("2"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_List.json func ExampleReplicationvCentersClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewReplicationvCentersClient("MadhaviVault", "MadhaviVRG", "7c943c1b-5122-4097-90c8-861411bdd574", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(nil) + pager := clientFactory.NewReplicationvCentersClient().NewListPager("MadhaviVault", "MadhaviVRG", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.VCenterCollection = armrecoveryservicessiterecovery.VCenterCollection{ + // Value: []*armrecoveryservicessiterecovery.VCenter{ + // { + // Name: to.Ptr("esx-78"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationvCenters"), + // ID: to.Ptr("/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/MadhaviVRG/providers/Microsoft.RecoveryServices/vaults/MadhaviVault/replicationFabrics/239f778f368e34f78216d81f030725cdf2033174b47879b9f2eeede06fdd9c4d/replicationvCenters/esx-78"), + // Properties: &armrecoveryservicessiterecovery.VCenterProperties{ + // DiscoveryStatus: to.Ptr("Pending"), + // FabricArmResourceName: to.Ptr("239f778f368e34f78216d81f030725cdf2033174b47879b9f2eeede06fdd9c4d"), + // FriendlyName: to.Ptr("esx-78"), + // InternalID: to.Ptr("inmtest78"), + // IPAddress: to.Ptr("inmtest78"), + // Port: to.Ptr("443"), + // ProcessServerID: to.Ptr("5A720CAB-39CB-F445-BD1662B0B33164B5"), + // RunAsAccountID: to.Ptr("2"), + // }, + // }}, + // } } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/response_types.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/response_types.go index 7098d365481f..0552a0ba2392 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/response_types.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/response_types.go @@ -14,12 +14,12 @@ type MigrationRecoveryPointsClientGetResponse struct { MigrationRecoveryPoint } -// MigrationRecoveryPointsClientListByReplicationMigrationItemsResponse contains the response from method MigrationRecoveryPointsClient.ListByReplicationMigrationItems. +// MigrationRecoveryPointsClientListByReplicationMigrationItemsResponse contains the response from method MigrationRecoveryPointsClient.NewListByReplicationMigrationItemsPager. type MigrationRecoveryPointsClientListByReplicationMigrationItemsResponse struct { MigrationRecoveryPointCollection } -// OperationsClientListResponse contains the response from method OperationsClient.List. +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { OperationsDiscoveryCollection } @@ -29,7 +29,7 @@ type RecoveryPointsClientGetResponse struct { RecoveryPoint } -// RecoveryPointsClientListByReplicationProtectedItemsResponse contains the response from method RecoveryPointsClient.ListByReplicationProtectedItems. +// RecoveryPointsClientListByReplicationProtectedItemsResponse contains the response from method RecoveryPointsClient.NewListByReplicationProtectedItemsPager. type RecoveryPointsClientListByReplicationProtectedItemsResponse struct { RecoveryPointCollection } @@ -44,12 +44,12 @@ type ReplicationAlertSettingsClientGetResponse struct { Alert } -// ReplicationAlertSettingsClientListResponse contains the response from method ReplicationAlertSettingsClient.List. +// ReplicationAlertSettingsClientListResponse contains the response from method ReplicationAlertSettingsClient.NewListPager. type ReplicationAlertSettingsClientListResponse struct { AlertCollection } -// ReplicationAppliancesClientListResponse contains the response from method ReplicationAppliancesClient.List. +// ReplicationAppliancesClientListResponse contains the response from method ReplicationAppliancesClient.NewListPager. type ReplicationAppliancesClientListResponse struct { ApplianceCollection } @@ -69,22 +69,22 @@ type ReplicationEventsClientGetResponse struct { Event } -// ReplicationEventsClientListResponse contains the response from method ReplicationEventsClient.List. +// ReplicationEventsClientListResponse contains the response from method ReplicationEventsClient.NewListPager. type ReplicationEventsClientListResponse struct { EventCollection } -// ReplicationFabricsClientCheckConsistencyResponse contains the response from method ReplicationFabricsClient.CheckConsistency. +// ReplicationFabricsClientCheckConsistencyResponse contains the response from method ReplicationFabricsClient.BeginCheckConsistency. type ReplicationFabricsClientCheckConsistencyResponse struct { Fabric } -// ReplicationFabricsClientCreateResponse contains the response from method ReplicationFabricsClient.Create. +// ReplicationFabricsClientCreateResponse contains the response from method ReplicationFabricsClient.BeginCreate. type ReplicationFabricsClientCreateResponse struct { Fabric } -// ReplicationFabricsClientDeleteResponse contains the response from method ReplicationFabricsClient.Delete. +// ReplicationFabricsClientDeleteResponse contains the response from method ReplicationFabricsClient.BeginDelete. type ReplicationFabricsClientDeleteResponse struct { // placeholder for future response values } @@ -94,37 +94,37 @@ type ReplicationFabricsClientGetResponse struct { Fabric } -// ReplicationFabricsClientListResponse contains the response from method ReplicationFabricsClient.List. +// ReplicationFabricsClientListResponse contains the response from method ReplicationFabricsClient.NewListPager. type ReplicationFabricsClientListResponse struct { FabricCollection } -// ReplicationFabricsClientMigrateToAADResponse contains the response from method ReplicationFabricsClient.MigrateToAAD. +// ReplicationFabricsClientMigrateToAADResponse contains the response from method ReplicationFabricsClient.BeginMigrateToAAD. type ReplicationFabricsClientMigrateToAADResponse struct { // placeholder for future response values } -// ReplicationFabricsClientPurgeResponse contains the response from method ReplicationFabricsClient.Purge. +// ReplicationFabricsClientPurgeResponse contains the response from method ReplicationFabricsClient.BeginPurge. type ReplicationFabricsClientPurgeResponse struct { // placeholder for future response values } -// ReplicationFabricsClientReassociateGatewayResponse contains the response from method ReplicationFabricsClient.ReassociateGateway. +// ReplicationFabricsClientReassociateGatewayResponse contains the response from method ReplicationFabricsClient.BeginReassociateGateway. type ReplicationFabricsClientReassociateGatewayResponse struct { Fabric } -// ReplicationFabricsClientRenewCertificateResponse contains the response from method ReplicationFabricsClient.RenewCertificate. +// ReplicationFabricsClientRenewCertificateResponse contains the response from method ReplicationFabricsClient.BeginRenewCertificate. type ReplicationFabricsClientRenewCertificateResponse struct { Fabric } -// ReplicationJobsClientCancelResponse contains the response from method ReplicationJobsClient.Cancel. +// ReplicationJobsClientCancelResponse contains the response from method ReplicationJobsClient.BeginCancel. type ReplicationJobsClientCancelResponse struct { Job } -// ReplicationJobsClientExportResponse contains the response from method ReplicationJobsClient.Export. +// ReplicationJobsClientExportResponse contains the response from method ReplicationJobsClient.BeginExport. type ReplicationJobsClientExportResponse struct { Job } @@ -134,17 +134,17 @@ type ReplicationJobsClientGetResponse struct { Job } -// ReplicationJobsClientListResponse contains the response from method ReplicationJobsClient.List. +// ReplicationJobsClientListResponse contains the response from method ReplicationJobsClient.NewListPager. type ReplicationJobsClientListResponse struct { JobCollection } -// ReplicationJobsClientRestartResponse contains the response from method ReplicationJobsClient.Restart. +// ReplicationJobsClientRestartResponse contains the response from method ReplicationJobsClient.BeginRestart. type ReplicationJobsClientRestartResponse struct { Job } -// ReplicationJobsClientResumeResponse contains the response from method ReplicationJobsClient.Resume. +// ReplicationJobsClientResumeResponse contains the response from method ReplicationJobsClient.BeginResume. type ReplicationJobsClientResumeResponse struct { Job } @@ -154,17 +154,17 @@ type ReplicationLogicalNetworksClientGetResponse struct { LogicalNetwork } -// ReplicationLogicalNetworksClientListByReplicationFabricsResponse contains the response from method ReplicationLogicalNetworksClient.ListByReplicationFabrics. +// ReplicationLogicalNetworksClientListByReplicationFabricsResponse contains the response from method ReplicationLogicalNetworksClient.NewListByReplicationFabricsPager. type ReplicationLogicalNetworksClientListByReplicationFabricsResponse struct { LogicalNetworkCollection } -// ReplicationMigrationItemsClientCreateResponse contains the response from method ReplicationMigrationItemsClient.Create. +// ReplicationMigrationItemsClientCreateResponse contains the response from method ReplicationMigrationItemsClient.BeginCreate. type ReplicationMigrationItemsClientCreateResponse struct { MigrationItem } -// ReplicationMigrationItemsClientDeleteResponse contains the response from method ReplicationMigrationItemsClient.Delete. +// ReplicationMigrationItemsClientDeleteResponse contains the response from method ReplicationMigrationItemsClient.BeginDelete. type ReplicationMigrationItemsClientDeleteResponse struct { // placeholder for future response values } @@ -174,57 +174,57 @@ type ReplicationMigrationItemsClientGetResponse struct { MigrationItem } -// ReplicationMigrationItemsClientListByReplicationProtectionContainersResponse contains the response from method ReplicationMigrationItemsClient.ListByReplicationProtectionContainers. +// ReplicationMigrationItemsClientListByReplicationProtectionContainersResponse contains the response from method ReplicationMigrationItemsClient.NewListByReplicationProtectionContainersPager. type ReplicationMigrationItemsClientListByReplicationProtectionContainersResponse struct { MigrationItemCollection } -// ReplicationMigrationItemsClientListResponse contains the response from method ReplicationMigrationItemsClient.List. +// ReplicationMigrationItemsClientListResponse contains the response from method ReplicationMigrationItemsClient.NewListPager. type ReplicationMigrationItemsClientListResponse struct { MigrationItemCollection } -// ReplicationMigrationItemsClientMigrateResponse contains the response from method ReplicationMigrationItemsClient.Migrate. +// ReplicationMigrationItemsClientMigrateResponse contains the response from method ReplicationMigrationItemsClient.BeginMigrate. type ReplicationMigrationItemsClientMigrateResponse struct { MigrationItem } -// ReplicationMigrationItemsClientPauseReplicationResponse contains the response from method ReplicationMigrationItemsClient.PauseReplication. +// ReplicationMigrationItemsClientPauseReplicationResponse contains the response from method ReplicationMigrationItemsClient.BeginPauseReplication. type ReplicationMigrationItemsClientPauseReplicationResponse struct { MigrationItem } -// ReplicationMigrationItemsClientResumeReplicationResponse contains the response from method ReplicationMigrationItemsClient.ResumeReplication. +// ReplicationMigrationItemsClientResumeReplicationResponse contains the response from method ReplicationMigrationItemsClient.BeginResumeReplication. type ReplicationMigrationItemsClientResumeReplicationResponse struct { MigrationItem } -// ReplicationMigrationItemsClientResyncResponse contains the response from method ReplicationMigrationItemsClient.Resync. +// ReplicationMigrationItemsClientResyncResponse contains the response from method ReplicationMigrationItemsClient.BeginResync. type ReplicationMigrationItemsClientResyncResponse struct { MigrationItem } -// ReplicationMigrationItemsClientTestMigrateCleanupResponse contains the response from method ReplicationMigrationItemsClient.TestMigrateCleanup. +// ReplicationMigrationItemsClientTestMigrateCleanupResponse contains the response from method ReplicationMigrationItemsClient.BeginTestMigrateCleanup. type ReplicationMigrationItemsClientTestMigrateCleanupResponse struct { MigrationItem } -// ReplicationMigrationItemsClientTestMigrateResponse contains the response from method ReplicationMigrationItemsClient.TestMigrate. +// ReplicationMigrationItemsClientTestMigrateResponse contains the response from method ReplicationMigrationItemsClient.BeginTestMigrate. type ReplicationMigrationItemsClientTestMigrateResponse struct { MigrationItem } -// ReplicationMigrationItemsClientUpdateResponse contains the response from method ReplicationMigrationItemsClient.Update. +// ReplicationMigrationItemsClientUpdateResponse contains the response from method ReplicationMigrationItemsClient.BeginUpdate. type ReplicationMigrationItemsClientUpdateResponse struct { MigrationItem } -// ReplicationNetworkMappingsClientCreateResponse contains the response from method ReplicationNetworkMappingsClient.Create. +// ReplicationNetworkMappingsClientCreateResponse contains the response from method ReplicationNetworkMappingsClient.BeginCreate. type ReplicationNetworkMappingsClientCreateResponse struct { NetworkMapping } -// ReplicationNetworkMappingsClientDeleteResponse contains the response from method ReplicationNetworkMappingsClient.Delete. +// ReplicationNetworkMappingsClientDeleteResponse contains the response from method ReplicationNetworkMappingsClient.BeginDelete. type ReplicationNetworkMappingsClientDeleteResponse struct { // placeholder for future response values } @@ -234,17 +234,17 @@ type ReplicationNetworkMappingsClientGetResponse struct { NetworkMapping } -// ReplicationNetworkMappingsClientListByReplicationNetworksResponse contains the response from method ReplicationNetworkMappingsClient.ListByReplicationNetworks. +// ReplicationNetworkMappingsClientListByReplicationNetworksResponse contains the response from method ReplicationNetworkMappingsClient.NewListByReplicationNetworksPager. type ReplicationNetworkMappingsClientListByReplicationNetworksResponse struct { NetworkMappingCollection } -// ReplicationNetworkMappingsClientListResponse contains the response from method ReplicationNetworkMappingsClient.List. +// ReplicationNetworkMappingsClientListResponse contains the response from method ReplicationNetworkMappingsClient.NewListPager. type ReplicationNetworkMappingsClientListResponse struct { NetworkMappingCollection } -// ReplicationNetworkMappingsClientUpdateResponse contains the response from method ReplicationNetworkMappingsClient.Update. +// ReplicationNetworkMappingsClientUpdateResponse contains the response from method ReplicationNetworkMappingsClient.BeginUpdate. type ReplicationNetworkMappingsClientUpdateResponse struct { NetworkMapping } @@ -254,22 +254,22 @@ type ReplicationNetworksClientGetResponse struct { Network } -// ReplicationNetworksClientListByReplicationFabricsResponse contains the response from method ReplicationNetworksClient.ListByReplicationFabrics. +// ReplicationNetworksClientListByReplicationFabricsResponse contains the response from method ReplicationNetworksClient.NewListByReplicationFabricsPager. type ReplicationNetworksClientListByReplicationFabricsResponse struct { NetworkCollection } -// ReplicationNetworksClientListResponse contains the response from method ReplicationNetworksClient.List. +// ReplicationNetworksClientListResponse contains the response from method ReplicationNetworksClient.NewListPager. type ReplicationNetworksClientListResponse struct { NetworkCollection } -// ReplicationPoliciesClientCreateResponse contains the response from method ReplicationPoliciesClient.Create. +// ReplicationPoliciesClientCreateResponse contains the response from method ReplicationPoliciesClient.BeginCreate. type ReplicationPoliciesClientCreateResponse struct { Policy } -// ReplicationPoliciesClientDeleteResponse contains the response from method ReplicationPoliciesClient.Delete. +// ReplicationPoliciesClientDeleteResponse contains the response from method ReplicationPoliciesClient.BeginDelete. type ReplicationPoliciesClientDeleteResponse struct { // placeholder for future response values } @@ -279,12 +279,12 @@ type ReplicationPoliciesClientGetResponse struct { Policy } -// ReplicationPoliciesClientListResponse contains the response from method ReplicationPoliciesClient.List. +// ReplicationPoliciesClientListResponse contains the response from method ReplicationPoliciesClient.NewListPager. type ReplicationPoliciesClientListResponse struct { PolicyCollection } -// ReplicationPoliciesClientUpdateResponse contains the response from method ReplicationPoliciesClient.Update. +// ReplicationPoliciesClientUpdateResponse contains the response from method ReplicationPoliciesClient.BeginUpdate. type ReplicationPoliciesClientUpdateResponse struct { Policy } @@ -294,37 +294,37 @@ type ReplicationProtectableItemsClientGetResponse struct { ProtectableItem } -// ReplicationProtectableItemsClientListByReplicationProtectionContainersResponse contains the response from method ReplicationProtectableItemsClient.ListByReplicationProtectionContainers. +// ReplicationProtectableItemsClientListByReplicationProtectionContainersResponse contains the response from method ReplicationProtectableItemsClient.NewListByReplicationProtectionContainersPager. type ReplicationProtectableItemsClientListByReplicationProtectionContainersResponse struct { ProtectableItemCollection } -// ReplicationProtectedItemsClientAddDisksResponse contains the response from method ReplicationProtectedItemsClient.AddDisks. +// ReplicationProtectedItemsClientAddDisksResponse contains the response from method ReplicationProtectedItemsClient.BeginAddDisks. type ReplicationProtectedItemsClientAddDisksResponse struct { ReplicationProtectedItem } -// ReplicationProtectedItemsClientApplyRecoveryPointResponse contains the response from method ReplicationProtectedItemsClient.ApplyRecoveryPoint. +// ReplicationProtectedItemsClientApplyRecoveryPointResponse contains the response from method ReplicationProtectedItemsClient.BeginApplyRecoveryPoint. type ReplicationProtectedItemsClientApplyRecoveryPointResponse struct { ReplicationProtectedItem } -// ReplicationProtectedItemsClientCreateResponse contains the response from method ReplicationProtectedItemsClient.Create. +// ReplicationProtectedItemsClientCreateResponse contains the response from method ReplicationProtectedItemsClient.BeginCreate. type ReplicationProtectedItemsClientCreateResponse struct { ReplicationProtectedItem } -// ReplicationProtectedItemsClientDeleteResponse contains the response from method ReplicationProtectedItemsClient.Delete. +// ReplicationProtectedItemsClientDeleteResponse contains the response from method ReplicationProtectedItemsClient.BeginDelete. type ReplicationProtectedItemsClientDeleteResponse struct { // placeholder for future response values } -// ReplicationProtectedItemsClientFailoverCancelResponse contains the response from method ReplicationProtectedItemsClient.FailoverCancel. +// ReplicationProtectedItemsClientFailoverCancelResponse contains the response from method ReplicationProtectedItemsClient.BeginFailoverCancel. type ReplicationProtectedItemsClientFailoverCancelResponse struct { ReplicationProtectedItem } -// ReplicationProtectedItemsClientFailoverCommitResponse contains the response from method ReplicationProtectedItemsClient.FailoverCommit. +// ReplicationProtectedItemsClientFailoverCommitResponse contains the response from method ReplicationProtectedItemsClient.BeginFailoverCommit. type ReplicationProtectedItemsClientFailoverCommitResponse struct { ReplicationProtectedItem } @@ -334,87 +334,87 @@ type ReplicationProtectedItemsClientGetResponse struct { ReplicationProtectedItem } -// ReplicationProtectedItemsClientListByReplicationProtectionContainersResponse contains the response from method ReplicationProtectedItemsClient.ListByReplicationProtectionContainers. +// ReplicationProtectedItemsClientListByReplicationProtectionContainersResponse contains the response from method ReplicationProtectedItemsClient.NewListByReplicationProtectionContainersPager. type ReplicationProtectedItemsClientListByReplicationProtectionContainersResponse struct { ReplicationProtectedItemCollection } -// ReplicationProtectedItemsClientListResponse contains the response from method ReplicationProtectedItemsClient.List. +// ReplicationProtectedItemsClientListResponse contains the response from method ReplicationProtectedItemsClient.NewListPager. type ReplicationProtectedItemsClientListResponse struct { ReplicationProtectedItemCollection } -// ReplicationProtectedItemsClientPlannedFailoverResponse contains the response from method ReplicationProtectedItemsClient.PlannedFailover. +// ReplicationProtectedItemsClientPlannedFailoverResponse contains the response from method ReplicationProtectedItemsClient.BeginPlannedFailover. type ReplicationProtectedItemsClientPlannedFailoverResponse struct { ReplicationProtectedItem } -// ReplicationProtectedItemsClientPurgeResponse contains the response from method ReplicationProtectedItemsClient.Purge. +// ReplicationProtectedItemsClientPurgeResponse contains the response from method ReplicationProtectedItemsClient.BeginPurge. type ReplicationProtectedItemsClientPurgeResponse struct { // placeholder for future response values } -// ReplicationProtectedItemsClientRemoveDisksResponse contains the response from method ReplicationProtectedItemsClient.RemoveDisks. +// ReplicationProtectedItemsClientRemoveDisksResponse contains the response from method ReplicationProtectedItemsClient.BeginRemoveDisks. type ReplicationProtectedItemsClientRemoveDisksResponse struct { ReplicationProtectedItem } -// ReplicationProtectedItemsClientRepairReplicationResponse contains the response from method ReplicationProtectedItemsClient.RepairReplication. +// ReplicationProtectedItemsClientRepairReplicationResponse contains the response from method ReplicationProtectedItemsClient.BeginRepairReplication. type ReplicationProtectedItemsClientRepairReplicationResponse struct { ReplicationProtectedItem } -// ReplicationProtectedItemsClientReprotectResponse contains the response from method ReplicationProtectedItemsClient.Reprotect. +// ReplicationProtectedItemsClientReprotectResponse contains the response from method ReplicationProtectedItemsClient.BeginReprotect. type ReplicationProtectedItemsClientReprotectResponse struct { ReplicationProtectedItem } -// ReplicationProtectedItemsClientResolveHealthErrorsResponse contains the response from method ReplicationProtectedItemsClient.ResolveHealthErrors. +// ReplicationProtectedItemsClientResolveHealthErrorsResponse contains the response from method ReplicationProtectedItemsClient.BeginResolveHealthErrors. type ReplicationProtectedItemsClientResolveHealthErrorsResponse struct { ReplicationProtectedItem } -// ReplicationProtectedItemsClientSwitchProviderResponse contains the response from method ReplicationProtectedItemsClient.SwitchProvider. +// ReplicationProtectedItemsClientSwitchProviderResponse contains the response from method ReplicationProtectedItemsClient.BeginSwitchProvider. type ReplicationProtectedItemsClientSwitchProviderResponse struct { ReplicationProtectedItem } -// ReplicationProtectedItemsClientTestFailoverCleanupResponse contains the response from method ReplicationProtectedItemsClient.TestFailoverCleanup. +// ReplicationProtectedItemsClientTestFailoverCleanupResponse contains the response from method ReplicationProtectedItemsClient.BeginTestFailoverCleanup. type ReplicationProtectedItemsClientTestFailoverCleanupResponse struct { ReplicationProtectedItem } -// ReplicationProtectedItemsClientTestFailoverResponse contains the response from method ReplicationProtectedItemsClient.TestFailover. +// ReplicationProtectedItemsClientTestFailoverResponse contains the response from method ReplicationProtectedItemsClient.BeginTestFailover. type ReplicationProtectedItemsClientTestFailoverResponse struct { ReplicationProtectedItem } -// ReplicationProtectedItemsClientUnplannedFailoverResponse contains the response from method ReplicationProtectedItemsClient.UnplannedFailover. +// ReplicationProtectedItemsClientUnplannedFailoverResponse contains the response from method ReplicationProtectedItemsClient.BeginUnplannedFailover. type ReplicationProtectedItemsClientUnplannedFailoverResponse struct { ReplicationProtectedItem } -// ReplicationProtectedItemsClientUpdateApplianceResponse contains the response from method ReplicationProtectedItemsClient.UpdateAppliance. +// ReplicationProtectedItemsClientUpdateApplianceResponse contains the response from method ReplicationProtectedItemsClient.BeginUpdateAppliance. type ReplicationProtectedItemsClientUpdateApplianceResponse struct { ReplicationProtectedItem } -// ReplicationProtectedItemsClientUpdateMobilityServiceResponse contains the response from method ReplicationProtectedItemsClient.UpdateMobilityService. +// ReplicationProtectedItemsClientUpdateMobilityServiceResponse contains the response from method ReplicationProtectedItemsClient.BeginUpdateMobilityService. type ReplicationProtectedItemsClientUpdateMobilityServiceResponse struct { ReplicationProtectedItem } -// ReplicationProtectedItemsClientUpdateResponse contains the response from method ReplicationProtectedItemsClient.Update. +// ReplicationProtectedItemsClientUpdateResponse contains the response from method ReplicationProtectedItemsClient.BeginUpdate. type ReplicationProtectedItemsClientUpdateResponse struct { ReplicationProtectedItem } -// ReplicationProtectionContainerMappingsClientCreateResponse contains the response from method ReplicationProtectionContainerMappingsClient.Create. +// ReplicationProtectionContainerMappingsClientCreateResponse contains the response from method ReplicationProtectionContainerMappingsClient.BeginCreate. type ReplicationProtectionContainerMappingsClientCreateResponse struct { ProtectionContainerMapping } -// ReplicationProtectionContainerMappingsClientDeleteResponse contains the response from method ReplicationProtectionContainerMappingsClient.Delete. +// ReplicationProtectionContainerMappingsClientDeleteResponse contains the response from method ReplicationProtectionContainerMappingsClient.BeginDelete. type ReplicationProtectionContainerMappingsClientDeleteResponse struct { // placeholder for future response values } @@ -425,37 +425,37 @@ type ReplicationProtectionContainerMappingsClientGetResponse struct { } // ReplicationProtectionContainerMappingsClientListByReplicationProtectionContainersResponse contains the response from method -// ReplicationProtectionContainerMappingsClient.ListByReplicationProtectionContainers. +// ReplicationProtectionContainerMappingsClient.NewListByReplicationProtectionContainersPager. type ReplicationProtectionContainerMappingsClientListByReplicationProtectionContainersResponse struct { ProtectionContainerMappingCollection } -// ReplicationProtectionContainerMappingsClientListResponse contains the response from method ReplicationProtectionContainerMappingsClient.List. +// ReplicationProtectionContainerMappingsClientListResponse contains the response from method ReplicationProtectionContainerMappingsClient.NewListPager. type ReplicationProtectionContainerMappingsClientListResponse struct { ProtectionContainerMappingCollection } -// ReplicationProtectionContainerMappingsClientPurgeResponse contains the response from method ReplicationProtectionContainerMappingsClient.Purge. +// ReplicationProtectionContainerMappingsClientPurgeResponse contains the response from method ReplicationProtectionContainerMappingsClient.BeginPurge. type ReplicationProtectionContainerMappingsClientPurgeResponse struct { // placeholder for future response values } -// ReplicationProtectionContainerMappingsClientUpdateResponse contains the response from method ReplicationProtectionContainerMappingsClient.Update. +// ReplicationProtectionContainerMappingsClientUpdateResponse contains the response from method ReplicationProtectionContainerMappingsClient.BeginUpdate. type ReplicationProtectionContainerMappingsClientUpdateResponse struct { ProtectionContainerMapping } -// ReplicationProtectionContainersClientCreateResponse contains the response from method ReplicationProtectionContainersClient.Create. +// ReplicationProtectionContainersClientCreateResponse contains the response from method ReplicationProtectionContainersClient.BeginCreate. type ReplicationProtectionContainersClientCreateResponse struct { ProtectionContainer } -// ReplicationProtectionContainersClientDeleteResponse contains the response from method ReplicationProtectionContainersClient.Delete. +// ReplicationProtectionContainersClientDeleteResponse contains the response from method ReplicationProtectionContainersClient.BeginDelete. type ReplicationProtectionContainersClientDeleteResponse struct { // placeholder for future response values } -// ReplicationProtectionContainersClientDiscoverProtectableItemResponse contains the response from method ReplicationProtectionContainersClient.DiscoverProtectableItem. +// ReplicationProtectionContainersClientDiscoverProtectableItemResponse contains the response from method ReplicationProtectionContainersClient.BeginDiscoverProtectableItem. type ReplicationProtectionContainersClientDiscoverProtectableItemResponse struct { ProtectionContainer } @@ -465,17 +465,17 @@ type ReplicationProtectionContainersClientGetResponse struct { ProtectionContainer } -// ReplicationProtectionContainersClientListByReplicationFabricsResponse contains the response from method ReplicationProtectionContainersClient.ListByReplicationFabrics. +// ReplicationProtectionContainersClientListByReplicationFabricsResponse contains the response from method ReplicationProtectionContainersClient.NewListByReplicationFabricsPager. type ReplicationProtectionContainersClientListByReplicationFabricsResponse struct { ProtectionContainerCollection } -// ReplicationProtectionContainersClientListResponse contains the response from method ReplicationProtectionContainersClient.List. +// ReplicationProtectionContainersClientListResponse contains the response from method ReplicationProtectionContainersClient.NewListPager. type ReplicationProtectionContainersClientListResponse struct { ProtectionContainerCollection } -// ReplicationProtectionContainersClientSwitchProtectionResponse contains the response from method ReplicationProtectionContainersClient.SwitchProtection. +// ReplicationProtectionContainersClientSwitchProtectionResponse contains the response from method ReplicationProtectionContainersClient.BeginSwitchProtection. type ReplicationProtectionContainersClientSwitchProtectionResponse struct { ProtectionContainer } @@ -490,27 +490,27 @@ type ReplicationProtectionIntentsClientGetResponse struct { ReplicationProtectionIntent } -// ReplicationProtectionIntentsClientListResponse contains the response from method ReplicationProtectionIntentsClient.List. +// ReplicationProtectionIntentsClientListResponse contains the response from method ReplicationProtectionIntentsClient.NewListPager. type ReplicationProtectionIntentsClientListResponse struct { ReplicationProtectionIntentCollection } -// ReplicationRecoveryPlansClientCreateResponse contains the response from method ReplicationRecoveryPlansClient.Create. +// ReplicationRecoveryPlansClientCreateResponse contains the response from method ReplicationRecoveryPlansClient.BeginCreate. type ReplicationRecoveryPlansClientCreateResponse struct { RecoveryPlan } -// ReplicationRecoveryPlansClientDeleteResponse contains the response from method ReplicationRecoveryPlansClient.Delete. +// ReplicationRecoveryPlansClientDeleteResponse contains the response from method ReplicationRecoveryPlansClient.BeginDelete. type ReplicationRecoveryPlansClientDeleteResponse struct { // placeholder for future response values } -// ReplicationRecoveryPlansClientFailoverCancelResponse contains the response from method ReplicationRecoveryPlansClient.FailoverCancel. +// ReplicationRecoveryPlansClientFailoverCancelResponse contains the response from method ReplicationRecoveryPlansClient.BeginFailoverCancel. type ReplicationRecoveryPlansClientFailoverCancelResponse struct { RecoveryPlan } -// ReplicationRecoveryPlansClientFailoverCommitResponse contains the response from method ReplicationRecoveryPlansClient.FailoverCommit. +// ReplicationRecoveryPlansClientFailoverCommitResponse contains the response from method ReplicationRecoveryPlansClient.BeginFailoverCommit. type ReplicationRecoveryPlansClientFailoverCommitResponse struct { RecoveryPlan } @@ -520,47 +520,47 @@ type ReplicationRecoveryPlansClientGetResponse struct { RecoveryPlan } -// ReplicationRecoveryPlansClientListResponse contains the response from method ReplicationRecoveryPlansClient.List. +// ReplicationRecoveryPlansClientListResponse contains the response from method ReplicationRecoveryPlansClient.NewListPager. type ReplicationRecoveryPlansClientListResponse struct { RecoveryPlanCollection } -// ReplicationRecoveryPlansClientPlannedFailoverResponse contains the response from method ReplicationRecoveryPlansClient.PlannedFailover. +// ReplicationRecoveryPlansClientPlannedFailoverResponse contains the response from method ReplicationRecoveryPlansClient.BeginPlannedFailover. type ReplicationRecoveryPlansClientPlannedFailoverResponse struct { RecoveryPlan } -// ReplicationRecoveryPlansClientReprotectResponse contains the response from method ReplicationRecoveryPlansClient.Reprotect. +// ReplicationRecoveryPlansClientReprotectResponse contains the response from method ReplicationRecoveryPlansClient.BeginReprotect. type ReplicationRecoveryPlansClientReprotectResponse struct { RecoveryPlan } -// ReplicationRecoveryPlansClientTestFailoverCleanupResponse contains the response from method ReplicationRecoveryPlansClient.TestFailoverCleanup. +// ReplicationRecoveryPlansClientTestFailoverCleanupResponse contains the response from method ReplicationRecoveryPlansClient.BeginTestFailoverCleanup. type ReplicationRecoveryPlansClientTestFailoverCleanupResponse struct { RecoveryPlan } -// ReplicationRecoveryPlansClientTestFailoverResponse contains the response from method ReplicationRecoveryPlansClient.TestFailover. +// ReplicationRecoveryPlansClientTestFailoverResponse contains the response from method ReplicationRecoveryPlansClient.BeginTestFailover. type ReplicationRecoveryPlansClientTestFailoverResponse struct { RecoveryPlan } -// ReplicationRecoveryPlansClientUnplannedFailoverResponse contains the response from method ReplicationRecoveryPlansClient.UnplannedFailover. +// ReplicationRecoveryPlansClientUnplannedFailoverResponse contains the response from method ReplicationRecoveryPlansClient.BeginUnplannedFailover. type ReplicationRecoveryPlansClientUnplannedFailoverResponse struct { RecoveryPlan } -// ReplicationRecoveryPlansClientUpdateResponse contains the response from method ReplicationRecoveryPlansClient.Update. +// ReplicationRecoveryPlansClientUpdateResponse contains the response from method ReplicationRecoveryPlansClient.BeginUpdate. type ReplicationRecoveryPlansClientUpdateResponse struct { RecoveryPlan } -// ReplicationRecoveryServicesProvidersClientCreateResponse contains the response from method ReplicationRecoveryServicesProvidersClient.Create. +// ReplicationRecoveryServicesProvidersClientCreateResponse contains the response from method ReplicationRecoveryServicesProvidersClient.BeginCreate. type ReplicationRecoveryServicesProvidersClientCreateResponse struct { RecoveryServicesProvider } -// ReplicationRecoveryServicesProvidersClientDeleteResponse contains the response from method ReplicationRecoveryServicesProvidersClient.Delete. +// ReplicationRecoveryServicesProvidersClientDeleteResponse contains the response from method ReplicationRecoveryServicesProvidersClient.BeginDelete. type ReplicationRecoveryServicesProvidersClientDeleteResponse struct { // placeholder for future response values } @@ -570,32 +570,32 @@ type ReplicationRecoveryServicesProvidersClientGetResponse struct { RecoveryServicesProvider } -// ReplicationRecoveryServicesProvidersClientListByReplicationFabricsResponse contains the response from method ReplicationRecoveryServicesProvidersClient.ListByReplicationFabrics. +// ReplicationRecoveryServicesProvidersClientListByReplicationFabricsResponse contains the response from method ReplicationRecoveryServicesProvidersClient.NewListByReplicationFabricsPager. type ReplicationRecoveryServicesProvidersClientListByReplicationFabricsResponse struct { RecoveryServicesProviderCollection } -// ReplicationRecoveryServicesProvidersClientListResponse contains the response from method ReplicationRecoveryServicesProvidersClient.List. +// ReplicationRecoveryServicesProvidersClientListResponse contains the response from method ReplicationRecoveryServicesProvidersClient.NewListPager. type ReplicationRecoveryServicesProvidersClientListResponse struct { RecoveryServicesProviderCollection } -// ReplicationRecoveryServicesProvidersClientPurgeResponse contains the response from method ReplicationRecoveryServicesProvidersClient.Purge. +// ReplicationRecoveryServicesProvidersClientPurgeResponse contains the response from method ReplicationRecoveryServicesProvidersClient.BeginPurge. type ReplicationRecoveryServicesProvidersClientPurgeResponse struct { // placeholder for future response values } -// ReplicationRecoveryServicesProvidersClientRefreshProviderResponse contains the response from method ReplicationRecoveryServicesProvidersClient.RefreshProvider. +// ReplicationRecoveryServicesProvidersClientRefreshProviderResponse contains the response from method ReplicationRecoveryServicesProvidersClient.BeginRefreshProvider. type ReplicationRecoveryServicesProvidersClientRefreshProviderResponse struct { RecoveryServicesProvider } -// ReplicationStorageClassificationMappingsClientCreateResponse contains the response from method ReplicationStorageClassificationMappingsClient.Create. +// ReplicationStorageClassificationMappingsClientCreateResponse contains the response from method ReplicationStorageClassificationMappingsClient.BeginCreate. type ReplicationStorageClassificationMappingsClientCreateResponse struct { StorageClassificationMapping } -// ReplicationStorageClassificationMappingsClientDeleteResponse contains the response from method ReplicationStorageClassificationMappingsClient.Delete. +// ReplicationStorageClassificationMappingsClientDeleteResponse contains the response from method ReplicationStorageClassificationMappingsClient.BeginDelete. type ReplicationStorageClassificationMappingsClientDeleteResponse struct { // placeholder for future response values } @@ -606,12 +606,12 @@ type ReplicationStorageClassificationMappingsClientGetResponse struct { } // ReplicationStorageClassificationMappingsClientListByReplicationStorageClassificationsResponse contains the response from -// method ReplicationStorageClassificationMappingsClient.ListByReplicationStorageClassifications. +// method ReplicationStorageClassificationMappingsClient.NewListByReplicationStorageClassificationsPager. type ReplicationStorageClassificationMappingsClientListByReplicationStorageClassificationsResponse struct { StorageClassificationMappingCollection } -// ReplicationStorageClassificationMappingsClientListResponse contains the response from method ReplicationStorageClassificationMappingsClient.List. +// ReplicationStorageClassificationMappingsClientListResponse contains the response from method ReplicationStorageClassificationMappingsClient.NewListPager. type ReplicationStorageClassificationMappingsClientListResponse struct { StorageClassificationMappingCollection } @@ -621,12 +621,12 @@ type ReplicationStorageClassificationsClientGetResponse struct { StorageClassification } -// ReplicationStorageClassificationsClientListByReplicationFabricsResponse contains the response from method ReplicationStorageClassificationsClient.ListByReplicationFabrics. +// ReplicationStorageClassificationsClientListByReplicationFabricsResponse contains the response from method ReplicationStorageClassificationsClient.NewListByReplicationFabricsPager. type ReplicationStorageClassificationsClientListByReplicationFabricsResponse struct { StorageClassificationCollection } -// ReplicationStorageClassificationsClientListResponse contains the response from method ReplicationStorageClassificationsClient.List. +// ReplicationStorageClassificationsClientListResponse contains the response from method ReplicationStorageClassificationsClient.NewListPager. type ReplicationStorageClassificationsClientListResponse struct { StorageClassificationCollection } @@ -636,12 +636,12 @@ type ReplicationVaultHealthClientGetResponse struct { VaultHealthDetails } -// ReplicationVaultHealthClientRefreshResponse contains the response from method ReplicationVaultHealthClient.Refresh. +// ReplicationVaultHealthClientRefreshResponse contains the response from method ReplicationVaultHealthClient.BeginRefresh. type ReplicationVaultHealthClientRefreshResponse struct { VaultHealthDetails } -// ReplicationVaultSettingClientCreateResponse contains the response from method ReplicationVaultSettingClient.Create. +// ReplicationVaultSettingClientCreateResponse contains the response from method ReplicationVaultSettingClient.BeginCreate. type ReplicationVaultSettingClientCreateResponse struct { VaultSetting } @@ -651,17 +651,17 @@ type ReplicationVaultSettingClientGetResponse struct { VaultSetting } -// ReplicationVaultSettingClientListResponse contains the response from method ReplicationVaultSettingClient.List. +// ReplicationVaultSettingClientListResponse contains the response from method ReplicationVaultSettingClient.NewListPager. type ReplicationVaultSettingClientListResponse struct { VaultSettingCollection } -// ReplicationvCentersClientCreateResponse contains the response from method ReplicationvCentersClient.Create. +// ReplicationvCentersClientCreateResponse contains the response from method ReplicationvCentersClient.BeginCreate. type ReplicationvCentersClientCreateResponse struct { VCenter } -// ReplicationvCentersClientDeleteResponse contains the response from method ReplicationvCentersClient.Delete. +// ReplicationvCentersClientDeleteResponse contains the response from method ReplicationvCentersClient.BeginDelete. type ReplicationvCentersClientDeleteResponse struct { // placeholder for future response values } @@ -671,17 +671,17 @@ type ReplicationvCentersClientGetResponse struct { VCenter } -// ReplicationvCentersClientListByReplicationFabricsResponse contains the response from method ReplicationvCentersClient.ListByReplicationFabrics. +// ReplicationvCentersClientListByReplicationFabricsResponse contains the response from method ReplicationvCentersClient.NewListByReplicationFabricsPager. type ReplicationvCentersClientListByReplicationFabricsResponse struct { VCenterCollection } -// ReplicationvCentersClientListResponse contains the response from method ReplicationvCentersClient.List. +// ReplicationvCentersClientListResponse contains the response from method ReplicationvCentersClient.NewListPager. type ReplicationvCentersClientListResponse struct { VCenterCollection } -// ReplicationvCentersClientUpdateResponse contains the response from method ReplicationvCentersClient.Update. +// ReplicationvCentersClientUpdateResponse contains the response from method ReplicationvCentersClient.BeginUpdate. type ReplicationvCentersClientUpdateResponse struct { VCenter } @@ -691,7 +691,7 @@ type SupportedOperatingSystemsClientGetResponse struct { SupportedOperatingSystems } -// TargetComputeSizesClientListByReplicationProtectedItemsResponse contains the response from method TargetComputeSizesClient.ListByReplicationProtectedItems. +// TargetComputeSizesClientListByReplicationProtectedItemsResponse contains the response from method TargetComputeSizesClient.NewListByReplicationProtectedItemsPager. type TargetComputeSizesClientListByReplicationProtectedItemsResponse struct { TargetComputeSizeCollection } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/supportedoperatingsystems_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/supportedoperatingsystems_client.go index 55d336d347c9..e68f72fde82b 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/supportedoperatingsystems_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/supportedoperatingsystems_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,52 +24,40 @@ import ( // SupportedOperatingSystemsClient contains the methods for the SupportedOperatingSystems group. // Don't use this type directly, use NewSupportedOperatingSystemsClient() instead. type SupportedOperatingSystemsClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewSupportedOperatingSystemsClient creates a new instance of SupportedOperatingSystemsClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewSupportedOperatingSystemsClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SupportedOperatingSystemsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSupportedOperatingSystemsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SupportedOperatingSystemsClient, error) { + cl, err := arm.NewClient(moduleName+".SupportedOperatingSystemsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &SupportedOperatingSystemsClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // Get - Gets the data of supported operating systems by SRS. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// options - SupportedOperatingSystemsClientGetOptions contains the optional parameters for the SupportedOperatingSystemsClient.Get -// method. -func (client *SupportedOperatingSystemsClient) Get(ctx context.Context, options *SupportedOperatingSystemsClientGetOptions) (SupportedOperatingSystemsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, options) +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - options - SupportedOperatingSystemsClientGetOptions contains the optional parameters for the SupportedOperatingSystemsClient.Get +// method. +func (client *SupportedOperatingSystemsClient) Get(ctx context.Context, resourceName string, resourceGroupName string, options *SupportedOperatingSystemsClientGetOptions) (SupportedOperatingSystemsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceName, resourceGroupName, options) if err != nil { return SupportedOperatingSystemsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SupportedOperatingSystemsClientGetResponse{}, err } @@ -82,21 +68,21 @@ func (client *SupportedOperatingSystemsClient) Get(ctx context.Context, options } // getCreateRequest creates the Get request. -func (client *SupportedOperatingSystemsClient) getCreateRequest(ctx context.Context, options *SupportedOperatingSystemsClientGetOptions) (*policy.Request, error) { +func (client *SupportedOperatingSystemsClient) getCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, options *SupportedOperatingSystemsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationSupportedOperatingSystems" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/supportedoperatingsystems_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/supportedoperatingsystems_client_example_test.go index 8991d7d05f33..8c5d80cd4757 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/supportedoperatingsystems_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/supportedoperatingsystems_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -13,24 +14,54 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/SupportedOperatingSystems_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/SupportedOperatingSystems_Get.json func ExampleSupportedOperatingSystemsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewSupportedOperatingSystemsClient("vault1", "resourceGroupPS1", "c183865e-6077-46f2-a3b1-deb0f4f4650a", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, &armrecoveryservicessiterecovery.SupportedOperatingSystemsClientGetOptions{InstanceType: nil}) + res, err := clientFactory.NewSupportedOperatingSystemsClient().Get(ctx, "vault1", "resourceGroupPS1", &armrecoveryservicessiterecovery.SupportedOperatingSystemsClientGetOptions{InstanceType: nil}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // You could use response here. We use blank identifier for just demo purposes. _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SupportedOperatingSystems = armrecoveryservicessiterecovery.SupportedOperatingSystems{ + // Name: to.Ptr("Default"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationSupportedOperatingSystems"), + // ID: to.Ptr("/Subscriptions/bc403605-c2b0-43dd-abe9-0162124b1ee1/resourceGroups/oneBoxRG/providers/Microsoft.RecoveryServices/vaults/oneBoxRSVault/replicationSupportedOperatingSystems/Default"), + // Properties: &armrecoveryservicessiterecovery.SupportedOSProperties{ + // SupportedOsList: []*armrecoveryservicessiterecovery.SupportedOSProperty{ + // { + // InstanceType: to.Ptr("A2A"), + // SupportedOs: []*armrecoveryservicessiterecovery.SupportedOSDetails{ + // { + // OSName: to.Ptr("centos"), + // OSType: to.Ptr("linux"), + // OSVersions: []*armrecoveryservicessiterecovery.OSVersionWrapper{ + // { + // Version: to.Ptr("6.0"), + // }}, + // }, + // { + // OSName: to.Ptr("Windows Server 2008 R2 Datacenter"), + // OSType: to.Ptr("windows"), + // OSVersions: []*armrecoveryservicessiterecovery.OSVersionWrapper{ + // { + // ServicePack: to.Ptr("1"), + // Version: to.Ptr("6.1"), + // }}, + // }}, + // }}, + // }, + // } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/targetcomputesizes_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/targetcomputesizes_client.go index 89757568575d..c1b63800fef0 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/targetcomputesizes_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/targetcomputesizes_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,49 +24,37 @@ import ( // TargetComputeSizesClient contains the methods for the TargetComputeSizes group. // Don't use this type directly, use NewTargetComputeSizesClient() instead. type TargetComputeSizesClient struct { - host string - resourceName string - resourceGroupName string - subscriptionID string - pl runtime.Pipeline + internal *arm.Client + subscriptionID string } // NewTargetComputeSizesClient creates a new instance of TargetComputeSizesClient with the specified values. -// resourceName - The name of the recovery services vault. -// resourceGroupName - The name of the resource group where the recovery services vault is present. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewTargetComputeSizesClient(resourceName string, resourceGroupName string, subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TargetComputeSizesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) +// - subscriptionID - The subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTargetComputeSizesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TargetComputeSizesClient, error) { + cl, err := arm.NewClient(moduleName+".TargetComputeSizesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &TargetComputeSizesClient{ - resourceName: resourceName, - resourceGroupName: resourceGroupName, - subscriptionID: subscriptionID, - host: ep, - pl: pl, + subscriptionID: subscriptionID, + internal: cl, } return client, nil } // NewListByReplicationProtectedItemsPager - Lists the available target compute sizes for a replication protected item. +// // Generated from API version 2022-10-01 -// fabricName - Fabric name. -// protectionContainerName - protection container name. -// replicatedProtectedItemName - Replication protected item name. -// options - TargetComputeSizesClientListByReplicationProtectedItemsOptions contains the optional parameters for the TargetComputeSizesClient.ListByReplicationProtectedItems -// method. -func (client *TargetComputeSizesClient) NewListByReplicationProtectedItemsPager(fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *TargetComputeSizesClientListByReplicationProtectedItemsOptions) *runtime.Pager[TargetComputeSizesClientListByReplicationProtectedItemsResponse] { +// - resourceName - The name of the recovery services vault. +// - resourceGroupName - The name of the resource group where the recovery services vault is present. +// - fabricName - Fabric name. +// - protectionContainerName - protection container name. +// - replicatedProtectedItemName - Replication protected item name. +// - options - TargetComputeSizesClientListByReplicationProtectedItemsOptions contains the optional parameters for the TargetComputeSizesClient.NewListByReplicationProtectedItemsPager +// method. +func (client *TargetComputeSizesClient) NewListByReplicationProtectedItemsPager(resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *TargetComputeSizesClientListByReplicationProtectedItemsOptions) *runtime.Pager[TargetComputeSizesClientListByReplicationProtectedItemsResponse] { return runtime.NewPager(runtime.PagingHandler[TargetComputeSizesClientListByReplicationProtectedItemsResponse]{ More: func(page TargetComputeSizesClientListByReplicationProtectedItemsResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -77,14 +63,14 @@ func (client *TargetComputeSizesClient) NewListByReplicationProtectedItemsPager( var req *policy.Request var err error if page == nil { - req, err = client.listByReplicationProtectedItemsCreateRequest(ctx, fabricName, protectionContainerName, replicatedProtectedItemName, options) + req, err = client.listByReplicationProtectedItemsCreateRequest(ctx, resourceName, resourceGroupName, fabricName, protectionContainerName, replicatedProtectedItemName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { return TargetComputeSizesClientListByReplicationProtectedItemsResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return TargetComputeSizesClientListByReplicationProtectedItemsResponse{}, err } @@ -97,16 +83,16 @@ func (client *TargetComputeSizesClient) NewListByReplicationProtectedItemsPager( } // listByReplicationProtectedItemsCreateRequest creates the ListByReplicationProtectedItems request. -func (client *TargetComputeSizesClient) listByReplicationProtectedItemsCreateRequest(ctx context.Context, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *TargetComputeSizesClientListByReplicationProtectedItemsOptions) (*policy.Request, error) { +func (client *TargetComputeSizesClient) listByReplicationProtectedItemsCreateRequest(ctx context.Context, resourceName string, resourceGroupName string, fabricName string, protectionContainerName string, replicatedProtectedItemName string, options *TargetComputeSizesClientListByReplicationProtectedItemsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/targetComputeSizes" - if client.resourceName == "" { - return nil, errors.New("parameter client.resourceName cannot be empty") + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(client.resourceName)) - if client.resourceGroupName == "" { - return nil, errors.New("parameter client.resourceGroupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(client.resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -123,7 +109,7 @@ func (client *TargetComputeSizesClient) listByReplicationProtectedItemsCreateReq return nil, errors.New("parameter replicatedProtectedItemName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{replicatedProtectedItemName}", url.PathEscape(replicatedProtectedItemName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/targetcomputesizes_client_example_test.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/targetcomputesizes_client_example_test.go index 1b4208f481da..ab9888faab48 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/targetcomputesizes_client_example_test.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/targetcomputesizes_client_example_test.go @@ -5,6 +5,7 @@ // 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 armrecoveryservicessiterecovery_test @@ -13,29 +14,64 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/TargetComputeSizes_ListByReplicationProtectedItems.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/TargetComputeSizes_ListByReplicationProtectedItems.json func ExampleTargetComputeSizesClient_NewListByReplicationProtectedItemsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armrecoveryservicessiterecovery.NewTargetComputeSizesClient("avraiMgDiskVault", "avraiMgDiskVaultRG", "6808dbbc-98c7-431f-a1b1-9580902423b7", cred, nil) + clientFactory, err := armrecoveryservicessiterecovery.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByReplicationProtectedItemsPager("asr-a2a-default-centraluseuap", "asr-a2a-default-centraluseuap-container", "468c912d-b1ab-4ea2-97eb-4b5095155db2", nil) + pager := clientFactory.NewTargetComputeSizesClient().NewListByReplicationProtectedItemsPager("avraiMgDiskVault", "avraiMgDiskVaultRG", "asr-a2a-default-centraluseuap", "asr-a2a-default-centraluseuap-container", "468c912d-b1ab-4ea2-97eb-4b5095155db2", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.TargetComputeSizeCollection = armrecoveryservicessiterecovery.TargetComputeSizeCollection{ + // Value: []*armrecoveryservicessiterecovery.TargetComputeSize{ + // { + // Name: to.Ptr("Basic_A0"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems/targetComputeSizes"), + // ID: to.Ptr("/Subscriptions/6808dbbc-98c7-431f-a1b1-9580902423b7/resourceGroups/avraiMgDiskVaultRG/providers/Microsoft.RecoveryServices/vaults/avraiMgDiskVault/replicationFabrics/asr-a2a-default-centraluseuap/replicationProtectionContainers/asr-a2a-default-centraluseuap-container/replicationProtectedItems/468c912d-b1ab-4ea2-97eb-4b5095155db2/targetComputeSizes/Basic_A0"), + // Properties: &armrecoveryservicessiterecovery.TargetComputeSizeProperties{ + // Name: to.Ptr("Basic_A0"), + // CPUCoresCount: to.Ptr[int32](1), + // FriendlyName: to.Ptr("Basic_A0"), + // HighIopsSupported: to.Ptr("NotSupported"), + // MaxDataDiskCount: to.Ptr[int32](1), + // MaxNicsCount: to.Ptr[int32](2), + // MemoryInGB: to.Ptr[float64](0.75), + // }, + // }, + // { + // Name: to.Ptr("Standard_A0"), + // Type: to.Ptr("Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectedItems/targetComputeSizes"), + // ID: to.Ptr("/Subscriptions/6808dbbc-98c7-431f-a1b1-9580902423b7/resourceGroups/avraiMgDiskVaultRG/providers/Microsoft.RecoveryServices/vaults/avraiMgDiskVault/replicationFabrics/asr-a2a-default-centraluseuap/replicationProtectionContainers/asr-a2a-default-centraluseuap-container/replicationProtectedItems/468c912d-b1ab-4ea2-97eb-4b5095155db2/targetComputeSizes/Standard_A0"), + // Properties: &armrecoveryservicessiterecovery.TargetComputeSizeProperties{ + // Name: to.Ptr("Standard_A0"), + // CPUCoresCount: to.Ptr[int32](1), + // FriendlyName: to.Ptr("Standard_A0"), + // HighIopsSupported: to.Ptr("NotSupported"), + // HyperVGenerations: []*string{ + // to.Ptr("V1")}, + // MaxDataDiskCount: to.Ptr[int32](1), + // MaxNicsCount: to.Ptr[int32](2), + // MemoryInGB: to.Ptr[float64](0.75), + // VCPUsAvailable: to.Ptr[int32](1), + // }, + // }}, + // } } } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/time_rfc3339.go b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/time_rfc3339.go index 154cb19b3fa6..a693c786988b 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/time_rfc3339.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservicessiterecovery/time_rfc3339.go @@ -62,7 +62,7 @@ func (t *timeRFC3339) Parse(layout, value string) error { return err } -func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/search/armsearch/CHANGELOG.md b/sdk/resourcemanager/search/armsearch/CHANGELOG.md index 59c3a45100c8..a1c804c88e2d 100644 --- a/sdk/resourcemanager/search/armsearch/CHANGELOG.md +++ b/sdk/resourcemanager/search/armsearch/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 1.1.0 (2023-04-03) +### Features Added + +- New struct `ClientFactory` which is a client factory used to create any client in this module + + ## 1.0.0 (2022-05-17) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. diff --git a/sdk/resourcemanager/search/armsearch/README.md b/sdk/resourcemanager/search/armsearch/README.md index e3796ce41e0d..2ccfb9c8592e 100644 --- a/sdk/resourcemanager/search/armsearch/README.md +++ b/sdk/resourcemanager/search/armsearch/README.md @@ -33,12 +33,12 @@ 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). -## Clients +## Client Factory -Azure Search modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. +Azure Search module consists of one or more clients. We provide a client factory which could be used to create any client in this module. ```go -client, err := armsearch.NewQueryKeysClient(, cred, nil) +clientFactory, err := armsearch.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). @@ -49,7 +49,15 @@ options := arm.ClientOptions { Cloud: cloud.AzureChina, }, } -client, err := armsearch.NewQueryKeysClient(, cred, &options) +clientFactory, err := armsearch.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.NewServicesClient() ``` ## Provide Feedback diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_adminkeys_client.go b/sdk/resourcemanager/search/armsearch/adminkeys_client.go similarity index 77% rename from sdk/resourcemanager/search/armsearch/zz_generated_adminkeys_client.go rename to sdk/resourcemanager/search/armsearch/adminkeys_client.go index d11c8a558678..c37479023fba 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_adminkeys_client.go +++ b/sdk/resourcemanager/search/armsearch/adminkeys_client.go @@ -5,6 +5,7 @@ // 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 armsearch @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,51 +24,43 @@ import ( // AdminKeysClient contains the methods for the AdminKeys group. // Don't use this type directly, use NewAdminKeysClient() instead. type AdminKeysClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewAdminKeysClient creates a new instance of AdminKeysClient with the specified values. -// subscriptionID - The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource -// Manager API or the portal. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewAdminKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AdminKeysClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".AdminKeysClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &AdminKeysClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // Get - Gets the primary and secondary admin API keys for the specified Azure Cognitive Search service. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 -// resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the -// Azure Resource Manager API or the portal. -// searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. -// SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get -// method. -// options - AdminKeysClientGetOptions contains the optional parameters for the AdminKeysClient.Get method. +// - resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the +// Azure Resource Manager API or the portal. +// - searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - AdminKeysClientGetOptions contains the optional parameters for the AdminKeysClient.Get method. func (client *AdminKeysClient) Get(ctx context.Context, resourceGroupName string, searchServiceName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *AdminKeysClientGetOptions) (AdminKeysClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, searchServiceName, searchManagementRequestOptions, options) if err != nil { return AdminKeysClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AdminKeysClientGetResponse{}, err } @@ -94,7 +85,7 @@ func (client *AdminKeysClient) getCreateRequest(ctx context.Context, resourceGro 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -119,20 +110,21 @@ func (client *AdminKeysClient) getHandleResponse(resp *http.Response) (AdminKeys // Regenerate - Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 -// resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the -// Azure Resource Manager API or the portal. -// searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. -// keyKind - Specifies which key to regenerate. Valid values include 'primary' and 'secondary'. -// SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get -// method. -// options - AdminKeysClientRegenerateOptions contains the optional parameters for the AdminKeysClient.Regenerate method. +// - resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the +// Azure Resource Manager API or the portal. +// - searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. +// - keyKind - Specifies which key to regenerate. Valid values include 'primary' and 'secondary'. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - AdminKeysClientRegenerateOptions contains the optional parameters for the AdminKeysClient.Regenerate method. func (client *AdminKeysClient) Regenerate(ctx context.Context, resourceGroupName string, searchServiceName string, keyKind AdminKeyKind, searchManagementRequestOptions *SearchManagementRequestOptions, options *AdminKeysClientRegenerateOptions) (AdminKeysClientRegenerateResponse, error) { req, err := client.regenerateCreateRequest(ctx, resourceGroupName, searchServiceName, keyKind, searchManagementRequestOptions, options) if err != nil { return AdminKeysClientRegenerateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AdminKeysClientRegenerateResponse{}, err } @@ -161,7 +153,7 @@ func (client *AdminKeysClient) regenerateCreateRequest(ctx context.Context, reso 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/search/armsearch/adminkeys_client_example_test.go b/sdk/resourcemanager/search/armsearch/adminkeys_client_example_test.go new file mode 100644 index 000000000000..94d9f1a9c0ca --- /dev/null +++ b/sdk/resourcemanager/search/armsearch/adminkeys_client_example_test.go @@ -0,0 +1,66 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armsearch_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchGetAdminKeys.json +func ExampleAdminKeysClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAdminKeysClient().Get(ctx, "rg1", "mysearchservice", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AdminKeyResult = armsearch.AdminKeyResult{ + // PrimaryKey: to.Ptr(""), + // SecondaryKey: to.Ptr(""), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchRegenerateAdminKey.json +func ExampleAdminKeysClient_Regenerate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAdminKeysClient().Regenerate(ctx, "rg1", "mysearchservice", armsearch.AdminKeyKindPrimary, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AdminKeyResult = armsearch.AdminKeyResult{ + // PrimaryKey: to.Ptr(""), + // SecondaryKey: to.Ptr(""), + // } +} diff --git a/sdk/resourcemanager/search/armsearch/autorest.md b/sdk/resourcemanager/search/armsearch/autorest.md index 4bc3e1d36335..d3780a55c1f6 100644 --- a/sdk/resourcemanager/search/armsearch/autorest.md +++ b/sdk/resourcemanager/search/armsearch/autorest.md @@ -5,8 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/search/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/search/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 1.1.0 +tag: package-2020-08 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/search/armsearch/client_factory.go b/sdk/resourcemanager/search/armsearch/client_factory.go new file mode 100644 index 000000000000..02ccc7c958e0 --- /dev/null +++ b/sdk/resourcemanager/search/armsearch/client_factory.go @@ -0,0 +1,75 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armsearch + +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 + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// 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 unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAdminKeysClient() *AdminKeysClient { + subClient, _ := NewAdminKeysClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewQueryKeysClient() *QueryKeysClient { + subClient, _ := NewQueryKeysClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewServicesClient() *ServicesClient { + subClient, _ := NewServicesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { + subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSharedPrivateLinkResourcesClient() *SharedPrivateLinkResourcesClient { + subClient, _ := NewSharedPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_constants.go b/sdk/resourcemanager/search/armsearch/constants.go similarity index 99% rename from sdk/resourcemanager/search/armsearch/zz_generated_constants.go rename to sdk/resourcemanager/search/armsearch/constants.go index 90e2a0978f44..2dcbace88ed9 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_constants.go +++ b/sdk/resourcemanager/search/armsearch/constants.go @@ -5,12 +5,13 @@ // 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 armsearch const ( moduleName = "armsearch" - moduleVersion = "v1.0.0" + moduleVersion = "v1.1.0" ) type AdminKeyKind string diff --git a/sdk/resourcemanager/search/armsearch/go.mod b/sdk/resourcemanager/search/armsearch/go.mod index f504edc08a77..231de37f4a72 100644 --- a/sdk/resourcemanager/search/armsearch/go.mod +++ b/sdk/resourcemanager/search/armsearch/go.mod @@ -3,19 +3,19 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect + github.com/golang-jwt/jwt/v4 v4.5.0 // indirect + github.com/google/uuid v1.3.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect - golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect - golang.org/x/text v0.3.7 // indirect + github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect + golang.org/x/crypto v0.6.0 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect ) diff --git a/sdk/resourcemanager/search/armsearch/go.sum b/sdk/resourcemanager/search/armsearch/go.sum index ed5b814680ee..8ba445a8c4da 100644 --- a/sdk/resourcemanager/search/armsearch/go.sum +++ b/sdk/resourcemanager/search/armsearch/go.sum @@ -1,33 +1,31 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= +github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.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/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= +golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_models.go b/sdk/resourcemanager/search/armsearch/models.go similarity index 95% rename from sdk/resourcemanager/search/armsearch/zz_generated_models.go rename to sdk/resourcemanager/search/armsearch/models.go index b6fbc3be7788..bf7987f99ed6 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_models.go +++ b/sdk/resourcemanager/search/armsearch/models.go @@ -5,6 +5,7 @@ // 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 armsearch @@ -40,7 +41,8 @@ type CheckNameAvailabilityInput struct { // dashes, and must be between 2 and 60 characters in length. Name *string `json:"name,omitempty"` - // REQUIRED; The type of the resource whose name is to be validated. This value must always be 'searchServices'. + // CONSTANT; The type of the resource whose name is to be validated. This value must always be 'searchServices'. + // Field has constant value "searchServices", any specified value is ignored. Type *string `json:"type,omitempty"` } @@ -59,28 +61,6 @@ type CheckNameAvailabilityOutput struct { Reason *UnavailableNameReason `json:"reason,omitempty" azure:"ro"` } -// CloudError - Contains information about an API error. -type CloudError struct { - // Describes a particular API error with an error code and a message. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody - Describes a particular API error with an error code and a message. -type CloudErrorBody struct { - // An error code that describes the error condition more precisely than an HTTP status code. Can be used to programmatically - // handle specific error cases. - Code *string `json:"code,omitempty"` - - // Contains nested errors that are related to this error. - Details []*CloudErrorBody `json:"details,omitempty"` - - // A message that describes the error in detail and provides debugging information. - Message *string `json:"message,omitempty"` - - // The target of the particular error (for example, the name of the property in error). - Target *string `json:"target,omitempty"` -} - // IPRule - The IP restriction rule of the Azure Cognitive Search service. type IPRule struct { // Value corresponding to a single IPv4 address (eg., 123.1.2.3) or an IP range in CIDR format (eg., 123.1.2.3/24) to be allowed. @@ -153,7 +133,7 @@ type OperationListResult struct { Value []*Operation `json:"value,omitempty" azure:"ro"` } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters } @@ -224,7 +204,7 @@ type PrivateEndpointConnectionsClientGetOptions struct { // placeholder for future optional parameters } -// PrivateEndpointConnectionsClientListByServiceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.ListByService +// PrivateEndpointConnectionsClientListByServiceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByServicePager // method. type PrivateEndpointConnectionsClientListByServiceOptions struct { // placeholder for future optional parameters @@ -268,7 +248,7 @@ type PrivateLinkResourceProperties struct { ShareablePrivateLinkResourceTypes []*ShareablePrivateLinkResourceType `json:"shareablePrivateLinkResourceTypes,omitempty" azure:"ro"` } -// PrivateLinkResourcesClientListSupportedOptions contains the optional parameters for the PrivateLinkResourcesClient.ListSupported +// PrivateLinkResourcesClientListSupportedOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListSupportedPager // method. type PrivateLinkResourcesClientListSupportedOptions struct { // placeholder for future optional parameters @@ -299,7 +279,7 @@ type QueryKeysClientDeleteOptions struct { // placeholder for future optional parameters } -// QueryKeysClientListBySearchServiceOptions contains the optional parameters for the QueryKeysClient.ListBySearchService +// QueryKeysClientListBySearchServiceOptions contains the optional parameters for the QueryKeysClient.NewListBySearchServicePager // method. type QueryKeysClientListBySearchServiceOptions struct { // placeholder for future optional parameters @@ -481,12 +461,14 @@ type ServicesClientGetOptions struct { // placeholder for future optional parameters } -// ServicesClientListByResourceGroupOptions contains the optional parameters for the ServicesClient.ListByResourceGroup method. +// ServicesClientListByResourceGroupOptions contains the optional parameters for the ServicesClient.NewListByResourceGroupPager +// method. type ServicesClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// ServicesClientListBySubscriptionOptions contains the optional parameters for the ServicesClient.ListBySubscription method. +// ServicesClientListBySubscriptionOptions contains the optional parameters for the ServicesClient.NewListBySubscriptionPager +// method. type ServicesClientListBySubscriptionOptions struct { // placeholder for future optional parameters } @@ -592,7 +574,7 @@ type SharedPrivateLinkResourcesClientGetOptions struct { // placeholder for future optional parameters } -// SharedPrivateLinkResourcesClientListByServiceOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.ListByService +// SharedPrivateLinkResourcesClientListByServiceOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.NewListByServicePager // method. type SharedPrivateLinkResourcesClientListByServiceOptions struct { // placeholder for future optional parameters diff --git a/sdk/resourcemanager/search/armsearch/models_serde.go b/sdk/resourcemanager/search/armsearch/models_serde.go new file mode 100644 index 000000000000..4a2a049e3501 --- /dev/null +++ b/sdk/resourcemanager/search/armsearch/models_serde.go @@ -0,0 +1,1173 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armsearch + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AdminKeyResult. +func (a AdminKeyResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "primaryKey", a.PrimaryKey) + populate(objectMap, "secondaryKey", a.SecondaryKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdminKeyResult. +func (a *AdminKeyResult) UnmarshalJSON(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 "primaryKey": + err = unpopulate(val, "PrimaryKey", &a.PrimaryKey) + delete(rawMsg, key) + case "secondaryKey": + err = unpopulate(val, "SecondaryKey", &a.SecondaryKey) + 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 AsyncOperationResult. +func (a AsyncOperationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "status", a.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AsyncOperationResult. +func (a *AsyncOperationResult) UnmarshalJSON(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 "status": + err = unpopulate(val, "Status", &a.Status) + 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 CheckNameAvailabilityInput. +func (c CheckNameAvailabilityInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", c.Name) + objectMap["type"] = "searchServices" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityInput. +func (c *CheckNameAvailabilityInput) UnmarshalJSON(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 CheckNameAvailabilityOutput. +func (c CheckNameAvailabilityOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nameAvailable", c.IsNameAvailable) + populate(objectMap, "message", c.Message) + populate(objectMap, "reason", c.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityOutput. +func (c *CheckNameAvailabilityOutput) UnmarshalJSON(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 "nameAvailable": + err = unpopulate(val, "IsNameAvailable", &c.IsNameAvailable) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &c.Message) + 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 IPRule. +func (i IPRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPRule. +func (i *IPRule) UnmarshalJSON(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 "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 Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + populate(objectMap, "type", i.Type) + 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 "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListQueryKeysResult. +func (l ListQueryKeysResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListQueryKeysResult. +func (l *ListQueryKeysResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkRuleSet. +func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ipRules", n.IPRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkRuleSet. +func (n *NetworkRuleSet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ipRules": + err = unpopulate(val, "IPRules", &n.IPRules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, 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, "display", o.Display) + populate(objectMap, "name", o.Name) + 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 "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + 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 PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. +func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionPropertiesPrivateEndpoint. +func (p PrivateEndpointConnectionPropertiesPrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionPropertiesPrivateEndpoint. +func (p *PrivateEndpointConnectionPropertiesPrivateEndpoint) UnmarshalJSON(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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState. +func (p PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState. +func (p *PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "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 PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + populate(objectMap, "shareablePrivateLinkResourceTypes", p.ShareablePrivateLinkResourceTypes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + delete(rawMsg, key) + case "shareablePrivateLinkResourceTypes": + err = unpopulate(val, "ShareablePrivateLinkResourceTypes", &p.ShareablePrivateLinkResourceTypes) + 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 PrivateLinkResourcesResult. +func (p PrivateLinkResourcesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourcesResult. +func (p *PrivateLinkResourcesResult) UnmarshalJSON(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 "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 QueryKey. +func (q QueryKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "key", q.Key) + populate(objectMap, "name", q.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryKey. +func (q *QueryKey) UnmarshalJSON(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 "key": + err = unpopulate(val, "Key", &q.Key) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &q.Name) + 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 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 SKU. +func (s SKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", s.Name) + 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 "name": + err = unpopulate(val, "Name", &s.Name) + 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 Service. +func (s Service) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "sku", s.SKU) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Service. +func (s *Service) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &s.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceListResult. +func (s ServiceListResult) 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 ServiceListResult. +func (s *ServiceListResult) UnmarshalJSON(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 ServiceProperties. +func (s ServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "hostingMode", s.HostingMode) + populate(objectMap, "networkRuleSet", s.NetworkRuleSet) + populate(objectMap, "partitionCount", s.PartitionCount) + populate(objectMap, "privateEndpointConnections", s.PrivateEndpointConnections) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) + populate(objectMap, "replicaCount", s.ReplicaCount) + populate(objectMap, "sharedPrivateLinkResources", s.SharedPrivateLinkResources) + populate(objectMap, "status", s.Status) + populate(objectMap, "statusDetails", s.StatusDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceProperties. +func (s *ServiceProperties) UnmarshalJSON(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 "hostingMode": + err = unpopulate(val, "HostingMode", &s.HostingMode) + delete(rawMsg, key) + case "networkRuleSet": + err = unpopulate(val, "NetworkRuleSet", &s.NetworkRuleSet) + delete(rawMsg, key) + case "partitionCount": + err = unpopulate(val, "PartitionCount", &s.PartitionCount) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &s.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &s.PublicNetworkAccess) + delete(rawMsg, key) + case "replicaCount": + err = unpopulate(val, "ReplicaCount", &s.ReplicaCount) + delete(rawMsg, key) + case "sharedPrivateLinkResources": + err = unpopulate(val, "SharedPrivateLinkResources", &s.SharedPrivateLinkResources) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "statusDetails": + err = unpopulate(val, "StatusDetails", &s.StatusDetails) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceUpdate. +func (s ServiceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "sku", s.SKU) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceUpdate. +func (s *ServiceUpdate) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &s.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ShareablePrivateLinkResourceProperties. +func (s ShareablePrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", s.Description) + populate(objectMap, "groupId", s.GroupID) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ShareablePrivateLinkResourceProperties. +func (s *ShareablePrivateLinkResourceProperties) UnmarshalJSON(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 "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "groupId": + err = unpopulate(val, "GroupID", &s.GroupID) + 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 ShareablePrivateLinkResourceType. +func (s ShareablePrivateLinkResourceType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ShareablePrivateLinkResourceType. +func (s *ShareablePrivateLinkResourceType) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharedPrivateLinkResource. +func (s SharedPrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedPrivateLinkResource. +func (s *SharedPrivateLinkResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharedPrivateLinkResourceListResult. +func (s SharedPrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedPrivateLinkResourceListResult. +func (s *SharedPrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SharedPrivateLinkResourceProperties. +func (s SharedPrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupId", s.GroupID) + populate(objectMap, "privateLinkResourceId", s.PrivateLinkResourceID) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "requestMessage", s.RequestMessage) + populate(objectMap, "resourceRegion", s.ResourceRegion) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedPrivateLinkResourceProperties. +func (s *SharedPrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &s.GroupID) + delete(rawMsg, key) + case "privateLinkResourceId": + err = unpopulate(val, "PrivateLinkResourceID", &s.PrivateLinkResourceID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "requestMessage": + err = unpopulate(val, "RequestMessage", &s.RequestMessage) + delete(rawMsg, key) + case "resourceRegion": + err = unpopulate(val, "ResourceRegion", &s.ResourceRegion) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type 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 +} + +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 { + 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/search/armsearch/zz_generated_operations_client.go b/sdk/resourcemanager/search/armsearch/operations_client.go similarity index 76% rename from sdk/resourcemanager/search/armsearch/zz_generated_operations_client.go rename to sdk/resourcemanager/search/armsearch/operations_client.go index 2d8cdd2165c0..09048e0965a7 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_operations_client.go +++ b/sdk/resourcemanager/search/armsearch/operations_client.go @@ -5,6 +5,7 @@ // 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 armsearch @@ -12,8 +13,6 @@ import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -22,36 +21,27 @@ import ( // OperationsClient contains the methods for the Operations group. // Don't use this type directly, use NewOperationsClient() instead. type OperationsClient struct { - host string - pl runtime.Pipeline + 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. +// - 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) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &OperationsClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // NewListPager - Lists all of the available REST API operations of the Microsoft.Search provider. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 -// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// - 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 { @@ -62,7 +52,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption if err != nil { return OperationsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return OperationsClientListResponse{}, err } @@ -77,7 +67,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption // listCreateRequest creates the List request. func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Search/operations" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/search/armsearch/operations_client_example_test.go b/sdk/resourcemanager/search/armsearch/operations_client_example_test.go new file mode 100644 index 000000000000..d2b1117372fa --- /dev/null +++ b/sdk/resourcemanager/search/armsearch/operations_client_example_test.go @@ -0,0 +1,298 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armsearch_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/OperationsList.json +func ExampleOperationsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOperationsClient().NewListPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.OperationListResult = armsearch.OperationListResult{ + // Value: []*armsearch.Operation{ + // { + // Name: to.Ptr("Microsoft.Search/operations/read"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Lists all of the available operations of the Microsoft.Search provider."), + // Operation: to.Ptr("List all available operations"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Search Services"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/register/action"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Registers the subscription for the search resource provider and enables the creation of search services."), + // Operation: to.Ptr("Register the Search Resource Provider"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Search Services"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/write"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Creates or updates the search service."), + // Operation: to.Ptr("Set Search Service"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Search Services"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/read"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Reads the search service."), + // Operation: to.Ptr("Get Search Service"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Search Services"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/delete"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Deletes the search service."), + // Operation: to.Ptr("Delete Search Service"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Search Services"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/start/action"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Starts the search service."), + // Operation: to.Ptr("Start Search Service"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Search Services"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/stop/action"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Stops the search service."), + // Operation: to.Ptr("Stop Search Service"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Search Services"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/listAdminKeys/action"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Reads the admin keys."), + // Operation: to.Ptr("Get Admin Key"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Search Services"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/regenerateAdminKey/action"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Regenerates the admin key."), + // Operation: to.Ptr("Regenerate Admin Key"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Search Services"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/listQueryKeys/action"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Returns the list of query API keys for the given Azure Search service."), + // Operation: to.Ptr("Get Query Keys"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("API Keys"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/createQueryKey/action"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Creates the query key."), + // Operation: to.Ptr("Create Query Key"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Search Services"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/deleteQueryKey/delete"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Deletes the query key."), + // Operation: to.Ptr("Delete Query Key"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("API Keys"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/checkNameAvailability/action"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Checks availability of the service name."), + // Operation: to.Ptr("Check Service Name Availability"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Service Name Availability"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/diagnosticSettings/read"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Gets the diganostic setting read for the resource"), + // Operation: to.Ptr("Get Diagnostic Setting"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Diagnostic Settings"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/diagnosticSettings/write"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Creates or updates the diganostic setting for the resource"), + // Operation: to.Ptr("Set Diagnostic Setting"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Diagnostic Settings"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/metricDefinitions/read"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Gets the available metrics for the search service"), + // Operation: to.Ptr("Read search service metric definitions"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("The metric definitions for the search service"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/logDefinitions/read"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Gets the available logs for the search service"), + // Operation: to.Ptr("Read search service log definitions"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("The log definition for the search service"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/privateEndpointConnectionProxies/validate/action"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Validates a private endpoint connection create call from NRP side"), + // Operation: to.Ptr("Validate Private Endpoint Connection Proxy"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Private Endpoint Connection Proxy"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/privateEndpointConnectionProxies/write"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Creates a private endpoint connection proxy with the specified parameters or updates the properties or tags for the specified private endpoint connection proxy"), + // Operation: to.Ptr("Create Private Endpoint Connection Proxy"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Private Endpoint Connection Proxy"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/privateEndpointConnectionProxies/read"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Returns the list of private endpoint connection proxies or gets the properties for the specified private endpoint connection proxy"), + // Operation: to.Ptr("Get Private Endpoint Connection Proxy"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Private Endpoint Connection Proxy"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/privateEndpointConnectionProxies/delete"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Deletes an existing private endpoint connection proxy"), + // Operation: to.Ptr("Delete Private Endpoint Connection Proxy"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Private Endpoint Connection Proxy"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/privateEndpointConnections/write"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Creates a private endpoint connections with the specified parameters or updates the properties or tags for the specified private endpoint connections"), + // Operation: to.Ptr("Create Private Endpoint Connection"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Private Endpoint Connection"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/privateEndpointConnections/read"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Returns the list of private endpoint connections or gets the properties for the specified private endpoint connections"), + // Operation: to.Ptr("Get Private Endpoint Connection"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Private Endpoint Connection"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/privateEndpointConnections/delete"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Deletes an existing private endpoint connections"), + // Operation: to.Ptr("Delete Private Endpoint Connection"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Private Endpoint Connection"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/sharedPrivateLinkResources/write"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Creates a new shared private link resource with the specified parameters or updates the properties for the specified shared private link resource"), + // Operation: to.Ptr("Create Shared Private Link Resource"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Shared Private Link Resource"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/sharedPrivateLinkResources/read"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Returns the list of shared private link resources or gets the properties for the specified shared private link resource"), + // Operation: to.Ptr("Get Shared Private Link Resource"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Shared Private Link Resource"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/sharedPrivateLinkResources/delete"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Deletes an existing shared private link resource"), + // Operation: to.Ptr("Delete Shared Private Link Resource"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Shared Private Link Resource"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Search/searchServices/sharedPrivateLinkResources/operationStatuses/read"), + // Display: &armsearch.OperationDisplay{ + // Description: to.Ptr("Get the details of a long running shared private link resource operation"), + // Operation: to.Ptr("Get Operation Status"), + // Provider: to.Ptr("Microsoft Search"), + // Resource: to.Ptr("Shared Private Link Resource"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/search/armsearch/privateendpointconnections_client.go similarity index 79% rename from sdk/resourcemanager/search/armsearch/zz_generated_privateendpointconnections_client.go rename to sdk/resourcemanager/search/armsearch/privateendpointconnections_client.go index 886b36cdac0f..63c2e285a748 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/search/armsearch/privateendpointconnections_client.go @@ -5,6 +5,7 @@ // 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 armsearch @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,54 +24,46 @@ import ( // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. // Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. type PrivateEndpointConnectionsClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -// subscriptionID - The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource -// Manager API or the portal. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".PrivateEndpointConnectionsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &PrivateEndpointConnectionsClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // Delete - Disconnects the private endpoint connection and deletes it from the search service. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 -// resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the -// Azure Resource Manager API or the portal. -// searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. -// privateEndpointConnectionName - The name of the private endpoint connection to the Azure Cognitive Search service with -// the specified resource group. -// SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get -// method. -// options - PrivateEndpointConnectionsClientDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Delete -// method. +// - resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the +// Azure Resource Manager API or the portal. +// - searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. +// - privateEndpointConnectionName - The name of the private endpoint connection to the Azure Cognitive Search service with +// the specified resource group. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - PrivateEndpointConnectionsClientDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Delete +// method. func (client *PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, searchServiceName string, privateEndpointConnectionName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *PrivateEndpointConnectionsClientDeleteOptions) (PrivateEndpointConnectionsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, searchServiceName, privateEndpointConnectionName, searchManagementRequestOptions, options) if err != nil { return PrivateEndpointConnectionsClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientDeleteResponse{}, err } @@ -101,7 +92,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. 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.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -126,22 +117,23 @@ func (client *PrivateEndpointConnectionsClient) deleteHandleResponse(resp *http. // Get - Gets the details of the private endpoint connection to the search service in the given resource group. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 -// resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the -// Azure Resource Manager API or the portal. -// searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. -// privateEndpointConnectionName - The name of the private endpoint connection to the Azure Cognitive Search service with -// the specified resource group. -// SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get -// method. -// options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. +// - resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the +// Azure Resource Manager API or the portal. +// - searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. +// - privateEndpointConnectionName - The name of the private endpoint connection to the Azure Cognitive Search service with +// the specified resource group. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, searchServiceName string, privateEndpointConnectionName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, searchServiceName, privateEndpointConnectionName, searchManagementRequestOptions, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } @@ -170,7 +162,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -194,15 +186,15 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res } // NewListByServicePager - Gets a list of all private endpoint connections in the given service. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 -// resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the -// Azure Resource Manager API or the portal. -// searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. -// SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get -// method. -// options - PrivateEndpointConnectionsClientListByServiceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.ListByService -// method. +// - resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the +// Azure Resource Manager API or the portal. +// - searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - PrivateEndpointConnectionsClientListByServiceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByServicePager +// method. func (client *PrivateEndpointConnectionsClient) NewListByServicePager(resourceGroupName string, searchServiceName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *PrivateEndpointConnectionsClientListByServiceOptions) *runtime.Pager[PrivateEndpointConnectionsClientListByServiceResponse] { return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListByServiceResponse]{ More: func(page PrivateEndpointConnectionsClientListByServiceResponse) bool { @@ -219,7 +211,7 @@ func (client *PrivateEndpointConnectionsClient) NewListByServicePager(resourceGr if err != nil { return PrivateEndpointConnectionsClientListByServiceResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientListByServiceResponse{}, err } @@ -246,7 +238,7 @@ func (client *PrivateEndpointConnectionsClient) listByServiceCreateRequest(ctx c return nil, errors.New("parameter searchServiceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{searchServiceName}", url.PathEscape(searchServiceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -271,23 +263,24 @@ func (client *PrivateEndpointConnectionsClient) listByServiceHandleResponse(resp // Update - Updates a Private Endpoint connection to the search service in the given resource group. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 -// resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the -// Azure Resource Manager API or the portal. -// searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. -// privateEndpointConnectionName - The name of the private endpoint connection to the Azure Cognitive Search service with -// the specified resource group. -// privateEndpointConnection - The definition of the private endpoint connection to update. -// SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get -// method. -// options - PrivateEndpointConnectionsClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Update -// method. +// - resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the +// Azure Resource Manager API or the portal. +// - searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. +// - privateEndpointConnectionName - The name of the private endpoint connection to the Azure Cognitive Search service with +// the specified resource group. +// - privateEndpointConnection - The definition of the private endpoint connection to update. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - PrivateEndpointConnectionsClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Update +// method. func (client *PrivateEndpointConnectionsClient) Update(ctx context.Context, resourceGroupName string, searchServiceName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, searchManagementRequestOptions *SearchManagementRequestOptions, options *PrivateEndpointConnectionsClientUpdateOptions) (PrivateEndpointConnectionsClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, searchServiceName, privateEndpointConnectionName, privateEndpointConnection, searchManagementRequestOptions, options) if err != nil { return PrivateEndpointConnectionsClientUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientUpdateResponse{}, err } @@ -316,7 +309,7 @@ func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context. 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.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/search/armsearch/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/search/armsearch/privateendpointconnections_client_example_test.go new file mode 100644 index 000000000000..43a177dd6c5f --- /dev/null +++ b/sdk/resourcemanager/search/armsearch/privateendpointconnections_client_example_test.go @@ -0,0 +1,174 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armsearch_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/search/armsearch" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/UpdatePrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrivateEndpointConnectionsClient().Update(ctx, "rg1", "mysearchservice", "testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546", armsearch.PrivateEndpointConnection{ + Properties: &armsearch.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &armsearch.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState{ + Description: to.Ptr("Rejected for some reason"), + Status: to.Ptr(armsearch.PrivateLinkServiceConnectionStatusRejected), + }, + }, + }, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PrivateEndpointConnection = armsearch.PrivateEndpointConnection{ + // Name: to.Ptr("testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546"), + // Type: to.Ptr("Microsoft.Search/searchServices/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice/privateEndpointConnections/testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546"), + // Properties: &armsearch.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armsearch.PrivateEndpointConnectionPropertiesPrivateEndpoint{ + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testEndpoint"), + // }, + // PrivateLinkServiceConnectionState: &armsearch.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState{ + // Description: to.Ptr("Rejected for some reason"), + // ActionsRequired: to.Ptr("None"), + // Status: to.Ptr(armsearch.PrivateLinkServiceConnectionStatusRejected), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/GetPrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "rg1", "mysearchservice", "testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PrivateEndpointConnection = armsearch.PrivateEndpointConnection{ + // Name: to.Ptr("testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546"), + // Type: to.Ptr("Microsoft.Search/searchServices/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice/privateEndpointConnections/testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546"), + // Properties: &armsearch.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armsearch.PrivateEndpointConnectionPropertiesPrivateEndpoint{ + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testEndpoint"), + // }, + // PrivateLinkServiceConnectionState: &armsearch.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState{ + // Description: to.Ptr(""), + // ActionsRequired: to.Ptr("None"), + // Status: to.Ptr(armsearch.PrivateLinkServiceConnectionStatusApproved), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/DeletePrivateEndpointConnection.json +func ExamplePrivateEndpointConnectionsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrivateEndpointConnectionsClient().Delete(ctx, "rg1", "mysearchservice", "testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PrivateEndpointConnection = armsearch.PrivateEndpointConnection{ + // Name: to.Ptr("testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546"), + // Type: to.Ptr("Microsoft.Search/searchServices/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice/privateEndpointConnections/testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546"), + // Properties: &armsearch.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armsearch.PrivateEndpointConnectionPropertiesPrivateEndpoint{ + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testEndpoint"), + // }, + // PrivateLinkServiceConnectionState: &armsearch.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState{ + // Description: to.Ptr(""), + // ActionsRequired: to.Ptr("None"), + // Status: to.Ptr(armsearch.PrivateLinkServiceConnectionStatusDisconnected), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/ListPrivateEndpointConnectionsByService.json +func ExamplePrivateEndpointConnectionsClient_NewListByServicePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListByServicePager("rg1", "mysearchservice", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, 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.PrivateEndpointConnectionListResult = armsearch.PrivateEndpointConnectionListResult{ + // Value: []*armsearch.PrivateEndpointConnection{ + // { + // Name: to.Ptr("testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546"), + // Type: to.Ptr("Microsoft.Search/searchServices/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice/privateEndpointConnections/testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546"), + // Properties: &armsearch.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armsearch.PrivateEndpointConnectionPropertiesPrivateEndpoint{ + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testEndpoint"), + // }, + // PrivateLinkServiceConnectionState: &armsearch.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState{ + // Description: to.Ptr(""), + // ActionsRequired: to.Ptr("None"), + // Status: to.Ptr(armsearch.PrivateLinkServiceConnectionStatusApproved), + // }, + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/search/armsearch/privatelinkresources_client.go similarity index 75% rename from sdk/resourcemanager/search/armsearch/zz_generated_privatelinkresources_client.go rename to sdk/resourcemanager/search/armsearch/privatelinkresources_client.go index 4ff36d1393a1..00f10e789b82 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/search/armsearch/privatelinkresources_client.go @@ -5,6 +5,7 @@ // 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 armsearch @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,46 +24,37 @@ import ( // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. // Don't use this type directly, use NewPrivateLinkResourcesClient() instead. type PrivateLinkResourcesClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -// subscriptionID - The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource -// Manager API or the portal. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".PrivateLinkResourcesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &PrivateLinkResourcesClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // NewListSupportedPager - Gets a list of all supported private link resource types for the given service. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 -// resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the -// Azure Resource Manager API or the portal. -// searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. -// SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get -// method. -// options - PrivateLinkResourcesClientListSupportedOptions contains the optional parameters for the PrivateLinkResourcesClient.ListSupported -// method. +// - resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the +// Azure Resource Manager API or the portal. +// - searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - PrivateLinkResourcesClientListSupportedOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListSupportedPager +// method. func (client *PrivateLinkResourcesClient) NewListSupportedPager(resourceGroupName string, searchServiceName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *PrivateLinkResourcesClientListSupportedOptions) *runtime.Pager[PrivateLinkResourcesClientListSupportedResponse] { return runtime.NewPager(runtime.PagingHandler[PrivateLinkResourcesClientListSupportedResponse]{ More: func(page PrivateLinkResourcesClientListSupportedResponse) bool { @@ -75,7 +65,7 @@ func (client *PrivateLinkResourcesClient) NewListSupportedPager(resourceGroupNam if err != nil { return PrivateLinkResourcesClientListSupportedResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkResourcesClientListSupportedResponse{}, err } @@ -102,7 +92,7 @@ func (client *PrivateLinkResourcesClient) listSupportedCreateRequest(ctx context return nil, errors.New("parameter searchServiceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{searchServiceName}", url.PathEscape(searchServiceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/search/armsearch/privatelinkresources_client_example_test.go b/sdk/resourcemanager/search/armsearch/privatelinkresources_client_example_test.go new file mode 100644 index 000000000000..2988e05241b4 --- /dev/null +++ b/sdk/resourcemanager/search/armsearch/privatelinkresources_client_example_test.go @@ -0,0 +1,115 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armsearch_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/ListSupportedPrivateLinkResources.json +func ExamplePrivateLinkResourcesClient_NewListSupportedPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPrivateLinkResourcesClient().NewListSupportedPager("rg1", "mysearchservice", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, 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.PrivateLinkResourcesResult = armsearch.PrivateLinkResourcesResult{ + // Value: []*armsearch.PrivateLinkResource{ + // { + // Name: to.Ptr("searchService"), + // Type: to.Ptr("Microsoft.Search/searchServices/privateLinkResources"), + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice/privateLinkResources/searchService"), + // Properties: &armsearch.PrivateLinkResourceProperties{ + // GroupID: to.Ptr("searchService"), + // RequiredMembers: []*string{ + // to.Ptr("searchService")}, + // RequiredZoneNames: []*string{ + // to.Ptr("privatelink.search.windows.net")}, + // ShareablePrivateLinkResourceTypes: []*armsearch.ShareablePrivateLinkResourceType{ + // { + // Name: to.Ptr("blob"), + // Properties: &armsearch.ShareablePrivateLinkResourceProperties{ + // Type: to.Ptr("Microsoft.Storage/storageAccounts"), + // Description: to.Ptr("Azure Cognitive Search indexers can connect to blobs in Azure Storage for reading data (data source), for writing intermediate results of indexer execution (annotation cache, preview) or for storing any knowledge store projections (preview)"), + // GroupID: to.Ptr("blob"), + // }, + // }, + // { + // Name: to.Ptr("table"), + // Properties: &armsearch.ShareablePrivateLinkResourceProperties{ + // Type: to.Ptr("Microsoft.Storage/storageAccounts"), + // Description: to.Ptr("Azure Cognitive Search indexers can connect to tables in Azure Storage for reading data (data source), for writing book-keeping information about intermediate results of indexer execution (annotation cache, preview) or for storing any knowledge store projections (preview)"), + // GroupID: to.Ptr("table"), + // }, + // }, + // { + // Name: to.Ptr("Sql"), + // Properties: &armsearch.ShareablePrivateLinkResourceProperties{ + // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts"), + // Description: to.Ptr("Azure Cognitive Search indexers can connect to CosmosDB using the SQL head for reading data (data source)."), + // GroupID: to.Ptr("Sql"), + // }, + // }, + // { + // Name: to.Ptr("plr"), + // Properties: &armsearch.ShareablePrivateLinkResourceProperties{ + // Type: to.Ptr("Microsoft.Sql/servers"), + // Description: to.Ptr("Azure Cognitive Search indexers can connect to AzureSQL databases in a SQL server for reading data (data source)."), + // GroupID: to.Ptr("sqlServer"), + // }, + // }, + // { + // Name: to.Ptr("vault"), + // Properties: &armsearch.ShareablePrivateLinkResourceProperties{ + // Type: to.Ptr("Microsoft.KeyVault/vaults"), + // Description: to.Ptr("Azure Cognitive Search can access keys in Azure Key Vault to encrypt search index and synonym map data"), + // GroupID: to.Ptr("vault"), + // }, + // }, + // { + // Name: to.Ptr("plr"), + // Properties: &armsearch.ShareablePrivateLinkResourceProperties{ + // Type: to.Ptr("Microsoft.DBforMySQL/servers"), + // Description: to.Ptr("Azure Cognitive Search indexers can connect to MySQL databases for reading data (data source, preview)."), + // GroupID: to.Ptr("mysqlServer"), + // }, + // }, + // { + // Name: to.Ptr("site"), + // Properties: &armsearch.ShareablePrivateLinkResourceProperties{ + // Type: to.Ptr("Microsoft.Web/sites"), + // Description: to.Ptr("Azure Cognitive Search indexers can connect to App Services when executing custom web api skills that can be present in a skillset (optional) attached to the indexer."), + // GroupID: to.Ptr("sites"), + // }, + // }}, + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_querykeys_client.go b/sdk/resourcemanager/search/armsearch/querykeys_client.go similarity index 78% rename from sdk/resourcemanager/search/armsearch/zz_generated_querykeys_client.go rename to sdk/resourcemanager/search/armsearch/querykeys_client.go index 30842402447e..715ff56b34fd 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_querykeys_client.go +++ b/sdk/resourcemanager/search/armsearch/querykeys_client.go @@ -5,6 +5,7 @@ // 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 armsearch @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,52 +24,44 @@ import ( // QueryKeysClient contains the methods for the QueryKeys group. // Don't use this type directly, use NewQueryKeysClient() instead. type QueryKeysClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewQueryKeysClient creates a new instance of QueryKeysClient with the specified values. -// subscriptionID - The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource -// Manager API or the portal. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewQueryKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*QueryKeysClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".QueryKeysClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &QueryKeysClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // Create - Generates a new query key for the specified search service. You can create up to 50 query keys per service. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 -// resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the -// Azure Resource Manager API or the portal. -// searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. -// name - The name of the new query API key. -// SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get -// method. -// options - QueryKeysClientCreateOptions contains the optional parameters for the QueryKeysClient.Create method. +// - resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the +// Azure Resource Manager API or the portal. +// - searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. +// - name - The name of the new query API key. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - QueryKeysClientCreateOptions contains the optional parameters for the QueryKeysClient.Create method. func (client *QueryKeysClient) Create(ctx context.Context, resourceGroupName string, searchServiceName string, name string, searchManagementRequestOptions *SearchManagementRequestOptions, options *QueryKeysClientCreateOptions) (QueryKeysClientCreateResponse, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, searchServiceName, name, searchManagementRequestOptions, options) if err != nil { return QueryKeysClientCreateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return QueryKeysClientCreateResponse{}, err } @@ -99,7 +90,7 @@ func (client *QueryKeysClient) createCreateRequest(ctx context.Context, resource 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -125,20 +116,21 @@ func (client *QueryKeysClient) createHandleResponse(resp *http.Response) (QueryK // Delete - Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating // a query key is to delete and then recreate it. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 -// resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the -// Azure Resource Manager API or the portal. -// searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. -// key - The query key to be deleted. Query keys are identified by value, not by name. -// SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get -// method. -// options - QueryKeysClientDeleteOptions contains the optional parameters for the QueryKeysClient.Delete method. +// - resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the +// Azure Resource Manager API or the portal. +// - searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. +// - key - The query key to be deleted. Query keys are identified by value, not by name. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - QueryKeysClientDeleteOptions contains the optional parameters for the QueryKeysClient.Delete method. func (client *QueryKeysClient) Delete(ctx context.Context, resourceGroupName string, searchServiceName string, key string, searchManagementRequestOptions *SearchManagementRequestOptions, options *QueryKeysClientDeleteOptions) (QueryKeysClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, searchServiceName, key, searchManagementRequestOptions, options) if err != nil { return QueryKeysClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return QueryKeysClientDeleteResponse{}, err } @@ -167,7 +159,7 @@ func (client *QueryKeysClient) deleteCreateRequest(ctx context.Context, resource 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.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -182,15 +174,15 @@ func (client *QueryKeysClient) deleteCreateRequest(ctx context.Context, resource } // NewListBySearchServicePager - Returns the list of query API keys for the given Azure Cognitive Search service. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 -// resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the -// Azure Resource Manager API or the portal. -// searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. -// SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get -// method. -// options - QueryKeysClientListBySearchServiceOptions contains the optional parameters for the QueryKeysClient.ListBySearchService -// method. +// - resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the +// Azure Resource Manager API or the portal. +// - searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - QueryKeysClientListBySearchServiceOptions contains the optional parameters for the QueryKeysClient.NewListBySearchServicePager +// method. func (client *QueryKeysClient) NewListBySearchServicePager(resourceGroupName string, searchServiceName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *QueryKeysClientListBySearchServiceOptions) *runtime.Pager[QueryKeysClientListBySearchServiceResponse] { return runtime.NewPager(runtime.PagingHandler[QueryKeysClientListBySearchServiceResponse]{ More: func(page QueryKeysClientListBySearchServiceResponse) bool { @@ -207,7 +199,7 @@ func (client *QueryKeysClient) NewListBySearchServicePager(resourceGroupName str if err != nil { return QueryKeysClientListBySearchServiceResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return QueryKeysClientListBySearchServiceResponse{}, err } @@ -234,7 +226,7 @@ func (client *QueryKeysClient) listBySearchServiceCreateRequest(ctx context.Cont 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/search/armsearch/querykeys_client_example_test.go b/sdk/resourcemanager/search/armsearch/querykeys_client_example_test.go new file mode 100644 index 000000000000..50f1bc95c1dd --- /dev/null +++ b/sdk/resourcemanager/search/armsearch/querykeys_client_example_test.go @@ -0,0 +1,95 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armsearch_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchCreateQueryKey.json +func ExampleQueryKeysClient_Create() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewQueryKeysClient().Create(ctx, "rg1", "mysearchservice", "Query key for browser-based clients", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.QueryKey = armsearch.QueryKey{ + // Name: to.Ptr("Query key for browser-based clients"), + // Key: to.Ptr(""), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchListQueryKeysBySearchService.json +func ExampleQueryKeysClient_NewListBySearchServicePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewQueryKeysClient().NewListBySearchServicePager("rg1", "mysearchservice", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, 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.ListQueryKeysResult = armsearch.ListQueryKeysResult{ + // Value: []*armsearch.QueryKey{ + // { + // Name: to.Ptr("Query key for browser-based clients"), + // Key: to.Ptr(""), + // }, + // { + // Name: to.Ptr("Query key for mobile clients"), + // Key: to.Ptr(""), + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchDeleteQueryKey.json +func ExampleQueryKeysClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewQueryKeysClient().Delete(ctx, "rg1", "mysearchservice", "", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_response_types.go b/sdk/resourcemanager/search/armsearch/response_types.go similarity index 85% rename from sdk/resourcemanager/search/armsearch/zz_generated_response_types.go rename to sdk/resourcemanager/search/armsearch/response_types.go index 228fb6e48b10..f2925a184ccc 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_response_types.go +++ b/sdk/resourcemanager/search/armsearch/response_types.go @@ -5,6 +5,7 @@ // 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 armsearch @@ -18,7 +19,7 @@ type AdminKeysClientRegenerateResponse struct { AdminKeyResult } -// OperationsClientListResponse contains the response from method OperationsClient.List. +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { OperationListResult } @@ -33,7 +34,7 @@ type PrivateEndpointConnectionsClientGetResponse struct { PrivateEndpointConnection } -// PrivateEndpointConnectionsClientListByServiceResponse contains the response from method PrivateEndpointConnectionsClient.ListByService. +// PrivateEndpointConnectionsClientListByServiceResponse contains the response from method PrivateEndpointConnectionsClient.NewListByServicePager. type PrivateEndpointConnectionsClientListByServiceResponse struct { PrivateEndpointConnectionListResult } @@ -43,7 +44,7 @@ type PrivateEndpointConnectionsClientUpdateResponse struct { PrivateEndpointConnection } -// PrivateLinkResourcesClientListSupportedResponse contains the response from method PrivateLinkResourcesClient.ListSupported. +// PrivateLinkResourcesClientListSupportedResponse contains the response from method PrivateLinkResourcesClient.NewListSupportedPager. type PrivateLinkResourcesClientListSupportedResponse struct { PrivateLinkResourcesResult } @@ -58,7 +59,7 @@ type QueryKeysClientDeleteResponse struct { // placeholder for future response values } -// QueryKeysClientListBySearchServiceResponse contains the response from method QueryKeysClient.ListBySearchService. +// QueryKeysClientListBySearchServiceResponse contains the response from method QueryKeysClient.NewListBySearchServicePager. type QueryKeysClientListBySearchServiceResponse struct { ListQueryKeysResult } @@ -68,7 +69,7 @@ type ServicesClientCheckNameAvailabilityResponse struct { CheckNameAvailabilityOutput } -// ServicesClientCreateOrUpdateResponse contains the response from method ServicesClient.CreateOrUpdate. +// ServicesClientCreateOrUpdateResponse contains the response from method ServicesClient.BeginCreateOrUpdate. type ServicesClientCreateOrUpdateResponse struct { Service } @@ -83,12 +84,12 @@ type ServicesClientGetResponse struct { Service } -// ServicesClientListByResourceGroupResponse contains the response from method ServicesClient.ListByResourceGroup. +// ServicesClientListByResourceGroupResponse contains the response from method ServicesClient.NewListByResourceGroupPager. type ServicesClientListByResourceGroupResponse struct { ServiceListResult } -// ServicesClientListBySubscriptionResponse contains the response from method ServicesClient.ListBySubscription. +// ServicesClientListBySubscriptionResponse contains the response from method ServicesClient.NewListBySubscriptionPager. type ServicesClientListBySubscriptionResponse struct { ServiceListResult } @@ -98,12 +99,12 @@ type ServicesClientUpdateResponse struct { Service } -// SharedPrivateLinkResourcesClientCreateOrUpdateResponse contains the response from method SharedPrivateLinkResourcesClient.CreateOrUpdate. +// SharedPrivateLinkResourcesClientCreateOrUpdateResponse contains the response from method SharedPrivateLinkResourcesClient.BeginCreateOrUpdate. type SharedPrivateLinkResourcesClientCreateOrUpdateResponse struct { SharedPrivateLinkResource } -// SharedPrivateLinkResourcesClientDeleteResponse contains the response from method SharedPrivateLinkResourcesClient.Delete. +// SharedPrivateLinkResourcesClientDeleteResponse contains the response from method SharedPrivateLinkResourcesClient.BeginDelete. type SharedPrivateLinkResourcesClientDeleteResponse struct { // placeholder for future response values } @@ -113,7 +114,7 @@ type SharedPrivateLinkResourcesClientGetResponse struct { SharedPrivateLinkResource } -// SharedPrivateLinkResourcesClientListByServiceResponse contains the response from method SharedPrivateLinkResourcesClient.ListByService. +// SharedPrivateLinkResourcesClientListByServiceResponse contains the response from method SharedPrivateLinkResourcesClient.NewListByServicePager. type SharedPrivateLinkResourcesClientListByServiceResponse struct { SharedPrivateLinkResourceListResult } diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_services_client.go b/sdk/resourcemanager/search/armsearch/services_client.go similarity index 80% rename from sdk/resourcemanager/search/armsearch/zz_generated_services_client.go rename to sdk/resourcemanager/search/armsearch/services_client.go index aeacb32522e9..1e433c939a5f 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_services_client.go +++ b/sdk/resourcemanager/search/armsearch/services_client.go @@ -5,6 +5,7 @@ // 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 armsearch @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,32 +24,23 @@ import ( // ServicesClient contains the methods for the Services group. // Don't use this type directly, use NewServicesClient() instead. type ServicesClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewServicesClient creates a new instance of ServicesClient with the specified values. -// subscriptionID - The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource -// Manager API or the portal. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServicesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".ServicesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ServicesClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } @@ -58,18 +48,19 @@ func NewServicesClient(subscriptionID string, credential azcore.TokenCredential, // CheckNameAvailability - Checks whether or not the given search service name is available for use. Search service names // must be globally unique since they are part of the service URI (https://.search.windows.net). // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 -// checkNameAvailabilityInput - The resource name and type to check. -// SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get -// method. -// options - ServicesClientCheckNameAvailabilityOptions contains the optional parameters for the ServicesClient.CheckNameAvailability -// method. +// - checkNameAvailabilityInput - The resource name and type to check. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - ServicesClientCheckNameAvailabilityOptions contains the optional parameters for the ServicesClient.CheckNameAvailability +// method. func (client *ServicesClient) CheckNameAvailability(ctx context.Context, checkNameAvailabilityInput CheckNameAvailabilityInput, searchManagementRequestOptions *SearchManagementRequestOptions, options *ServicesClientCheckNameAvailabilityOptions) (ServicesClientCheckNameAvailabilityResponse, error) { req, err := client.checkNameAvailabilityCreateRequest(ctx, checkNameAvailabilityInput, searchManagementRequestOptions, options) if err != nil { return ServicesClientCheckNameAvailabilityResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ServicesClientCheckNameAvailabilityResponse{}, err } @@ -86,7 +77,7 @@ func (client *ServicesClient) checkNameAvailabilityCreateRequest(ctx context.Con 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -112,41 +103,43 @@ func (client *ServicesClient) checkNameAvailabilityHandleResponse(resp *http.Res // BeginCreateOrUpdate - Creates or updates a search service in the given resource group. If the search service already exists, // all properties will be updated with the given values. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 -// resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the -// Azure Resource Manager API or the portal. -// searchServiceName - The name of the Azure Cognitive Search service to create or update. Search service names must only -// contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, -// cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally -// unique since they are part of the service URI (https://.search.windows.net). -// You cannot change the service name after the service is created. -// service - The definition of the search service to create or update. -// SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get -// method. -// options - ServicesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServicesClient.BeginCreateOrUpdate -// method. +// - resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the +// Azure Resource Manager API or the portal. +// - searchServiceName - The name of the Azure Cognitive Search service to create or update. Search service names must only +// contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, +// cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally +// unique since they are part of the service URI (https://.search.windows.net). +// You cannot change the service name after the service is created. +// - service - The definition of the search service to create or update. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - ServicesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServicesClient.BeginCreateOrUpdate +// method. func (client *ServicesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, searchServiceName string, service Service, searchManagementRequestOptions *SearchManagementRequestOptions, options *ServicesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ServicesClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, searchServiceName, service, searchManagementRequestOptions, options) if err != nil { return nil, err } - return runtime.NewPoller[ServicesClientCreateOrUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller[ServicesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ServicesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ServicesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // CreateOrUpdate - Creates or updates a search service in the given resource group. If the search service already exists, // all properties will be updated with the given values. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 func (client *ServicesClient) createOrUpdate(ctx context.Context, resourceGroupName string, searchServiceName string, service Service, searchManagementRequestOptions *SearchManagementRequestOptions, options *ServicesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, searchServiceName, service, searchManagementRequestOptions, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -171,7 +164,7 @@ func (client *ServicesClient) createOrUpdateCreateRequest(ctx context.Context, r 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.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -187,19 +180,20 @@ func (client *ServicesClient) createOrUpdateCreateRequest(ctx context.Context, r // Delete - Deletes a search service in the given resource group, along with its associated resources. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 -// resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the -// Azure Resource Manager API or the portal. -// searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. -// SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get -// method. -// options - ServicesClientDeleteOptions contains the optional parameters for the ServicesClient.Delete method. +// - resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the +// Azure Resource Manager API or the portal. +// - searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - ServicesClientDeleteOptions contains the optional parameters for the ServicesClient.Delete method. func (client *ServicesClient) Delete(ctx context.Context, resourceGroupName string, searchServiceName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *ServicesClientDeleteOptions) (ServicesClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, searchServiceName, searchManagementRequestOptions, options) if err != nil { return ServicesClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ServicesClientDeleteResponse{}, err } @@ -224,7 +218,7 @@ func (client *ServicesClient) deleteCreateRequest(ctx context.Context, resourceG 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.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -240,19 +234,20 @@ func (client *ServicesClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Gets the search service with the given name in the given resource group. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 -// resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the -// Azure Resource Manager API or the portal. -// searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. -// SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get -// method. -// options - ServicesClientGetOptions contains the optional parameters for the ServicesClient.Get method. +// - resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the +// Azure Resource Manager API or the portal. +// - searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - ServicesClientGetOptions contains the optional parameters for the ServicesClient.Get method. func (client *ServicesClient) Get(ctx context.Context, resourceGroupName string, searchServiceName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *ServicesClientGetOptions) (ServicesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, searchServiceName, searchManagementRequestOptions, options) if err != nil { return ServicesClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ServicesClientGetResponse{}, err } @@ -277,7 +272,7 @@ func (client *ServicesClient) getCreateRequest(ctx context.Context, resourceGrou 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -301,14 +296,14 @@ func (client *ServicesClient) getHandleResponse(resp *http.Response) (ServicesCl } // NewListByResourceGroupPager - Gets a list of all search services in the given resource group. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 -// resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the -// Azure Resource Manager API or the portal. -// SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get -// method. -// options - ServicesClientListByResourceGroupOptions contains the optional parameters for the ServicesClient.ListByResourceGroup -// method. +// - resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the +// Azure Resource Manager API or the portal. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - ServicesClientListByResourceGroupOptions contains the optional parameters for the ServicesClient.NewListByResourceGroupPager +// method. func (client *ServicesClient) NewListByResourceGroupPager(resourceGroupName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *ServicesClientListByResourceGroupOptions) *runtime.Pager[ServicesClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[ServicesClientListByResourceGroupResponse]{ More: func(page ServicesClientListByResourceGroupResponse) bool { @@ -325,7 +320,7 @@ func (client *ServicesClient) NewListByResourceGroupPager(resourceGroupName stri if err != nil { return ServicesClientListByResourceGroupResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ServicesClientListByResourceGroupResponse{}, err } @@ -348,7 +343,7 @@ func (client *ServicesClient) listByResourceGroupCreateRequest(ctx context.Conte 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -372,12 +367,12 @@ func (client *ServicesClient) listByResourceGroupHandleResponse(resp *http.Respo } // NewListBySubscriptionPager - Gets a list of all search services in the given subscription. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 -// SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get -// method. -// options - ServicesClientListBySubscriptionOptions contains the optional parameters for the ServicesClient.ListBySubscription -// method. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - ServicesClientListBySubscriptionOptions contains the optional parameters for the ServicesClient.NewListBySubscriptionPager +// method. func (client *ServicesClient) NewListBySubscriptionPager(searchManagementRequestOptions *SearchManagementRequestOptions, options *ServicesClientListBySubscriptionOptions) *runtime.Pager[ServicesClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[ServicesClientListBySubscriptionResponse]{ More: func(page ServicesClientListBySubscriptionResponse) bool { @@ -394,7 +389,7 @@ func (client *ServicesClient) NewListBySubscriptionPager(searchManagementRequest if err != nil { return ServicesClientListBySubscriptionResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ServicesClientListBySubscriptionResponse{}, err } @@ -413,7 +408,7 @@ func (client *ServicesClient) listBySubscriptionCreateRequest(ctx context.Contex 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -438,20 +433,21 @@ func (client *ServicesClient) listBySubscriptionHandleResponse(resp *http.Respon // Update - Updates an existing search service in the given resource group. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 -// resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the -// Azure Resource Manager API or the portal. -// searchServiceName - The name of the Azure Cognitive Search service to update. -// service - The definition of the search service to update. -// SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get -// method. -// options - ServicesClientUpdateOptions contains the optional parameters for the ServicesClient.Update method. +// - resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the +// Azure Resource Manager API or the portal. +// - searchServiceName - The name of the Azure Cognitive Search service to update. +// - service - The definition of the search service to update. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - ServicesClientUpdateOptions contains the optional parameters for the ServicesClient.Update method. func (client *ServicesClient) Update(ctx context.Context, resourceGroupName string, searchServiceName string, service ServiceUpdate, searchManagementRequestOptions *SearchManagementRequestOptions, options *ServicesClientUpdateOptions) (ServicesClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, searchServiceName, service, searchManagementRequestOptions, options) if err != nil { return ServicesClientUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ServicesClientUpdateResponse{}, err } @@ -476,7 +472,7 @@ func (client *ServicesClient) updateCreateRequest(ctx context.Context, resourceG 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.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/search/armsearch/services_client_example_test.go b/sdk/resourcemanager/search/armsearch/services_client_example_test.go new file mode 100644 index 000000000000..f6818f7fbb0e --- /dev/null +++ b/sdk/resourcemanager/search/armsearch/services_client_example_test.go @@ -0,0 +1,785 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armsearch_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/search/armsearch" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchCreateOrUpdateService.json +func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateService() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "rg1", "mysearchservice", armsearch.Service{ + Location: to.Ptr("westus"), + Tags: map[string]*string{ + "app-name": to.Ptr("My e-commerce app"), + }, + Properties: &armsearch.ServiceProperties{ + HostingMode: to.Ptr(armsearch.HostingModeDefault), + PartitionCount: to.Ptr[int32](1), + ReplicaCount: to.Ptr[int32](3), + }, + SKU: &armsearch.SKU{ + Name: to.Ptr(armsearch.SKUNameStandard), + }, + }, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, 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.Service = armsearch.Service{ + // Name: to.Ptr("mysearchservice"), + // Type: to.Ptr("Microsoft.Search/searchServices"), + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "app-name": to.Ptr("My e-commerce app"), + // }, + // Properties: &armsearch.ServiceProperties{ + // HostingMode: to.Ptr(armsearch.HostingModeDefault), + // NetworkRuleSet: &armsearch.NetworkRuleSet{ + // IPRules: []*armsearch.IPRule{ + // }, + // }, + // PartitionCount: to.Ptr[int32](1), + // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ + // }, + // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), + // ReplicaCount: to.Ptr[int32](3), + // Status: to.Ptr(armsearch.SearchServiceStatusProvisioning), + // StatusDetails: to.Ptr(""), + // }, + // SKU: &armsearch.SKU{ + // Name: to.Ptr(armsearch.SKUNameStandard), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json +func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "rg1", "mysearchservice", armsearch.Service{ + Location: to.Ptr("westus"), + Tags: map[string]*string{ + "app-name": to.Ptr("My e-commerce app"), + }, + Properties: &armsearch.ServiceProperties{ + HostingMode: to.Ptr(armsearch.HostingModeDefault), + PartitionCount: to.Ptr[int32](1), + PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessDisabled), + ReplicaCount: to.Ptr[int32](3), + }, + SKU: &armsearch.SKU{ + Name: to.Ptr(armsearch.SKUNameStandard), + }, + }, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, 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.Service = armsearch.Service{ + // Name: to.Ptr("mysearchservice"), + // Type: to.Ptr("Microsoft.Search/searchServices"), + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "app-name": to.Ptr("My e-commerce app"), + // }, + // Properties: &armsearch.ServiceProperties{ + // HostingMode: to.Ptr(armsearch.HostingModeDefault), + // NetworkRuleSet: &armsearch.NetworkRuleSet{ + // IPRules: []*armsearch.IPRule{ + // }, + // }, + // PartitionCount: to.Ptr[int32](1), + // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ + // }, + // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessDisabled), + // ReplicaCount: to.Ptr[int32](3), + // Status: to.Ptr(armsearch.SearchServiceStatusProvisioning), + // StatusDetails: to.Ptr(""), + // }, + // SKU: &armsearch.SKU{ + // Name: to.Ptr(armsearch.SKUNameStandard), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json +func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "rg1", "mysearchservice", armsearch.Service{ + Location: to.Ptr("westus"), + Tags: map[string]*string{ + "app-name": to.Ptr("My e-commerce app"), + }, + Properties: &armsearch.ServiceProperties{ + HostingMode: to.Ptr(armsearch.HostingModeDefault), + NetworkRuleSet: &armsearch.NetworkRuleSet{ + IPRules: []*armsearch.IPRule{ + { + Value: to.Ptr("123.4.5.6"), + }, + { + Value: to.Ptr("123.4.6.0/18"), + }}, + }, + PartitionCount: to.Ptr[int32](1), + ReplicaCount: to.Ptr[int32](1), + }, + SKU: &armsearch.SKU{ + Name: to.Ptr(armsearch.SKUNameStandard), + }, + }, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, 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.Service = armsearch.Service{ + // Name: to.Ptr("mysearchservice"), + // Type: to.Ptr("Microsoft.Search/searchServices"), + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "app-name": to.Ptr("My e-commerce app"), + // }, + // Properties: &armsearch.ServiceProperties{ + // HostingMode: to.Ptr(armsearch.HostingModeDefault), + // NetworkRuleSet: &armsearch.NetworkRuleSet{ + // IPRules: []*armsearch.IPRule{ + // { + // Value: to.Ptr("123.4.5.6"), + // }, + // { + // Value: to.Ptr("123.4.6.0/18"), + // }}, + // }, + // PartitionCount: to.Ptr[int32](1), + // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ + // }, + // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), + // ReplicaCount: to.Ptr[int32](1), + // Status: to.Ptr(armsearch.SearchServiceStatusProvisioning), + // StatusDetails: to.Ptr(""), + // }, + // SKU: &armsearch.SKU{ + // Name: to.Ptr(armsearch.SKUNameStandard), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchCreateOrUpdateServiceWithIdentity.json +func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateServiceWithIdentity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "rg1", "mysearchservice", armsearch.Service{ + Location: to.Ptr("westus"), + Tags: map[string]*string{ + "app-name": to.Ptr("My e-commerce app"), + }, + Identity: &armsearch.Identity{ + Type: to.Ptr(armsearch.IdentityTypeSystemAssigned), + }, + Properties: &armsearch.ServiceProperties{ + HostingMode: to.Ptr(armsearch.HostingModeDefault), + PartitionCount: to.Ptr[int32](1), + ReplicaCount: to.Ptr[int32](3), + }, + SKU: &armsearch.SKU{ + Name: to.Ptr(armsearch.SKUNameStandard), + }, + }, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, 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.Service = armsearch.Service{ + // Name: to.Ptr("mysearchservice"), + // Type: to.Ptr("Microsoft.Search/searchServices"), + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "app-name": to.Ptr("My e-commerce app"), + // }, + // Identity: &armsearch.Identity{ + // Type: to.Ptr(armsearch.IdentityTypeSystemAssigned), + // PrincipalID: to.Ptr("9d1e1f18-2122-4988-a11c-878782e40a5c"), + // TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"), + // }, + // Properties: &armsearch.ServiceProperties{ + // HostingMode: to.Ptr(armsearch.HostingModeDefault), + // NetworkRuleSet: &armsearch.NetworkRuleSet{ + // IPRules: []*armsearch.IPRule{ + // }, + // }, + // PartitionCount: to.Ptr[int32](1), + // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ + // }, + // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), + // ReplicaCount: to.Ptr[int32](3), + // Status: to.Ptr(armsearch.SearchServiceStatusProvisioning), + // StatusDetails: to.Ptr(""), + // }, + // SKU: &armsearch.SKU{ + // Name: to.Ptr(armsearch.SKUNameStandard), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchUpdateService.json +func ExampleServicesClient_Update_searchUpdateService() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewServicesClient().Update(ctx, "rg1", "mysearchservice", armsearch.ServiceUpdate{ + Properties: &armsearch.ServiceProperties{ + ReplicaCount: to.Ptr[int32](2), + }, + Tags: map[string]*string{ + "app-name": to.Ptr("My e-commerce app"), + "new-tag": to.Ptr("Adding a new tag"), + }, + }, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Service = armsearch.Service{ + // Name: to.Ptr("mysearchservice"), + // Type: to.Ptr("Microsoft.Search/searchServices"), + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "app-name": to.Ptr("My e-commerce app"), + // "new-tag": to.Ptr("Adding a new tag"), + // }, + // Properties: &armsearch.ServiceProperties{ + // HostingMode: to.Ptr(armsearch.HostingModeDefault), + // NetworkRuleSet: &armsearch.NetworkRuleSet{ + // IPRules: []*armsearch.IPRule{ + // }, + // }, + // PartitionCount: to.Ptr[int32](1), + // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ + // }, + // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), + // ReplicaCount: to.Ptr[int32](2), + // Status: to.Ptr(armsearch.SearchServiceStatusProvisioning), + // StatusDetails: to.Ptr(""), + // }, + // SKU: &armsearch.SKU{ + // Name: to.Ptr(armsearch.SKUNameStandard), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchUpdateServiceToRemoveIdentity.json +func ExampleServicesClient_Update_searchUpdateServiceToRemoveIdentity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewServicesClient().Update(ctx, "rg1", "mysearchservice", armsearch.ServiceUpdate{ + Identity: &armsearch.Identity{ + Type: to.Ptr(armsearch.IdentityTypeNone), + }, + SKU: &armsearch.SKU{ + Name: to.Ptr(armsearch.SKUNameStandard), + }, + }, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Service = armsearch.Service{ + // Name: to.Ptr("mysearchservice"), + // Type: to.Ptr("Microsoft.Search/searchServices"), + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // }, + // Identity: &armsearch.Identity{ + // Type: to.Ptr(armsearch.IdentityTypeNone), + // }, + // Properties: &armsearch.ServiceProperties{ + // HostingMode: to.Ptr(armsearch.HostingModeDefault), + // NetworkRuleSet: &armsearch.NetworkRuleSet{ + // IPRules: []*armsearch.IPRule{ + // }, + // }, + // PartitionCount: to.Ptr[int32](1), + // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ + // }, + // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), + // ReplicaCount: to.Ptr[int32](3), + // Status: to.Ptr(armsearch.SearchServiceStatusRunning), + // StatusDetails: to.Ptr(""), + // }, + // SKU: &armsearch.SKU{ + // Name: to.Ptr(armsearch.SKUNameStandard), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchUpdateServiceToAllowAccessFromPrivateEndpoints.json +func ExampleServicesClient_Update_searchUpdateServiceToAllowAccessFromPrivateEndpoints() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewServicesClient().Update(ctx, "rg1", "mysearchservice", armsearch.ServiceUpdate{ + Properties: &armsearch.ServiceProperties{ + PartitionCount: to.Ptr[int32](1), + PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessDisabled), + ReplicaCount: to.Ptr[int32](1), + }, + }, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Service = armsearch.Service{ + // Name: to.Ptr("mysearchservice"), + // Type: to.Ptr("Microsoft.Search/searchServices"), + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "app-name": to.Ptr("My e-commerce app"), + // "new-tag": to.Ptr("Adding a new tag"), + // }, + // Properties: &armsearch.ServiceProperties{ + // HostingMode: to.Ptr(armsearch.HostingModeDefault), + // NetworkRuleSet: &armsearch.NetworkRuleSet{ + // IPRules: []*armsearch.IPRule{ + // }, + // }, + // PartitionCount: to.Ptr[int32](1), + // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ + // }, + // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessDisabled), + // ReplicaCount: to.Ptr[int32](1), + // Status: to.Ptr(armsearch.SearchServiceStatusRunning), + // StatusDetails: to.Ptr(""), + // }, + // SKU: &armsearch.SKU{ + // Name: to.Ptr(armsearch.SKUNameBasic), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchUpdateServiceToAllowAccessFromPublicCustomIPs.json +func ExampleServicesClient_Update_searchUpdateServiceToAllowAccessFromPublicCustomIPs() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewServicesClient().Update(ctx, "rg1", "mysearchservice", armsearch.ServiceUpdate{ + Properties: &armsearch.ServiceProperties{ + NetworkRuleSet: &armsearch.NetworkRuleSet{ + IPRules: []*armsearch.IPRule{ + { + Value: to.Ptr("123.4.5.6"), + }, + { + Value: to.Ptr("123.4.6.0/18"), + }}, + }, + PartitionCount: to.Ptr[int32](1), + PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), + ReplicaCount: to.Ptr[int32](3), + }, + }, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Service = armsearch.Service{ + // Name: to.Ptr("mysearchservice"), + // Type: to.Ptr("Microsoft.Search/searchServices"), + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "app-name": to.Ptr("My e-commerce app"), + // "new-tag": to.Ptr("Adding a new tag"), + // }, + // Properties: &armsearch.ServiceProperties{ + // HostingMode: to.Ptr(armsearch.HostingModeDefault), + // NetworkRuleSet: &armsearch.NetworkRuleSet{ + // IPRules: []*armsearch.IPRule{ + // { + // Value: to.Ptr("10.2.3.4"), + // }}, + // }, + // PartitionCount: to.Ptr[int32](1), + // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ + // }, + // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), + // ReplicaCount: to.Ptr[int32](3), + // Status: to.Ptr(armsearch.SearchServiceStatusRunning), + // StatusDetails: to.Ptr(""), + // }, + // SKU: &armsearch.SKU{ + // Name: to.Ptr(armsearch.SKUNameStandard), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchGetService.json +func ExampleServicesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewServicesClient().Get(ctx, "rg1", "mysearchservice", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Service = armsearch.Service{ + // Name: to.Ptr("mysearchservice"), + // Type: to.Ptr("Microsoft.Search/searchServices"), + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "app-name": to.Ptr("My e-commerce app"), + // }, + // Properties: &armsearch.ServiceProperties{ + // HostingMode: to.Ptr(armsearch.HostingModeDefault), + // NetworkRuleSet: &armsearch.NetworkRuleSet{ + // IPRules: []*armsearch.IPRule{ + // }, + // }, + // PartitionCount: to.Ptr[int32](1), + // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ + // }, + // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), + // ReplicaCount: to.Ptr[int32](3), + // Status: to.Ptr(armsearch.SearchServiceStatusRunning), + // StatusDetails: to.Ptr(""), + // }, + // SKU: &armsearch.SKU{ + // Name: to.Ptr(armsearch.SKUNameStandard), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchDeleteService.json +func ExampleServicesClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewServicesClient().Delete(ctx, "rg1", "mysearchservice", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchListServicesByResourceGroup.json +func ExampleServicesClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewServicesClient().NewListByResourceGroupPager("rg1", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, 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.ServiceListResult = armsearch.ServiceListResult{ + // Value: []*armsearch.Service{ + // { + // Name: to.Ptr("mysearchservice"), + // Type: to.Ptr("Microsoft.Search/searchServices"), + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "app-name": to.Ptr("My e-commerce app"), + // }, + // Properties: &armsearch.ServiceProperties{ + // HostingMode: to.Ptr(armsearch.HostingModeDefault), + // NetworkRuleSet: &armsearch.NetworkRuleSet{ + // IPRules: []*armsearch.IPRule{ + // }, + // }, + // PartitionCount: to.Ptr[int32](1), + // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ + // }, + // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), + // ReplicaCount: to.Ptr[int32](3), + // Status: to.Ptr(armsearch.SearchServiceStatusRunning), + // StatusDetails: to.Ptr(""), + // }, + // SKU: &armsearch.SKU{ + // Name: to.Ptr(armsearch.SKUNameStandard), + // }, + // }, + // { + // Name: to.Ptr("mysearchservice2"), + // Type: to.Ptr("Microsoft.Search/searchServices"), + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice2"), + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "app-name": to.Ptr("My e-commerce app"), + // }, + // Properties: &armsearch.ServiceProperties{ + // HostingMode: to.Ptr(armsearch.HostingModeDefault), + // NetworkRuleSet: &armsearch.NetworkRuleSet{ + // IPRules: []*armsearch.IPRule{ + // }, + // }, + // PartitionCount: to.Ptr[int32](1), + // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ + // }, + // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), + // ReplicaCount: to.Ptr[int32](1), + // Status: to.Ptr(armsearch.SearchServiceStatusRunning), + // StatusDetails: to.Ptr(""), + // }, + // SKU: &armsearch.SKU{ + // Name: to.Ptr(armsearch.SKUNameBasic), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchListServicesBySubscription.json +func ExampleServicesClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewServicesClient().NewListBySubscriptionPager(&armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, 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.ServiceListResult = armsearch.ServiceListResult{ + // Value: []*armsearch.Service{ + // { + // Name: to.Ptr("mysearchservice"), + // Type: to.Ptr("Microsoft.Search/searchServices"), + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"), + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "app-name": to.Ptr("My e-commerce app"), + // }, + // Properties: &armsearch.ServiceProperties{ + // HostingMode: to.Ptr(armsearch.HostingModeDefault), + // NetworkRuleSet: &armsearch.NetworkRuleSet{ + // IPRules: []*armsearch.IPRule{ + // }, + // }, + // PartitionCount: to.Ptr[int32](1), + // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ + // }, + // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), + // ReplicaCount: to.Ptr[int32](3), + // Status: to.Ptr(armsearch.SearchServiceStatusRunning), + // StatusDetails: to.Ptr(""), + // }, + // SKU: &armsearch.SKU{ + // Name: to.Ptr(armsearch.SKUNameStandard), + // }, + // }, + // { + // Name: to.Ptr("mysearchservice2"), + // Type: to.Ptr("Microsoft.Search/searchServices"), + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Search/searchServices/mysearchservice2"), + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "app-name": to.Ptr("My e-commerce app"), + // }, + // Properties: &armsearch.ServiceProperties{ + // HostingMode: to.Ptr(armsearch.HostingModeDefault), + // NetworkRuleSet: &armsearch.NetworkRuleSet{ + // IPRules: []*armsearch.IPRule{ + // }, + // }, + // PartitionCount: to.Ptr[int32](1), + // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ + // }, + // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), + // ReplicaCount: to.Ptr[int32](1), + // Status: to.Ptr(armsearch.SearchServiceStatusRunning), + // StatusDetails: to.Ptr(""), + // }, + // SKU: &armsearch.SKU{ + // Name: to.Ptr(armsearch.SKUNameBasic), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchCheckNameAvailability.json +func ExampleServicesClient_CheckNameAvailability() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewServicesClient().CheckNameAvailability(ctx, armsearch.CheckNameAvailabilityInput{ + Name: to.Ptr("mysearchservice"), + Type: to.Ptr("searchServices"), + }, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.CheckNameAvailabilityOutput = armsearch.CheckNameAvailabilityOutput{ + // Message: to.Ptr(""), + // IsNameAvailable: to.Ptr(false), + // Reason: to.Ptr(armsearch.UnavailableNameReasonAlreadyExists), + // } +} diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_sharedprivatelinkresources_client.go b/sdk/resourcemanager/search/armsearch/sharedprivatelinkresources_client.go similarity index 78% rename from sdk/resourcemanager/search/armsearch/zz_generated_sharedprivatelinkresources_client.go rename to sdk/resourcemanager/search/armsearch/sharedprivatelinkresources_client.go index 18effa1a45fa..17a1d0c90d5c 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_sharedprivatelinkresources_client.go +++ b/sdk/resourcemanager/search/armsearch/sharedprivatelinkresources_client.go @@ -5,6 +5,7 @@ // 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 armsearch @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,32 +24,23 @@ import ( // SharedPrivateLinkResourcesClient contains the methods for the SharedPrivateLinkResources group. // Don't use this type directly, use NewSharedPrivateLinkResourcesClient() instead. type SharedPrivateLinkResourcesClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewSharedPrivateLinkResourcesClient creates a new instance of SharedPrivateLinkResourcesClient with the specified values. -// subscriptionID - The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource -// Manager API or the portal. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewSharedPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SharedPrivateLinkResourcesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".SharedPrivateLinkResourcesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &SharedPrivateLinkResourcesClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } @@ -58,41 +48,43 @@ func NewSharedPrivateLinkResourcesClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Initiates the creation or update of a shared private link resource managed by the search service // in the given resource group. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 -// resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the -// Azure Resource Manager API or the portal. -// searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. -// sharedPrivateLinkResourceName - The name of the shared private link resource managed by the Azure Cognitive Search service -// within the specified resource group. -// sharedPrivateLinkResource - The definition of the shared private link resource to create or update. -// SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get -// method. -// options - SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginCreateOrUpdate -// method. +// - resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the +// Azure Resource Manager API or the portal. +// - searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. +// - sharedPrivateLinkResourceName - The name of the shared private link resource managed by the Azure Cognitive Search service +// within the specified resource group. +// - sharedPrivateLinkResource - The definition of the shared private link resource to create or update. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginCreateOrUpdate +// method. func (client *SharedPrivateLinkResourcesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, searchServiceName string, sharedPrivateLinkResourceName string, sharedPrivateLinkResource SharedPrivateLinkResource, searchManagementRequestOptions *SearchManagementRequestOptions, options *SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions) (*runtime.Poller[SharedPrivateLinkResourcesClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, sharedPrivateLinkResource, searchManagementRequestOptions, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SharedPrivateLinkResourcesClientCreateOrUpdateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SharedPrivateLinkResourcesClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[SharedPrivateLinkResourcesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[SharedPrivateLinkResourcesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // CreateOrUpdate - Initiates the creation or update of a shared private link resource managed by the search service in the // given resource group. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 func (client *SharedPrivateLinkResourcesClient) createOrUpdate(ctx context.Context, resourceGroupName string, searchServiceName string, sharedPrivateLinkResourceName string, sharedPrivateLinkResource SharedPrivateLinkResource, searchManagementRequestOptions *SearchManagementRequestOptions, options *SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, sharedPrivateLinkResource, searchManagementRequestOptions, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -121,7 +113,7 @@ func (client *SharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx 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.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -137,39 +129,41 @@ func (client *SharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx // BeginDelete - Initiates the deletion of the shared private link resource from the search service. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 -// resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the -// Azure Resource Manager API or the portal. -// searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. -// sharedPrivateLinkResourceName - The name of the shared private link resource managed by the Azure Cognitive Search service -// within the specified resource group. -// SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get -// method. -// options - SharedPrivateLinkResourcesClientBeginDeleteOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginDelete -// method. +// - resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the +// Azure Resource Manager API or the portal. +// - searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. +// - sharedPrivateLinkResourceName - The name of the shared private link resource managed by the Azure Cognitive Search service +// within the specified resource group. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - SharedPrivateLinkResourcesClientBeginDeleteOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginDelete +// method. func (client *SharedPrivateLinkResourcesClient) BeginDelete(ctx context.Context, resourceGroupName string, searchServiceName string, sharedPrivateLinkResourceName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *SharedPrivateLinkResourcesClientBeginDeleteOptions) (*runtime.Poller[SharedPrivateLinkResourcesClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, searchManagementRequestOptions, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SharedPrivateLinkResourcesClientDeleteResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SharedPrivateLinkResourcesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[SharedPrivateLinkResourcesClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[SharedPrivateLinkResourcesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - Initiates the deletion of the shared private link resource from the search service. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 func (client *SharedPrivateLinkResourcesClient) deleteOperation(ctx context.Context, resourceGroupName string, searchServiceName string, sharedPrivateLinkResourceName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *SharedPrivateLinkResourcesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, searchManagementRequestOptions, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -198,7 +192,7 @@ func (client *SharedPrivateLinkResourcesClient) deleteCreateRequest(ctx context. 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.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -214,22 +208,23 @@ func (client *SharedPrivateLinkResourcesClient) deleteCreateRequest(ctx context. // Get - Gets the details of the shared private link resource managed by the search service in the given resource group. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 -// resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the -// Azure Resource Manager API or the portal. -// searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. -// sharedPrivateLinkResourceName - The name of the shared private link resource managed by the Azure Cognitive Search service -// within the specified resource group. -// SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get -// method. -// options - SharedPrivateLinkResourcesClientGetOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.Get -// method. +// - resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the +// Azure Resource Manager API or the portal. +// - searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. +// - sharedPrivateLinkResourceName - The name of the shared private link resource managed by the Azure Cognitive Search service +// within the specified resource group. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - SharedPrivateLinkResourcesClientGetOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.Get +// method. func (client *SharedPrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, searchServiceName string, sharedPrivateLinkResourceName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *SharedPrivateLinkResourcesClientGetOptions) (SharedPrivateLinkResourcesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, searchManagementRequestOptions, options) if err != nil { return SharedPrivateLinkResourcesClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SharedPrivateLinkResourcesClientGetResponse{}, err } @@ -258,7 +253,7 @@ func (client *SharedPrivateLinkResourcesClient) getCreateRequest(ctx context.Con 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -282,15 +277,15 @@ func (client *SharedPrivateLinkResourcesClient) getHandleResponse(resp *http.Res } // NewListByServicePager - Gets a list of all shared private link resources managed by the given service. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-08-01 -// resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the -// Azure Resource Manager API or the portal. -// searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. -// SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get -// method. -// options - SharedPrivateLinkResourcesClientListByServiceOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.ListByService -// method. +// - resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the +// Azure Resource Manager API or the portal. +// - searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - SharedPrivateLinkResourcesClientListByServiceOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.NewListByServicePager +// method. func (client *SharedPrivateLinkResourcesClient) NewListByServicePager(resourceGroupName string, searchServiceName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *SharedPrivateLinkResourcesClientListByServiceOptions) *runtime.Pager[SharedPrivateLinkResourcesClientListByServiceResponse] { return runtime.NewPager(runtime.PagingHandler[SharedPrivateLinkResourcesClientListByServiceResponse]{ More: func(page SharedPrivateLinkResourcesClientListByServiceResponse) bool { @@ -307,7 +302,7 @@ func (client *SharedPrivateLinkResourcesClient) NewListByServicePager(resourceGr if err != nil { return SharedPrivateLinkResourcesClientListByServiceResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SharedPrivateLinkResourcesClientListByServiceResponse{}, err } @@ -334,7 +329,7 @@ func (client *SharedPrivateLinkResourcesClient) listByServiceCreateRequest(ctx c return nil, errors.New("parameter searchServiceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{searchServiceName}", url.PathEscape(searchServiceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/search/armsearch/sharedprivatelinkresources_client_example_test.go b/sdk/resourcemanager/search/armsearch/sharedprivatelinkresources_client_example_test.go new file mode 100644 index 000000000000..dc8fa50f7c15 --- /dev/null +++ b/sdk/resourcemanager/search/armsearch/sharedprivatelinkresources_client_example_test.go @@ -0,0 +1,151 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armsearch_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/search/armsearch" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/CreateOrUpdateSharedPrivateLinkResource.json +func ExampleSharedPrivateLinkResourcesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSharedPrivateLinkResourcesClient().BeginCreateOrUpdate(ctx, "rg1", "mysearchservice", "testResource", armsearch.SharedPrivateLinkResource{ + Properties: &armsearch.SharedPrivateLinkResourceProperties{ + GroupID: to.Ptr("blob"), + PrivateLinkResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/storageAccountName"), + RequestMessage: to.Ptr("please approve"), + }, + }, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, 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.SharedPrivateLinkResource = armsearch.SharedPrivateLinkResource{ + // Name: to.Ptr("testResource"), + // Type: to.Ptr("Microsoft.Search/searchServices/sharedPrivateLinkResources"), + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice/sharedPrivateLinkResources/testResource"), + // Properties: &armsearch.SharedPrivateLinkResourceProperties{ + // GroupID: to.Ptr("blob"), + // PrivateLinkResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/storageAccountName"), + // RequestMessage: to.Ptr("please approve"), + // Status: to.Ptr(armsearch.SharedPrivateLinkResourceStatusPending), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/GetSharedPrivateLinkResource.json +func ExampleSharedPrivateLinkResourcesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSharedPrivateLinkResourcesClient().Get(ctx, "rg1", "mysearchservice", "testResource", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SharedPrivateLinkResource = armsearch.SharedPrivateLinkResource{ + // Name: to.Ptr("testResource"), + // Type: to.Ptr("Microsoft.Search/searchServices/sharedPrivateLinkResources"), + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice/sharedPrivateLinkResources/testResource"), + // Properties: &armsearch.SharedPrivateLinkResourceProperties{ + // GroupID: to.Ptr("blob"), + // PrivateLinkResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/storageAccountName"), + // RequestMessage: to.Ptr("please approve"), + // Status: to.Ptr(armsearch.SharedPrivateLinkResourceStatusPending), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/DeleteSharedPrivateLinkResource.json +func ExampleSharedPrivateLinkResourcesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSharedPrivateLinkResourcesClient().BeginDelete(ctx, "rg1", "mysearchservice", "testResource", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, 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/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/ListSharedPrivateLinkResourcesByService.json +func ExampleSharedPrivateLinkResourcesClient_NewListByServicePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsearch.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSharedPrivateLinkResourcesClient().NewListByServicePager("rg1", "mysearchservice", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, 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.SharedPrivateLinkResourceListResult = armsearch.SharedPrivateLinkResourceListResult{ + // Value: []*armsearch.SharedPrivateLinkResource{ + // { + // Name: to.Ptr("testResource"), + // Type: to.Ptr("Microsoft.Search/searchServices/sharedPrivateLinkResources"), + // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice/sharedPrivateLinkResources/testResource"), + // Properties: &armsearch.SharedPrivateLinkResourceProperties{ + // GroupID: to.Ptr("blob"), + // PrivateLinkResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/storageAccountName"), + // RequestMessage: to.Ptr("please approve"), + // Status: to.Ptr(armsearch.SharedPrivateLinkResourceStatusPending), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/search/armsearch/ze_generated_example_adminkeys_client_test.go b/sdk/resourcemanager/search/armsearch/ze_generated_example_adminkeys_client_test.go deleted file mode 100644 index f42eb919a4b7..000000000000 --- a/sdk/resourcemanager/search/armsearch/ze_generated_example_adminkeys_client_test.go +++ /dev/null @@ -1,64 +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. - -package armsearch_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchGetAdminKeys.json -func ExampleAdminKeysClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewAdminKeysClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "mysearchservice", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchRegenerateAdminKey.json -func ExampleAdminKeysClient_Regenerate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewAdminKeysClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Regenerate(ctx, - "rg1", - "mysearchservice", - armsearch.AdminKeyKindPrimary, - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/search/armsearch/ze_generated_example_privateendpointconnections_client_test.go b/sdk/resourcemanager/search/armsearch/ze_generated_example_privateendpointconnections_client_test.go deleted file mode 100644 index aacebce1391c..000000000000 --- a/sdk/resourcemanager/search/armsearch/ze_generated_example_privateendpointconnections_client_test.go +++ /dev/null @@ -1,125 +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. - -package armsearch_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/search/armsearch" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/UpdatePrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewPrivateEndpointConnectionsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "rg1", - "mysearchservice", - "testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546", - armsearch.PrivateEndpointConnection{ - Properties: &armsearch.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armsearch.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState{ - Description: to.Ptr("Rejected for some reason"), - Status: to.Ptr(armsearch.PrivateLinkServiceConnectionStatusRejected), - }, - }, - }, - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/GetPrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewPrivateEndpointConnectionsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "mysearchservice", - "testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/DeletePrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewPrivateEndpointConnectionsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Delete(ctx, - "rg1", - "mysearchservice", - "testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/ListPrivateEndpointConnectionsByService.json -func ExamplePrivateEndpointConnectionsClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewPrivateEndpointConnectionsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByServicePager("rg1", - "mysearchservice", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/search/armsearch/ze_generated_example_privatelinkresources_client_test.go b/sdk/resourcemanager/search/armsearch/ze_generated_example_privatelinkresources_client_test.go deleted file mode 100644 index c567f6231257..000000000000 --- a/sdk/resourcemanager/search/armsearch/ze_generated_example_privatelinkresources_client_test.go +++ /dev/null @@ -1,44 +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. - -package armsearch_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/ListSupportedPrivateLinkResources.json -func ExamplePrivateLinkResourcesClient_NewListSupportedPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewPrivateLinkResourcesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListSupportedPager("rg1", - "mysearchservice", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/search/armsearch/ze_generated_example_querykeys_client_test.go b/sdk/resourcemanager/search/armsearch/ze_generated_example_querykeys_client_test.go deleted file mode 100644 index 355528ce4fff..000000000000 --- a/sdk/resourcemanager/search/armsearch/ze_generated_example_querykeys_client_test.go +++ /dev/null @@ -1,90 +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. - -package armsearch_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchCreateQueryKey.json -func ExampleQueryKeysClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewQueryKeysClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, - "rg1", - "mysearchservice", - "Query key for browser-based clients", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchListQueryKeysBySearchService.json -func ExampleQueryKeysClient_NewListBySearchServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewQueryKeysClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySearchServicePager("rg1", - "mysearchservice", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchDeleteQueryKey.json -func ExampleQueryKeysClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewQueryKeysClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "rg1", - "mysearchservice", - "", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/search/armsearch/ze_generated_example_services_client_test.go b/sdk/resourcemanager/search/armsearch/ze_generated_example_services_client_test.go deleted file mode 100644 index a9ef245b8c4c..000000000000 --- a/sdk/resourcemanager/search/armsearch/ze_generated_example_services_client_test.go +++ /dev/null @@ -1,211 +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. - -package armsearch_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/search/armsearch" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchCreateOrUpdateService.json -func ExampleServicesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewServicesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "rg1", - "mysearchservice", - armsearch.Service{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "app-name": to.Ptr("My e-commerce app"), - }, - Properties: &armsearch.ServiceProperties{ - HostingMode: to.Ptr(armsearch.HostingModeDefault), - PartitionCount: to.Ptr[int32](1), - ReplicaCount: to.Ptr[int32](3), - }, - SKU: &armsearch.SKU{ - Name: to.Ptr(armsearch.SKUNameStandard), - }, - }, - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchUpdateService.json -func ExampleServicesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewServicesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "rg1", - "mysearchservice", - armsearch.ServiceUpdate{ - Properties: &armsearch.ServiceProperties{ - ReplicaCount: to.Ptr[int32](2), - }, - Tags: map[string]*string{ - "app-name": to.Ptr("My e-commerce app"), - "new-tag": to.Ptr("Adding a new tag"), - }, - }, - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchGetService.json -func ExampleServicesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewServicesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "mysearchservice", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchDeleteService.json -func ExampleServicesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewServicesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "rg1", - "mysearchservice", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchListServicesByResourceGroup.json -func ExampleServicesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewServicesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("rg1", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchListServicesBySubscription.json -func ExampleServicesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewServicesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(&armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchCheckNameAvailability.json -func ExampleServicesClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewServicesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CheckNameAvailability(ctx, - armsearch.CheckNameAvailabilityInput{ - Name: to.Ptr("mysearchservice"), - Type: to.Ptr("searchServices"), - }, - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/search/armsearch/ze_generated_example_sharedprivatelinkresources_client_test.go b/sdk/resourcemanager/search/armsearch/ze_generated_example_sharedprivatelinkresources_client_test.go deleted file mode 100644 index 65aee8ad0bd1..000000000000 --- a/sdk/resourcemanager/search/armsearch/ze_generated_example_sharedprivatelinkresources_client_test.go +++ /dev/null @@ -1,130 +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. - -package armsearch_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/search/armsearch" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/CreateOrUpdateSharedPrivateLinkResource.json -func ExampleSharedPrivateLinkResourcesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewSharedPrivateLinkResourcesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "rg1", - "mysearchservice", - "testResource", - armsearch.SharedPrivateLinkResource{ - Properties: &armsearch.SharedPrivateLinkResourceProperties{ - GroupID: to.Ptr("blob"), - PrivateLinkResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/storageAccountName"), - RequestMessage: to.Ptr("please approve"), - }, - }, - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/GetSharedPrivateLinkResource.json -func ExampleSharedPrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewSharedPrivateLinkResourcesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "mysearchservice", - "testResource", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/DeleteSharedPrivateLinkResource.json -func ExampleSharedPrivateLinkResourcesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewSharedPrivateLinkResourcesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "rg1", - "mysearchservice", - "testResource", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - 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/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/ListSharedPrivateLinkResourcesByService.json -func ExampleSharedPrivateLinkResourcesClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewSharedPrivateLinkResourcesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByServicePager("rg1", - "mysearchservice", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_models_serde.go b/sdk/resourcemanager/search/armsearch/zz_generated_models_serde.go deleted file mode 100644 index f0ef1d6f8d8f..000000000000 --- a/sdk/resourcemanager/search/armsearch/zz_generated_models_serde.go +++ /dev/null @@ -1,97 +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. - -package armsearch - -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type NetworkRuleSet. -func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "ipRules", n.IPRules) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. -func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "groupId", p.GroupID) - populate(objectMap, "requiredMembers", p.RequiredMembers) - populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) - populate(objectMap, "shareablePrivateLinkResourceTypes", p.ShareablePrivateLinkResourceTypes) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Service. -func (s Service) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", s.ID) - populate(objectMap, "identity", s.Identity) - populate(objectMap, "location", s.Location) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "sku", s.SKU) - populate(objectMap, "tags", s.Tags) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ServiceProperties. -func (s ServiceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "hostingMode", s.HostingMode) - populate(objectMap, "networkRuleSet", s.NetworkRuleSet) - populate(objectMap, "partitionCount", s.PartitionCount) - populate(objectMap, "privateEndpointConnections", s.PrivateEndpointConnections) - populate(objectMap, "provisioningState", s.ProvisioningState) - populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) - populate(objectMap, "replicaCount", s.ReplicaCount) - populate(objectMap, "sharedPrivateLinkResources", s.SharedPrivateLinkResources) - populate(objectMap, "status", s.Status) - populate(objectMap, "statusDetails", s.StatusDetails) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ServiceUpdate. -func (s ServiceUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", s.ID) - populate(objectMap, "identity", s.Identity) - populate(objectMap, "location", s.Location) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "sku", s.SKU) - populate(objectMap, "tags", s.Tags) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/CHANGELOG.md b/sdk/resourcemanager/storageimportexport/armstorageimportexport/CHANGELOG.md index ff36d79f3925..1466daf54e4c 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/CHANGELOG.md +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 0.6.0 (2023-04-03) +### Features Added + +- New struct `ClientFactory` which is a client factory used to create any client in this module + + ## 0.5.0 (2022-05-18) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storageimportexport/armstorageimportexport` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 0.5.0, which contains breaking changes. diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/README.md b/sdk/resourcemanager/storageimportexport/armstorageimportexport/README.md index fea0d625c511..afa8591cd5da 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/README.md +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/README.md @@ -33,12 +33,12 @@ 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). -## Clients +## Client Factory -Azure Storage Import/Export modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. +Azure Storage Import/Export module consists of one or more clients. We provide a client factory which could be used to create any client in this module. ```go -client, err := armstorageimportexport.NewJobsClient(, cred, nil) +clientFactory, err := armstorageimportexport.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). @@ -49,7 +49,15 @@ options := arm.ClientOptions { Cloud: cloud.AzureChina, }, } -client, err := armstorageimportexport.NewJobsClient(, cred, &options) +clientFactory, err := armstorageimportexport.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.NewJobsClient() ``` ## Provide Feedback diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/autorest.md b/sdk/resourcemanager/storageimportexport/armstorageimportexport/autorest.md index 5ab8e242d789..9d8f2c678c1c 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/autorest.md +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/autorest.md @@ -8,6 +8,6 @@ require: - https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storageimportexport/resource-manager/readme.md - https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storageimportexport/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.5.0 +module-version: 0.6.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_bitlockerkeys_client.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/bitlockerkeys_client.go similarity index 76% rename from sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_bitlockerkeys_client.go rename to sdk/resourcemanager/storageimportexport/armstorageimportexport/bitlockerkeys_client.go index 1e4387011679..3bf6558afeb6 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_bitlockerkeys_client.go +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/bitlockerkeys_client.go @@ -5,6 +5,7 @@ // 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 armstorageimportexport @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,44 +24,35 @@ import ( // BitLockerKeysClient contains the methods for the BitLockerKeys group. // Don't use this type directly, use NewBitLockerKeysClient() instead. type BitLockerKeysClient struct { - host string + internal *arm.Client subscriptionID string acceptLanguage *string - pl runtime.Pipeline } // NewBitLockerKeysClient creates a new instance of BitLockerKeysClient with the specified values. -// subscriptionID - The subscription ID for the Azure user. -// acceptLanguage - Specifies the preferred language for the response. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The subscription ID for the Azure user. +// - acceptLanguage - Specifies the preferred language for the response. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewBitLockerKeysClient(subscriptionID string, acceptLanguage *string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BitLockerKeysClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".BitLockerKeysClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &BitLockerKeysClient{ subscriptionID: subscriptionID, acceptLanguage: acceptLanguage, - host: ep, - pl: pl, + internal: cl, } return client, nil } // NewListPager - Returns the BitLocker Keys for all drives in the specified job. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-01-01 -// jobName - The name of the import/export job. -// resourceGroupName - The resource group name uniquely identifies the resource group within the user subscription. -// options - BitLockerKeysClientListOptions contains the optional parameters for the BitLockerKeysClient.List method. +// - jobName - The name of the import/export job. +// - resourceGroupName - The resource group name uniquely identifies the resource group within the user subscription. +// - options - BitLockerKeysClientListOptions contains the optional parameters for the BitLockerKeysClient.NewListPager method. func (client *BitLockerKeysClient) NewListPager(jobName string, resourceGroupName string, options *BitLockerKeysClientListOptions) *runtime.Pager[BitLockerKeysClientListResponse] { return runtime.NewPager(runtime.PagingHandler[BitLockerKeysClientListResponse]{ More: func(page BitLockerKeysClientListResponse) bool { @@ -73,7 +63,7 @@ func (client *BitLockerKeysClient) NewListPager(jobName string, resourceGroupNam if err != nil { return BitLockerKeysClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return BitLockerKeysClientListResponse{}, err } @@ -100,7 +90,7 @@ func (client *BitLockerKeysClient) listCreateRequest(ctx context.Context, jobNam return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/bitlockerkeys_client_example_test.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/bitlockerkeys_client_example_test.go new file mode 100644 index 000000000000..0525bcfa9258 --- /dev/null +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/bitlockerkeys_client_example_test.go @@ -0,0 +1,50 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armstorageimportexport_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storageimportexport/armstorageimportexport" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/ListBitLockerKeys.json +func ExampleBitLockerKeysClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewBitLockerKeysClient().NewListPager("myJob", "myResourceGroup", 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.GetBitLockerKeysResponse = armstorageimportexport.GetBitLockerKeysResponse{ + // Value: []*armstorageimportexport.DriveBitLockerKey{ + // { + // BitLockerKey: to.Ptr("000000-000000-111111-222222-333333-444444-555555-666666"), + // DriveID: to.Ptr("9CA995BB"), + // }}, + // } + } +} diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/client_factory.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/client_factory.go new file mode 100644 index 000000000000..fa16b73cce2b --- /dev/null +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/client_factory.go @@ -0,0 +1,61 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armstorageimportexport + +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 + acceptLanguage *string + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// 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 subscription ID for the Azure user. +// - acceptLanguage - Specifies the preferred language for the response. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(subscriptionID string, acceptLanguage *string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, acceptLanguage: acceptLanguage, credential: credential, + options: options.Clone(), + }, nil +} + +func (c *ClientFactory) NewLocationsClient() *LocationsClient { + subClient, _ := NewLocationsClient(c.acceptLanguage, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewJobsClient() *JobsClient { + subClient, _ := NewJobsClient(c.subscriptionID, c.acceptLanguage, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewBitLockerKeysClient() *BitLockerKeysClient { + subClient, _ := NewBitLockerKeysClient(c.subscriptionID, c.acceptLanguage, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.acceptLanguage, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_constants.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/constants.go similarity index 98% rename from sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_constants.go rename to sdk/resourcemanager/storageimportexport/armstorageimportexport/constants.go index aa8eb6488731..259dbd380b41 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_constants.go +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/constants.go @@ -5,12 +5,13 @@ // 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 armstorageimportexport const ( moduleName = "armstorageimportexport" - moduleVersion = "v0.5.0" + moduleVersion = "v0.6.0" ) // CreatedByType - The type of identity that created the resource. diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/go.mod b/sdk/resourcemanager/storageimportexport/armstorageimportexport/go.mod index 456760433c59..660ce4248730 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/go.mod +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/go.mod @@ -3,19 +3,19 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storageimportexport go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect + github.com/golang-jwt/jwt/v4 v4.5.0 // indirect + github.com/google/uuid v1.3.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect - golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect - golang.org/x/text v0.3.7 // indirect + github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect + golang.org/x/crypto v0.6.0 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect ) diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/go.sum b/sdk/resourcemanager/storageimportexport/armstorageimportexport/go.sum index ed5b814680ee..8ba445a8c4da 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/go.sum +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/go.sum @@ -1,33 +1,31 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= +github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.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/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= +golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_jobs_client.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/jobs_client.go similarity index 85% rename from sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_jobs_client.go rename to sdk/resourcemanager/storageimportexport/armstorageimportexport/jobs_client.go index 010dfcafb13e..b6ee56a327fe 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_jobs_client.go +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/jobs_client.go @@ -5,6 +5,7 @@ // 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 armstorageimportexport @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,51 +25,43 @@ import ( // JobsClient contains the methods for the Jobs group. // Don't use this type directly, use NewJobsClient() instead. type JobsClient struct { - host string + internal *arm.Client subscriptionID string acceptLanguage *string - pl runtime.Pipeline } // NewJobsClient creates a new instance of JobsClient with the specified values. -// subscriptionID - The subscription ID for the Azure user. -// acceptLanguage - Specifies the preferred language for the response. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The subscription ID for the Azure user. +// - acceptLanguage - Specifies the preferred language for the response. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewJobsClient(subscriptionID string, acceptLanguage *string, credential azcore.TokenCredential, options *arm.ClientOptions) (*JobsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".JobsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &JobsClient{ subscriptionID: subscriptionID, acceptLanguage: acceptLanguage, - host: ep, - pl: pl, + internal: cl, } return client, nil } // Create - Creates a new job or updates an existing job in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-01-01 -// jobName - The name of the import/export job. -// resourceGroupName - The resource group name uniquely identifies the resource group within the user subscription. -// body - The parameters used for creating the job -// options - JobsClientCreateOptions contains the optional parameters for the JobsClient.Create method. +// - jobName - The name of the import/export job. +// - resourceGroupName - The resource group name uniquely identifies the resource group within the user subscription. +// - body - The parameters used for creating the job +// - options - JobsClientCreateOptions contains the optional parameters for the JobsClient.Create method. func (client *JobsClient) Create(ctx context.Context, jobName string, resourceGroupName string, body PutJobParameters, options *JobsClientCreateOptions) (JobsClientCreateResponse, error) { req, err := client.createCreateRequest(ctx, jobName, resourceGroupName, body, options) if err != nil { return JobsClientCreateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return JobsClientCreateResponse{}, err } @@ -95,7 +86,7 @@ func (client *JobsClient) createCreateRequest(ctx context.Context, jobName strin return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -123,16 +114,17 @@ func (client *JobsClient) createHandleResponse(resp *http.Response) (JobsClientC // Delete - Deletes an existing job. Only jobs in the Creating or Completed states can be deleted. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-01-01 -// jobName - The name of the import/export job. -// resourceGroupName - The resource group name uniquely identifies the resource group within the user subscription. -// options - JobsClientDeleteOptions contains the optional parameters for the JobsClient.Delete method. +// - jobName - The name of the import/export job. +// - resourceGroupName - The resource group name uniquely identifies the resource group within the user subscription. +// - options - JobsClientDeleteOptions contains the optional parameters for the JobsClient.Delete method. func (client *JobsClient) Delete(ctx context.Context, jobName string, resourceGroupName string, options *JobsClientDeleteOptions) (JobsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, jobName, resourceGroupName, options) if err != nil { return JobsClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return JobsClientDeleteResponse{}, err } @@ -157,7 +149,7 @@ func (client *JobsClient) deleteCreateRequest(ctx context.Context, jobName strin return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -173,16 +165,17 @@ func (client *JobsClient) deleteCreateRequest(ctx context.Context, jobName strin // Get - Gets information about an existing job. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-01-01 -// jobName - The name of the import/export job. -// resourceGroupName - The resource group name uniquely identifies the resource group within the user subscription. -// options - JobsClientGetOptions contains the optional parameters for the JobsClient.Get method. +// - jobName - The name of the import/export job. +// - resourceGroupName - The resource group name uniquely identifies the resource group within the user subscription. +// - options - JobsClientGetOptions contains the optional parameters for the JobsClient.Get method. func (client *JobsClient) Get(ctx context.Context, jobName string, resourceGroupName string, options *JobsClientGetOptions) (JobsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, jobName, resourceGroupName, options) if err != nil { return JobsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return JobsClientGetResponse{}, err } @@ -207,7 +200,7 @@ func (client *JobsClient) getCreateRequest(ctx context.Context, jobName string, 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -231,11 +224,11 @@ func (client *JobsClient) getHandleResponse(resp *http.Response) (JobsClientGetR } // NewListByResourceGroupPager - Returns all active and completed jobs in a resource group. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-01-01 -// resourceGroupName - The resource group name uniquely identifies the resource group within the user subscription. -// options - JobsClientListByResourceGroupOptions contains the optional parameters for the JobsClient.ListByResourceGroup -// method. +// - resourceGroupName - The resource group name uniquely identifies the resource group within the user subscription. +// - options - JobsClientListByResourceGroupOptions contains the optional parameters for the JobsClient.NewListByResourceGroupPager +// method. func (client *JobsClient) NewListByResourceGroupPager(resourceGroupName string, options *JobsClientListByResourceGroupOptions) *runtime.Pager[JobsClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[JobsClientListByResourceGroupResponse]{ More: func(page JobsClientListByResourceGroupResponse) bool { @@ -252,7 +245,7 @@ func (client *JobsClient) NewListByResourceGroupPager(resourceGroupName string, if err != nil { return JobsClientListByResourceGroupResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return JobsClientListByResourceGroupResponse{}, err } @@ -275,7 +268,7 @@ func (client *JobsClient) listByResourceGroupCreateRequest(ctx context.Context, 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -305,9 +298,10 @@ func (client *JobsClient) listByResourceGroupHandleResponse(resp *http.Response) } // NewListBySubscriptionPager - Returns all active and completed jobs in a subscription. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-01-01 -// options - JobsClientListBySubscriptionOptions contains the optional parameters for the JobsClient.ListBySubscription method. +// - options - JobsClientListBySubscriptionOptions contains the optional parameters for the JobsClient.NewListBySubscriptionPager +// method. func (client *JobsClient) NewListBySubscriptionPager(options *JobsClientListBySubscriptionOptions) *runtime.Pager[JobsClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[JobsClientListBySubscriptionResponse]{ More: func(page JobsClientListBySubscriptionResponse) bool { @@ -324,7 +318,7 @@ func (client *JobsClient) NewListBySubscriptionPager(options *JobsClientListBySu if err != nil { return JobsClientListBySubscriptionResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return JobsClientListBySubscriptionResponse{}, err } @@ -343,7 +337,7 @@ func (client *JobsClient) listBySubscriptionCreateRequest(ctx context.Context, o 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -376,17 +370,18 @@ func (client *JobsClient) listBySubscriptionHandleResponse(resp *http.Response) // hard drives comprising the import or export job have been shipped to the Microsoft data // center. It can also be used to cancel an existing job. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-01-01 -// jobName - The name of the import/export job. -// resourceGroupName - The resource group name uniquely identifies the resource group within the user subscription. -// body - The parameters to update in the job -// options - JobsClientUpdateOptions contains the optional parameters for the JobsClient.Update method. +// - jobName - The name of the import/export job. +// - resourceGroupName - The resource group name uniquely identifies the resource group within the user subscription. +// - body - The parameters to update in the job +// - options - JobsClientUpdateOptions contains the optional parameters for the JobsClient.Update method. func (client *JobsClient) Update(ctx context.Context, jobName string, resourceGroupName string, body UpdateJobParameters, options *JobsClientUpdateOptions) (JobsClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, jobName, resourceGroupName, body, options) if err != nil { return JobsClientUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return JobsClientUpdateResponse{}, err } @@ -411,7 +406,7 @@ func (client *JobsClient) updateCreateRequest(ctx context.Context, jobName strin return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/jobs_client_example_test.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/jobs_client_example_test.go new file mode 100644 index 000000000000..190b99a16da4 --- /dev/null +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/jobs_client_example_test.go @@ -0,0 +1,871 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armstorageimportexport_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/storageimportexport/armstorageimportexport" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/ListJobsInSubscription.json +func ExampleJobsClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewJobsClient().NewListBySubscriptionPager(&armstorageimportexport.JobsClientListBySubscriptionOptions{Top: nil, + Filter: 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.ListJobsResponse = armstorageimportexport.ListJobsResponse{ + // Value: []*armstorageimportexport.JobResponse{ + // { + // Name: to.Ptr("test-bn1-import-cpu100-01"), + // Type: to.Ptr("Microsoft.ImportExport/jobs"), + // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/testrg/providers/Microsoft.ImportExport/jobs/test-bn1-import-cpu100-01"), + // Identity: &armstorageimportexport.IdentityDetails{ + // Type: to.Ptr(armstorageimportexport.IdentityTypeNone), + // }, + // Location: to.Ptr("East US 2"), + // Properties: &armstorageimportexport.JobDetails{ + // BackupDriveManifest: to.Ptr(true), + // CancelRequested: to.Ptr(false), + // DeliveryPackage: &armstorageimportexport.DeliveryPackageInformation{ + // CarrierName: to.Ptr("FedEx"), + // DriveCount: to.Ptr[int64](1), + // ShipDate: to.Ptr("8/11/2017 9:05:00 PM"), + // TrackingNumber: to.Ptr("992016102507"), + // }, + // DiagnosticsPath: to.Ptr("waimportexport"), + // DriveList: []*armstorageimportexport.DriveStatus{ + // { + // DriveID: to.Ptr("7PHR882C"), + // ManifestFile: to.Ptr("\\DriveManifest.xml"), + // ManifestHash: to.Ptr("E5D632DB047C74B3B17C8F3359950ADB"), + // State: to.Ptr(armstorageimportexport.DriveStateReceived), + // }}, + // EncryptionKey: &armstorageimportexport.EncryptionKeyDetails{ + // KekType: to.Ptr(armstorageimportexport.EncryptionKekTypeMicrosoftManaged), + // }, + // JobType: to.Ptr("Import"), + // LogLevel: to.Ptr("Verbose"), + // ProvisioningState: to.Ptr("Succeeded"), + // ReturnAddress: &armstorageimportexport.ReturnAddress{ + // City: to.Ptr("city"), + // CountryOrRegion: to.Ptr("USA"), + // Email: to.Ptr("test@contoso.com"), + // Phone: to.Ptr("425000000"), + // PostalCode: to.Ptr("98007"), + // RecipientName: to.Ptr("La"), + // StateOrProvince: to.Ptr("wa"), + // StreetAddress1: to.Ptr("Street1"), + // StreetAddress2: to.Ptr("street2"), + // }, + // ReturnShipping: &armstorageimportexport.ReturnShipping{ + // CarrierAccountNumber: to.Ptr("989ffff"), + // CarrierName: to.Ptr("FedEx"), + // }, + // ShippingInformation: &armstorageimportexport.ShippingInformation{ + // AdditionalInformation: to.Ptr(""), + // City: to.Ptr("Boydton"), + // CountryOrRegion: to.Ptr("USA"), + // Phone: to.Ptr("+1-434-738-9443"), + // PostalCode: to.Ptr("23917"), + // RecipientName: to.Ptr("Windows Azure Import Export Service"), + // StateOrProvince: to.Ptr("VA"), + // StreetAddress1: to.Ptr("Boydton 1 / BLDG # 1 101 Herbert Drive"), + // StreetAddress2: to.Ptr(""), + // }, + // State: to.Ptr("Received"), + // StorageAccountID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/testrg/providers/Microsoft.Storage/storageAccounts/xtprodtestarmos2"), + // }, + // SystemData: &armstorageimportexport.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T01:01:01.1075056Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armstorageimportexport.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T02:03:01.1974346Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armstorageimportexport.CreatedByTypeUser), + // }, + // }, + // { + // Name: to.Ptr("test-bn1-import-cpu100-02"), + // Type: to.Ptr("Microsoft.ImportExport/jobs"), + // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/testrg/providers/Microsoft.ImportExport/jobs/test-bn1-import-cpu100-02"), + // Identity: &armstorageimportexport.IdentityDetails{ + // Type: to.Ptr(armstorageimportexport.IdentityTypeNone), + // }, + // Location: to.Ptr("East US 2"), + // Properties: &armstorageimportexport.JobDetails{ + // BackupDriveManifest: to.Ptr(true), + // CancelRequested: to.Ptr(false), + // DeliveryPackage: &armstorageimportexport.DeliveryPackageInformation{ + // CarrierName: to.Ptr("FedEx"), + // DriveCount: to.Ptr[int64](1), + // ShipDate: to.Ptr("8/13/2017 7:32:23 PM"), + // TrackingNumber: to.Ptr("992016102508"), + // }, + // DiagnosticsPath: to.Ptr("waimportexport"), + // DriveList: []*armstorageimportexport.DriveStatus{ + // { + // CopyStatus: to.Ptr("InProgress"), + // DriveID: to.Ptr("KV6H86XP"), + // ErrorLogURI: to.Ptr("https://foo.blob.core.windows.net/waimportexport/waies/test-bn1-import-cpu100-02_KV6H86XP_20170813-194620-021_error.xml"), + // ManifestFile: to.Ptr("\\DriveManifest.xml"), + // ManifestHash: to.Ptr("F6A488A65AF0CCA7D050B7F9F43A197C"), + // ManifestURI: to.Ptr("https://foo.blob.core.windows.net/waimportexport/waies/test-bn1-import-cpu100-02_KV6H86XP_20170813-194620-574_manifest.xml"), + // State: to.Ptr(armstorageimportexport.DriveStateCompletedMoreInfo), + // VerboseLogURI: to.Ptr("https://foo.blob.core.windows.net/waimportexport/waies/test-bn1-import-cpu100-02_KV6H86XP_20170813-194618-350_verbose.xml"), + // }}, + // EncryptionKey: &armstorageimportexport.EncryptionKeyDetails{ + // KekType: to.Ptr(armstorageimportexport.EncryptionKekTypeMicrosoftManaged), + // }, + // JobType: to.Ptr("Import"), + // LogLevel: to.Ptr("Verbose"), + // PercentComplete: to.Ptr[int64](6), + // ProvisioningState: to.Ptr("Succeeded"), + // ReturnAddress: &armstorageimportexport.ReturnAddress{ + // City: to.Ptr("city"), + // CountryOrRegion: to.Ptr("USA"), + // Email: to.Ptr("test@contoso.com"), + // Phone: to.Ptr("4256150991"), + // PostalCode: to.Ptr("98007"), + // RecipientName: to.Ptr("La"), + // StateOrProvince: to.Ptr("wa"), + // StreetAddress1: to.Ptr("Street1"), + // StreetAddress2: to.Ptr("street2"), + // }, + // ShippingInformation: &armstorageimportexport.ShippingInformation{ + // AdditionalInformation: to.Ptr(""), + // City: to.Ptr("Boydton"), + // CountryOrRegion: to.Ptr("USA"), + // Phone: to.Ptr("+1-434-738-9443"), + // PostalCode: to.Ptr("23917"), + // RecipientName: to.Ptr("Windows Azure Import Export Service"), + // StateOrProvince: to.Ptr("VA"), + // StreetAddress1: to.Ptr("Boydton 1 / BLDG # 1 101 Herbert Drive"), + // StreetAddress2: to.Ptr(""), + // }, + // State: to.Ptr("Transferring"), + // StorageAccountID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/testrg/providers/Microsoft.Storage/storageAccounts/xtprodtestarmos2"), + // }, + // SystemData: &armstorageimportexport.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T01:01:01.1075056Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armstorageimportexport.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T02:03:01.1974346Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armstorageimportexport.CreatedByTypeUser), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/ListJobsInResourceGroup.json +func ExampleJobsClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewJobsClient().NewListByResourceGroupPager("myResourceGroup", &armstorageimportexport.JobsClientListByResourceGroupOptions{Top: nil, + Filter: 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.ListJobsResponse = armstorageimportexport.ListJobsResponse{ + // Value: []*armstorageimportexport.JobResponse{ + // { + // Name: to.Ptr("test-by1-ssd-2"), + // Type: to.Ptr("Microsoft.ImportExport/jobs"), + // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ImportExport/jobs/test-by1-ssd-2"), + // Identity: &armstorageimportexport.IdentityDetails{ + // Type: to.Ptr(armstorageimportexport.IdentityTypeNone), + // }, + // Location: to.Ptr("West US"), + // Properties: &armstorageimportexport.JobDetails{ + // BackupDriveManifest: to.Ptr(true), + // CancelRequested: to.Ptr(false), + // DeliveryPackage: &armstorageimportexport.DeliveryPackageInformation{ + // CarrierName: to.Ptr("FedEx"), + // DriveCount: to.Ptr[int64](1), + // ShipDate: to.Ptr("9/29/2017 10:28:35 PM"), + // TrackingNumber: to.Ptr("787895108176"), + // }, + // DiagnosticsPath: to.Ptr("waimportexport"), + // EncryptionKey: &armstorageimportexport.EncryptionKeyDetails{ + // KekType: to.Ptr(armstorageimportexport.EncryptionKekTypeMicrosoftManaged), + // }, + // JobType: to.Ptr("Import"), + // LogLevel: to.Ptr("Verbose"), + // ProvisioningState: to.Ptr("Succeeded"), + // ReturnAddress: &armstorageimportexport.ReturnAddress{ + // City: to.Ptr("Redmond"), + // CountryOrRegion: to.Ptr("USA"), + // Email: to.Ptr("test@contoso.com"), + // Phone: to.Ptr("4250000000"), + // PostalCode: to.Ptr("98007"), + // RecipientName: to.Ptr("La"), + // StateOrProvince: to.Ptr("wa"), + // StreetAddress1: to.Ptr("Street1"), + // StreetAddress2: to.Ptr("street2"), + // }, + // ReturnShipping: &armstorageimportexport.ReturnShipping{ + // CarrierAccountNumber: to.Ptr("989ffff"), + // CarrierName: to.Ptr("FedEx"), + // }, + // ShippingInformation: &armstorageimportexport.ShippingInformation{ + // AdditionalInformation: to.Ptr(""), + // City: to.Ptr("Santa Clara"), + // CountryOrRegion: to.Ptr("USA"), + // Phone: to.Ptr("408 352 7600"), + // PostalCode: to.Ptr("95050"), + // RecipientName: to.Ptr("Microsoft Azure Import/Export Service"), + // StateOrProvince: to.Ptr("CA"), + // StreetAddress1: to.Ptr("2045 Lafayette Street"), + // StreetAddress2: to.Ptr(""), + // }, + // State: to.Ptr("Received"), + // StorageAccountID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ClassicStorage/storageAccounts/xtprodtestwu"), + // }, + // SystemData: &armstorageimportexport.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T01:01:01.1075056Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armstorageimportexport.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T02:03:01.1974346Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armstorageimportexport.CreatedByTypeUser), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/GetExportJob.json +func ExampleJobsClient_Get_getExportJob() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewJobsClient().Get(ctx, "myJob", "myResourceGroup", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.JobResponse = armstorageimportexport.JobResponse{ + // Name: to.Ptr("myJob"), + // Type: to.Ptr("Microsoft.ImportExport/jobs"), + // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ImportExport/jobs/test"), + // Identity: &armstorageimportexport.IdentityDetails{ + // Type: to.Ptr(armstorageimportexport.IdentityTypeNone), + // }, + // Location: to.Ptr("West US"), + // Properties: &armstorageimportexport.JobDetails{ + // BackupDriveManifest: to.Ptr(true), + // CancelRequested: to.Ptr(false), + // DiagnosticsPath: to.Ptr("waimportexport"), + // DriveList: []*armstorageimportexport.DriveStatus{ + // }, + // EncryptionKey: &armstorageimportexport.EncryptionKeyDetails{ + // KekType: to.Ptr(armstorageimportexport.EncryptionKekTypeMicrosoftManaged), + // }, + // Export: &armstorageimportexport.Export{ + // BlobList: &armstorageimportexport.ExportBlobList{ + // BlobPathPrefix: []*string{ + // to.Ptr("/")}, + // }, + // }, + // JobType: to.Ptr("Export"), + // LogLevel: to.Ptr("Verbose"), + // ProvisioningState: to.Ptr("Succeeded"), + // ReturnAddress: &armstorageimportexport.ReturnAddress{ + // City: to.Ptr("Redmond"), + // CountryOrRegion: to.Ptr("USA"), + // Email: to.Ptr("Test@contoso.com"), + // Phone: to.Ptr("4250000000"), + // PostalCode: to.Ptr("98007"), + // RecipientName: to.Ptr("Test"), + // StateOrProvince: to.Ptr("wa"), + // StreetAddress1: to.Ptr("Street1"), + // StreetAddress2: to.Ptr("street2"), + // }, + // ReturnShipping: &armstorageimportexport.ReturnShipping{ + // CarrierAccountNumber: to.Ptr("989ffff"), + // CarrierName: to.Ptr("FedEx"), + // }, + // ShippingInformation: &armstorageimportexport.ShippingInformation{ + // AdditionalInformation: to.Ptr(""), + // City: to.Ptr("Santa Clara"), + // CountryOrRegion: to.Ptr("USA"), + // Phone: to.Ptr("408 0000 0000"), + // PostalCode: to.Ptr("95050"), + // RecipientName: to.Ptr("Microsoft Azure Import/Export Service"), + // StateOrProvince: to.Ptr("CA"), + // StreetAddress1: to.Ptr("2045 Lafayette Street"), + // StreetAddress2: to.Ptr(""), + // }, + // State: to.Ptr("Creating"), + // StorageAccountID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ClassicStorage/storageAccounts/test"), + // }, + // SystemData: &armstorageimportexport.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T01:01:01.1075056Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armstorageimportexport.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T02:03:01.1974346Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armstorageimportexport.CreatedByTypeUser), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/GetJob.json +func ExampleJobsClient_Get_getImportJob() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewJobsClient().Get(ctx, "myJob", "myResourceGroup", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.JobResponse = armstorageimportexport.JobResponse{ + // Name: to.Ptr("myJob"), + // Type: to.Ptr("Microsoft.ImportExport/jobs"), + // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ImportExport/jobs/test"), + // Identity: &armstorageimportexport.IdentityDetails{ + // Type: to.Ptr(armstorageimportexport.IdentityTypeNone), + // }, + // Location: to.Ptr("West US"), + // Properties: &armstorageimportexport.JobDetails{ + // BackupDriveManifest: to.Ptr(true), + // CancelRequested: to.Ptr(false), + // DiagnosticsPath: to.Ptr("waimportexport"), + // DriveList: []*armstorageimportexport.DriveStatus{ + // { + // DriveHeaderHash: to.Ptr(""), + // DriveID: to.Ptr("9CA995BB"), + // ManifestFile: to.Ptr("\\DriveManifest.xml"), + // ManifestHash: to.Ptr("109B21108597EF36D5785F08303F3638"), + // State: to.Ptr(armstorageimportexport.DriveStateSpecified), + // }}, + // EncryptionKey: &armstorageimportexport.EncryptionKeyDetails{ + // KekType: to.Ptr(armstorageimportexport.EncryptionKekTypeMicrosoftManaged), + // }, + // JobType: to.Ptr("Import"), + // LogLevel: to.Ptr("Verbose"), + // ProvisioningState: to.Ptr("Succeeded"), + // ReturnAddress: &armstorageimportexport.ReturnAddress{ + // City: to.Ptr("Redmond"), + // CountryOrRegion: to.Ptr("USA"), + // Email: to.Ptr("Test@contoso.com"), + // Phone: to.Ptr("4250000000"), + // PostalCode: to.Ptr("98007"), + // RecipientName: to.Ptr("Test"), + // StateOrProvince: to.Ptr("wa"), + // StreetAddress1: to.Ptr("Street1"), + // StreetAddress2: to.Ptr("street2"), + // }, + // ReturnShipping: &armstorageimportexport.ReturnShipping{ + // CarrierAccountNumber: to.Ptr("989ffff"), + // CarrierName: to.Ptr("FedEx"), + // }, + // ShippingInformation: &armstorageimportexport.ShippingInformation{ + // AdditionalInformation: to.Ptr(""), + // City: to.Ptr("Santa Clara"), + // CountryOrRegion: to.Ptr("USA"), + // Phone: to.Ptr("408 0000 0000"), + // PostalCode: to.Ptr("95050"), + // RecipientName: to.Ptr("Microsoft Azure Import/Export Service"), + // StateOrProvince: to.Ptr("CA"), + // StreetAddress1: to.Ptr("2045 Lafayette Street"), + // StreetAddress2: to.Ptr(""), + // }, + // State: to.Ptr("Creating"), + // StorageAccountID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ClassicStorage/storageAccounts/test"), + // }, + // SystemData: &armstorageimportexport.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T01:01:01.1075056Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armstorageimportexport.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T02:03:01.1974346Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armstorageimportexport.CreatedByTypeUser), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/UpdateExportJob.json +func ExampleJobsClient_Update_updateExportJob() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewJobsClient().Update(ctx, "myExportJob", "myResourceGroup", armstorageimportexport.UpdateJobParameters{ + Properties: &armstorageimportexport.UpdateJobParametersProperties{ + BackupDriveManifest: to.Ptr(true), + LogLevel: to.Ptr("Verbose"), + State: to.Ptr(""), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.JobResponse = armstorageimportexport.JobResponse{ + // Name: to.Ptr("myExportJob"), + // Type: to.Ptr("Microsoft.ImportExport/jobs"), + // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ImportExport/jobs/myExportJob"), + // Identity: &armstorageimportexport.IdentityDetails{ + // Type: to.Ptr(armstorageimportexport.IdentityTypeNone), + // }, + // Location: to.Ptr("West US"), + // Properties: &armstorageimportexport.JobDetails{ + // BackupDriveManifest: to.Ptr(true), + // CancelRequested: to.Ptr(false), + // DiagnosticsPath: to.Ptr("waimportexport"), + // EncryptionKey: &armstorageimportexport.EncryptionKeyDetails{ + // KekType: to.Ptr(armstorageimportexport.EncryptionKekTypeMicrosoftManaged), + // }, + // Export: &armstorageimportexport.Export{ + // BlobList: &armstorageimportexport.ExportBlobList{ + // BlobPathPrefix: []*string{ + // to.Ptr("/")}, + // }, + // }, + // JobType: to.Ptr("Export"), + // LogLevel: to.Ptr("Verbose"), + // ProvisioningState: to.Ptr("Succeeded"), + // ReturnAddress: &armstorageimportexport.ReturnAddress{ + // City: to.Ptr("Redmond"), + // CountryOrRegion: to.Ptr("USA"), + // Email: to.Ptr("Test@contoso.com"), + // Phone: to.Ptr("4250000000"), + // PostalCode: to.Ptr("98007"), + // RecipientName: to.Ptr("Test"), + // StateOrProvince: to.Ptr("wa"), + // StreetAddress1: to.Ptr("Street1"), + // StreetAddress2: to.Ptr("street2"), + // }, + // ReturnShipping: &armstorageimportexport.ReturnShipping{ + // CarrierAccountNumber: to.Ptr("989ffff"), + // CarrierName: to.Ptr("FedEx"), + // }, + // ShippingInformation: &armstorageimportexport.ShippingInformation{ + // AdditionalInformation: to.Ptr(""), + // City: to.Ptr("Santa Clara"), + // CountryOrRegion: to.Ptr("USA"), + // Phone: to.Ptr("408 352 7600"), + // PostalCode: to.Ptr("95050"), + // RecipientName: to.Ptr("Microsoft Azure Import/Export Service"), + // StateOrProvince: to.Ptr("CA"), + // StreetAddress1: to.Ptr("2045 Lafayette Street"), + // StreetAddress2: to.Ptr(""), + // }, + // State: to.Ptr("Creating"), + // StorageAccountID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ClassicStorage/storageAccounts/test"), + // }, + // SystemData: &armstorageimportexport.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T01:01:01.1075056Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armstorageimportexport.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T02:03:01.1974346Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armstorageimportexport.CreatedByTypeUser), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/UpdateJob.json +func ExampleJobsClient_Update_updateImportJob() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewJobsClient().Update(ctx, "myJob", "myResourceGroup", armstorageimportexport.UpdateJobParameters{ + Properties: &armstorageimportexport.UpdateJobParametersProperties{ + BackupDriveManifest: to.Ptr(true), + LogLevel: to.Ptr("Verbose"), + State: to.Ptr(""), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.JobResponse = armstorageimportexport.JobResponse{ + // Name: to.Ptr("myJob"), + // Type: to.Ptr("Microsoft.ImportExport/jobs"), + // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ImportExport/jobs/myJob"), + // Identity: &armstorageimportexport.IdentityDetails{ + // Type: to.Ptr(armstorageimportexport.IdentityTypeNone), + // }, + // Location: to.Ptr("West US"), + // Properties: &armstorageimportexport.JobDetails{ + // BackupDriveManifest: to.Ptr(true), + // CancelRequested: to.Ptr(false), + // DiagnosticsPath: to.Ptr("waimportexport"), + // DriveList: []*armstorageimportexport.DriveStatus{ + // { + // DriveHeaderHash: to.Ptr("0:1048576:FB6B6ED500D49DA6E0D723C98D42C657F2881CC13357C28DCECA6A524F1292501571A321238540E621AB5BD9C9A32637615919A75593E6CB5C1515DAE341CABF;135266304:143360:C957A189AFC38C4E80731252301EB91427CE55E61448FA3C73C6FDDE70ABBC197947EC8D0249A2C639BB10B95957D5820A4BE8DFBBF76FFFA688AE5CE0D42EC3"), + // DriveID: to.Ptr("9CA995BB"), + // ManifestFile: to.Ptr("\\8a0c23f7-14b7-470a-9633-fcd46590a1bc.manifest"), + // ManifestHash: to.Ptr("4228EC5D8E048CB9B515338C789314BE8D0B2FDBC7C7A0308E1C826242CDE74E"), + // State: to.Ptr(armstorageimportexport.DriveStateSpecified), + // }}, + // EncryptionKey: &armstorageimportexport.EncryptionKeyDetails{ + // KekType: to.Ptr(armstorageimportexport.EncryptionKekTypeMicrosoftManaged), + // }, + // JobType: to.Ptr("Import"), + // LogLevel: to.Ptr("Verbose"), + // ProvisioningState: to.Ptr("Succeeded"), + // ReturnAddress: &armstorageimportexport.ReturnAddress{ + // City: to.Ptr("Redmond"), + // CountryOrRegion: to.Ptr("USA"), + // Email: to.Ptr("Test@contoso.com"), + // Phone: to.Ptr("4250000000"), + // PostalCode: to.Ptr("98007"), + // RecipientName: to.Ptr("Test"), + // StateOrProvince: to.Ptr("wa"), + // StreetAddress1: to.Ptr("Street1"), + // StreetAddress2: to.Ptr("street2"), + // }, + // ReturnShipping: &armstorageimportexport.ReturnShipping{ + // CarrierAccountNumber: to.Ptr("989ffff"), + // CarrierName: to.Ptr("FedEx"), + // }, + // ShippingInformation: &armstorageimportexport.ShippingInformation{ + // AdditionalInformation: to.Ptr(""), + // City: to.Ptr("Santa Clara"), + // CountryOrRegion: to.Ptr("USA"), + // Phone: to.Ptr("408 352 7600"), + // PostalCode: to.Ptr("95050"), + // RecipientName: to.Ptr("Microsoft Azure Import/Export Service"), + // StateOrProvince: to.Ptr("CA"), + // StreetAddress1: to.Ptr("2045 Lafayette Street"), + // StreetAddress2: to.Ptr(""), + // }, + // State: to.Ptr("Creating"), + // StorageAccountID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ClassicStorage/storageAccounts/test"), + // }, + // SystemData: &armstorageimportexport.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T01:01:01.1075056Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armstorageimportexport.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T02:03:01.1974346Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armstorageimportexport.CreatedByTypeUser), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/CreateExportJob.json +func ExampleJobsClient_Create_createExportJob() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewJobsClient().Create(ctx, "myExportJob", "myResourceGroup", armstorageimportexport.PutJobParameters{ + Location: to.Ptr("West US"), + Properties: &armstorageimportexport.JobDetails{ + BackupDriveManifest: to.Ptr(true), + DiagnosticsPath: to.Ptr("waimportexport"), + Export: &armstorageimportexport.Export{ + BlobList: &armstorageimportexport.ExportBlobList{ + BlobPathPrefix: []*string{ + to.Ptr("/")}, + }, + }, + JobType: to.Ptr("Export"), + LogLevel: to.Ptr("Verbose"), + ReturnAddress: &armstorageimportexport.ReturnAddress{ + City: to.Ptr("Redmond"), + CountryOrRegion: to.Ptr("USA"), + Email: to.Ptr("Test@contoso.com"), + Phone: to.Ptr("4250000000"), + PostalCode: to.Ptr("98007"), + RecipientName: to.Ptr("Test"), + StateOrProvince: to.Ptr("wa"), + StreetAddress1: to.Ptr("Street1"), + StreetAddress2: to.Ptr("street2"), + }, + ReturnShipping: &armstorageimportexport.ReturnShipping{ + CarrierAccountNumber: to.Ptr("989ffff"), + CarrierName: to.Ptr("FedEx"), + }, + StorageAccountID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ClassicStorage/storageAccounts/test"), + }, + }, &armstorageimportexport.JobsClientCreateOptions{ClientTenantID: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.JobResponse = armstorageimportexport.JobResponse{ + // Name: to.Ptr("myExportJob"), + // Type: to.Ptr("Microsoft.ImportExport/jobs"), + // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ImportExport/jobs/myExportJob"), + // Identity: &armstorageimportexport.IdentityDetails{ + // Type: to.Ptr(armstorageimportexport.IdentityTypeNone), + // }, + // Location: to.Ptr("West US"), + // Properties: &armstorageimportexport.JobDetails{ + // BackupDriveManifest: to.Ptr(true), + // CancelRequested: to.Ptr(false), + // DiagnosticsPath: to.Ptr("waimportexport"), + // EncryptionKey: &armstorageimportexport.EncryptionKeyDetails{ + // KekType: to.Ptr(armstorageimportexport.EncryptionKekTypeMicrosoftManaged), + // }, + // Export: &armstorageimportexport.Export{ + // BlobList: &armstorageimportexport.ExportBlobList{ + // BlobPathPrefix: []*string{ + // to.Ptr("/")}, + // }, + // }, + // JobType: to.Ptr("Export"), + // LogLevel: to.Ptr("Verbose"), + // ProvisioningState: to.Ptr("Succeeded"), + // ReturnAddress: &armstorageimportexport.ReturnAddress{ + // City: to.Ptr("Redmond"), + // CountryOrRegion: to.Ptr("USA"), + // Email: to.Ptr("Test@contoso.com"), + // Phone: to.Ptr("4250000000"), + // PostalCode: to.Ptr("98007"), + // RecipientName: to.Ptr("Test"), + // StateOrProvince: to.Ptr("wa"), + // StreetAddress1: to.Ptr("Street1"), + // StreetAddress2: to.Ptr("street2"), + // }, + // ReturnShipping: &armstorageimportexport.ReturnShipping{ + // CarrierAccountNumber: to.Ptr("989ffff"), + // CarrierName: to.Ptr("FedEx"), + // }, + // ShippingInformation: &armstorageimportexport.ShippingInformation{ + // AdditionalInformation: to.Ptr(""), + // City: to.Ptr("Santa Clara"), + // CountryOrRegion: to.Ptr("USA"), + // Phone: to.Ptr("408 0000 0000"), + // PostalCode: to.Ptr("95050"), + // RecipientName: to.Ptr("Microsoft Azure Import/Export Service"), + // StateOrProvince: to.Ptr("CA"), + // StreetAddress1: to.Ptr("2045 Lafayette Street"), + // StreetAddress2: to.Ptr(""), + // }, + // State: to.Ptr("Creating"), + // StorageAccountID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ClassicStorage/storageAccounts/test"), + // }, + // SystemData: &armstorageimportexport.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T01:01:01.1075056Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armstorageimportexport.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T02:03:01.1974346Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armstorageimportexport.CreatedByTypeUser), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/CreateJob.json +func ExampleJobsClient_Create_createImportJob() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewJobsClient().Create(ctx, "myJob", "myResourceGroup", armstorageimportexport.PutJobParameters{ + Location: to.Ptr("West US"), + Properties: &armstorageimportexport.JobDetails{ + BackupDriveManifest: to.Ptr(true), + DiagnosticsPath: to.Ptr("waimportexport"), + DriveList: []*armstorageimportexport.DriveStatus{ + { + BitLockerKey: to.Ptr("238810-662376-448998-450120-652806-203390-606320-483076"), + DriveHeaderHash: to.Ptr("0:1048576:FB6B6ED500D49DA6E0D723C98D42C657F2881CC13357C28DCECA6A524F1292501571A321238540E621AB5BD9C9A32637615919A75593E6CB5C1515DAE341CABF;135266304:143360:C957A189AFC38C4E80731252301EB91427CE55E61448FA3C73C6FDDE70ABBC197947EC8D0249A2C639BB10B95957D5820A4BE8DFBBF76FFFA688AE5CE0D42EC3"), + DriveID: to.Ptr("9CA995BB"), + ManifestFile: to.Ptr("\\8a0c23f7-14b7-470a-9633-fcd46590a1bc.manifest"), + ManifestHash: to.Ptr("4228EC5D8E048CB9B515338C789314BE8D0B2FDBC7C7A0308E1C826242CDE74E"), + }}, + JobType: to.Ptr("Import"), + LogLevel: to.Ptr("Verbose"), + ReturnAddress: &armstorageimportexport.ReturnAddress{ + City: to.Ptr("Redmond"), + CountryOrRegion: to.Ptr("USA"), + Email: to.Ptr("Test@contoso.com"), + Phone: to.Ptr("4250000000"), + PostalCode: to.Ptr("98007"), + RecipientName: to.Ptr("Test"), + StateOrProvince: to.Ptr("wa"), + StreetAddress1: to.Ptr("Street1"), + StreetAddress2: to.Ptr("street2"), + }, + ReturnShipping: &armstorageimportexport.ReturnShipping{ + CarrierAccountNumber: to.Ptr("989ffff"), + CarrierName: to.Ptr("FedEx"), + }, + StorageAccountID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ClassicStorage/storageAccounts/test"), + }, + }, &armstorageimportexport.JobsClientCreateOptions{ClientTenantID: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.JobResponse = armstorageimportexport.JobResponse{ + // Name: to.Ptr("myJob"), + // Type: to.Ptr("Microsoft.ImportExport/jobs"), + // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ImportExport/jobs/myJob"), + // Identity: &armstorageimportexport.IdentityDetails{ + // Type: to.Ptr(armstorageimportexport.IdentityTypeNone), + // }, + // Location: to.Ptr("West US"), + // Properties: &armstorageimportexport.JobDetails{ + // BackupDriveManifest: to.Ptr(true), + // CancelRequested: to.Ptr(false), + // DiagnosticsPath: to.Ptr("waimportexport"), + // DriveList: []*armstorageimportexport.DriveStatus{ + // { + // DriveHeaderHash: to.Ptr("0:1048576:FB6B6ED500D49DA6E0D723C98D42C657F2881CC13357C28DCECA6A524F1292501571A321238540E621AB5BD9C9A32637615919A75593E6CB5C1515DAE341CABF;135266304:143360:C957A189AFC38C4E80731252301EB91427CE55E61448FA3C73C6FDDE70ABBC197947EC8D0249A2C639BB10B95957D5820A4BE8DFBBF76FFFA688AE5CE0D42EC3"), + // DriveID: to.Ptr("9CA995BB"), + // ManifestFile: to.Ptr("\\8a0c23f7-14b7-470a-9633-fcd46590a1bc.manifest"), + // ManifestHash: to.Ptr("4228EC5D8E048CB9B515338C789314BE8D0B2FDBC7C7A0308E1C826242CDE74E"), + // State: to.Ptr(armstorageimportexport.DriveStateSpecified), + // }}, + // EncryptionKey: &armstorageimportexport.EncryptionKeyDetails{ + // KekType: to.Ptr(armstorageimportexport.EncryptionKekTypeMicrosoftManaged), + // }, + // JobType: to.Ptr("Import"), + // LogLevel: to.Ptr("Verbose"), + // ProvisioningState: to.Ptr("Succeeded"), + // ReturnAddress: &armstorageimportexport.ReturnAddress{ + // City: to.Ptr("Redmond"), + // CountryOrRegion: to.Ptr("USA"), + // Email: to.Ptr("Test@contoso.com"), + // Phone: to.Ptr("4250000000"), + // PostalCode: to.Ptr("98007"), + // RecipientName: to.Ptr("Test"), + // StateOrProvince: to.Ptr("wa"), + // StreetAddress1: to.Ptr("Street1"), + // StreetAddress2: to.Ptr("street2"), + // }, + // ReturnShipping: &armstorageimportexport.ReturnShipping{ + // CarrierAccountNumber: to.Ptr("989ffff"), + // CarrierName: to.Ptr("FedEx"), + // }, + // ShippingInformation: &armstorageimportexport.ShippingInformation{ + // AdditionalInformation: to.Ptr(""), + // City: to.Ptr("Santa Clara"), + // CountryOrRegion: to.Ptr("USA"), + // Phone: to.Ptr("408 0000 0000"), + // PostalCode: to.Ptr("95050"), + // RecipientName: to.Ptr("Microsoft Azure Import/Export Service"), + // StateOrProvince: to.Ptr("CA"), + // StreetAddress1: to.Ptr("2045 Lafayette Street"), + // StreetAddress2: to.Ptr(""), + // }, + // State: to.Ptr("Creating"), + // StorageAccountID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ClassicStorage/storageAccounts/test"), + // }, + // SystemData: &armstorageimportexport.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T01:01:01.1075056Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armstorageimportexport.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T02:03:01.1974346Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armstorageimportexport.CreatedByTypeUser), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/DeleteJob.json +func ExampleJobsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewJobsClient().Delete(ctx, "myJob", "myResourceGroup", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_locations_client.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/locations_client.go similarity index 80% rename from sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_locations_client.go rename to sdk/resourcemanager/storageimportexport/armstorageimportexport/locations_client.go index b28883dcf52e..74dba45dd410 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_locations_client.go +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/locations_client.go @@ -5,6 +5,7 @@ // 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 armstorageimportexport @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,31 +24,22 @@ import ( // LocationsClient contains the methods for the Locations group. // Don't use this type directly, use NewLocationsClient() instead. type LocationsClient struct { - host string + internal *arm.Client acceptLanguage *string - pl runtime.Pipeline } // NewLocationsClient creates a new instance of LocationsClient with the specified values. -// acceptLanguage - Specifies the preferred language for the response. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - acceptLanguage - Specifies the preferred language for the response. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewLocationsClient(acceptLanguage *string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocationsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".LocationsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &LocationsClient{ acceptLanguage: acceptLanguage, - host: ep, - pl: pl, + internal: cl, } return client, nil } @@ -57,15 +47,16 @@ func NewLocationsClient(acceptLanguage *string, credential azcore.TokenCredentia // Get - Returns the details about a location to which you can ship the disks associated with an import or export job. A location // is an Azure region. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-01-01 -// locationName - The name of the location. For example, West US or westus. -// options - LocationsClientGetOptions contains the optional parameters for the LocationsClient.Get method. +// - locationName - The name of the location. For example, West US or westus. +// - options - LocationsClientGetOptions contains the optional parameters for the LocationsClient.Get method. func (client *LocationsClient) Get(ctx context.Context, locationName string, options *LocationsClientGetOptions) (LocationsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, locationName, options) if err != nil { return LocationsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return LocationsClientGetResponse{}, err } @@ -82,7 +73,7 @@ func (client *LocationsClient) getCreateRequest(ctx context.Context, locationNam return nil, errors.New("parameter locationName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -107,9 +98,9 @@ func (client *LocationsClient) getHandleResponse(resp *http.Response) (Locations // NewListPager - Returns a list of locations to which you can ship the disks associated with an import or export job. A location // is a Microsoft data center region. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-01-01 -// options - LocationsClientListOptions contains the optional parameters for the LocationsClient.List method. +// - options - LocationsClientListOptions contains the optional parameters for the LocationsClient.NewListPager method. func (client *LocationsClient) NewListPager(options *LocationsClientListOptions) *runtime.Pager[LocationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[LocationsClientListResponse]{ More: func(page LocationsClientListResponse) bool { @@ -120,7 +111,7 @@ func (client *LocationsClient) NewListPager(options *LocationsClientListOptions) if err != nil { return LocationsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return LocationsClientListResponse{}, err } @@ -135,7 +126,7 @@ func (client *LocationsClient) NewListPager(options *LocationsClientListOptions) // listCreateRequest creates the List request. func (client *LocationsClient) listCreateRequest(ctx context.Context, options *LocationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.ImportExport/locations" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/locations_client_example_test.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/locations_client_example_test.go new file mode 100644 index 000000000000..265dbd265cab --- /dev/null +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/locations_client_example_test.go @@ -0,0 +1,126 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armstorageimportexport_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storageimportexport/armstorageimportexport" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/ListLocations.json +func ExampleLocationsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewLocationsClient().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.LocationsResponse = armstorageimportexport.LocationsResponse{ + // Value: []*armstorageimportexport.Location{ + // { + // Name: to.Ptr("Australia East"), + // Type: to.Ptr("Microsoft.ImportExport/locations"), + // ID: to.Ptr("/providers/Microsoft.ImportExport/locations/australiaeast"), + // Properties: &armstorageimportexport.LocationProperties{ + // AdditionalShippingInformation: to.Ptr(""), + // AlternateLocations: []*string{ + // to.Ptr("/providers/Microsoft.ImportExport/locations/australiaeast")}, + // City: to.Ptr("Macquarie Park"), + // CountryOrRegion: to.Ptr("Australia"), + // Phone: to.Ptr("612 0000 0000"), + // PostalCode: to.Ptr("2113"), + // RecipientName: to.Ptr("Windows Azure Import/Export Service"), + // StateOrProvince: to.Ptr("NSW"), + // StreetAddress1: to.Ptr("Customer-A c/o NEXTDC Ltd, Delivery code ABCDEFG, 4 Eden Park Drive"), + // StreetAddress2: to.Ptr(""), + // SupportedCarriers: []*string{ + // to.Ptr("DHL")}, + // }, + // }, + // { + // Name: to.Ptr("Australia Southeast"), + // Type: to.Ptr("Microsoft.ImportExport/locations"), + // ID: to.Ptr("/providers/Microsoft.ImportExport/locations/australiasoutheast"), + // Properties: &armstorageimportexport.LocationProperties{ + // AdditionalShippingInformation: to.Ptr(""), + // AlternateLocations: []*string{ + // to.Ptr("/providers/Microsoft.ImportExport/locations/australiasoutheast")}, + // City: to.Ptr("Melbourne"), + // CountryOrRegion: to.Ptr("Australia"), + // Phone: to.Ptr("61 0 0000 0000"), + // PostalCode: to.Ptr("3207"), + // RecipientName: to.Ptr("Microsoft Azure Import/Export Service"), + // StateOrProvince: to.Ptr("Melbourne"), + // StreetAddress1: to.Ptr("Microsoft, c/o NEXTDC Ltd, Delivery code ABCDEFG, 826-830 Lorimer St, Port"), + // StreetAddress2: to.Ptr(""), + // SupportedCarriers: []*string{ + // to.Ptr("DHL")}, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/GetLocation.json +func ExampleLocationsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstorageimportexport.NewClientFactory("", nil, cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocationsClient().Get(ctx, "West US", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Location = armstorageimportexport.Location{ + // Name: to.Ptr("West US"), + // Type: to.Ptr("Microsoft.ImportExport/locations"), + // ID: to.Ptr("/providers/Microsoft.ImportExport/locations/westus"), + // Properties: &armstorageimportexport.LocationProperties{ + // AdditionalShippingInformation: to.Ptr(""), + // AlternateLocations: []*string{ + // to.Ptr("/providers/Microsoft.ImportExport/locations/westus")}, + // City: to.Ptr("Santa Clara"), + // CountryOrRegion: to.Ptr("USA"), + // Phone: to.Ptr("408 352 7600"), + // PostalCode: to.Ptr("95050"), + // RecipientName: to.Ptr("Microsoft Azure Import/Export Service"), + // StateOrProvince: to.Ptr("CA"), + // StreetAddress1: to.Ptr("2045 Lafayette Street"), + // StreetAddress2: to.Ptr(""), + // SupportedCarriers: []*string{ + // to.Ptr("FedEx")}, + // }, + // } +} diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_models.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/models.go similarity index 98% rename from sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_models.go rename to sdk/resourcemanager/storageimportexport/armstorageimportexport/models.go index 4ce3c5d3f84e..d7d4bff9ce16 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_models.go +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/models.go @@ -5,12 +5,13 @@ // 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 armstorageimportexport import "time" -// BitLockerKeysClientListOptions contains the optional parameters for the BitLockerKeysClient.List method. +// BitLockerKeysClientListOptions contains the optional parameters for the BitLockerKeysClient.NewListPager method. type BitLockerKeysClientListOptions struct { } @@ -106,7 +107,7 @@ type ErrorResponseError struct { Details []*ErrorResponseErrorDetailsItem `json:"details,omitempty"` // Inner error object if present. - Innererror interface{} `json:"innererror,omitempty"` + Innererror any `json:"innererror,omitempty"` // Provides information about the error message. Message *string `json:"message,omitempty"` @@ -240,7 +241,7 @@ type JobResponse struct { Properties *JobDetails `json:"properties,omitempty"` // Specifies the tags that are assigned to the job. - Tags interface{} `json:"tags,omitempty"` + Tags any `json:"tags,omitempty"` // READ-ONLY; Specifies the resource identifier of the job. ID *string `json:"id,omitempty" azure:"ro"` @@ -271,7 +272,7 @@ type JobsClientGetOptions struct { // placeholder for future optional parameters } -// JobsClientListByResourceGroupOptions contains the optional parameters for the JobsClient.ListByResourceGroup method. +// JobsClientListByResourceGroupOptions contains the optional parameters for the JobsClient.NewListByResourceGroupPager method. type JobsClientListByResourceGroupOptions struct { // Can be used to restrict the results to certain conditions. Filter *string @@ -279,7 +280,7 @@ type JobsClientListByResourceGroupOptions struct { Top *int64 } -// JobsClientListBySubscriptionOptions contains the optional parameters for the JobsClient.ListBySubscription method. +// JobsClientListBySubscriptionOptions contains the optional parameters for the JobsClient.NewListBySubscriptionPager method. type JobsClientListBySubscriptionOptions struct { // Can be used to restrict the results to certain conditions. Filter *string @@ -365,7 +366,7 @@ type LocationsClientGetOptions struct { // placeholder for future optional parameters } -// LocationsClientListOptions contains the optional parameters for the LocationsClient.List method. +// LocationsClientListOptions contains the optional parameters for the LocationsClient.NewListPager method. type LocationsClientListOptions struct { } @@ -399,7 +400,7 @@ type OperationDisplay struct { Resource *string `json:"resource,omitempty"` } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { } @@ -427,7 +428,7 @@ type PutJobParameters struct { Properties *JobDetails `json:"properties,omitempty"` // Specifies the tags that will be assigned to the job. - Tags interface{} `json:"tags,omitempty"` + Tags any `json:"tags,omitempty"` } // ReturnAddress - Specifies the return address information for the job. @@ -526,7 +527,7 @@ type UpdateJobParameters struct { Properties *UpdateJobParametersProperties `json:"properties,omitempty"` // Specifies the tags that will be assigned to the job - Tags interface{} `json:"tags,omitempty"` + Tags any `json:"tags,omitempty"` } // UpdateJobParametersProperties - Specifies the properties of a UpdateJob. diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/models_serde.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/models_serde.go new file mode 100644 index 000000000000..2cd6fbc06db7 --- /dev/null +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/models_serde.go @@ -0,0 +1,1209 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armstorageimportexport + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type DeliveryPackageInformation. +func (d DeliveryPackageInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "carrierName", d.CarrierName) + populate(objectMap, "driveCount", d.DriveCount) + populate(objectMap, "shipDate", d.ShipDate) + populate(objectMap, "trackingNumber", d.TrackingNumber) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeliveryPackageInformation. +func (d *DeliveryPackageInformation) UnmarshalJSON(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 "carrierName": + err = unpopulate(val, "CarrierName", &d.CarrierName) + delete(rawMsg, key) + case "driveCount": + err = unpopulate(val, "DriveCount", &d.DriveCount) + delete(rawMsg, key) + case "shipDate": + err = unpopulate(val, "ShipDate", &d.ShipDate) + delete(rawMsg, key) + case "trackingNumber": + err = unpopulate(val, "TrackingNumber", &d.TrackingNumber) + 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 DriveBitLockerKey. +func (d DriveBitLockerKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "bitLockerKey", d.BitLockerKey) + populate(objectMap, "driveId", d.DriveID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DriveBitLockerKey. +func (d *DriveBitLockerKey) UnmarshalJSON(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 "bitLockerKey": + err = unpopulate(val, "BitLockerKey", &d.BitLockerKey) + delete(rawMsg, key) + case "driveId": + err = unpopulate(val, "DriveID", &d.DriveID) + 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 DriveStatus. +func (d DriveStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "bitLockerKey", d.BitLockerKey) + populate(objectMap, "bytesSucceeded", d.BytesSucceeded) + populate(objectMap, "copyStatus", d.CopyStatus) + populate(objectMap, "driveHeaderHash", d.DriveHeaderHash) + populate(objectMap, "driveId", d.DriveID) + populate(objectMap, "errorLogUri", d.ErrorLogURI) + populate(objectMap, "manifestFile", d.ManifestFile) + populate(objectMap, "manifestHash", d.ManifestHash) + populate(objectMap, "manifestUri", d.ManifestURI) + populate(objectMap, "percentComplete", d.PercentComplete) + populate(objectMap, "state", d.State) + populate(objectMap, "verboseLogUri", d.VerboseLogURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DriveStatus. +func (d *DriveStatus) UnmarshalJSON(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 "bitLockerKey": + err = unpopulate(val, "BitLockerKey", &d.BitLockerKey) + delete(rawMsg, key) + case "bytesSucceeded": + err = unpopulate(val, "BytesSucceeded", &d.BytesSucceeded) + delete(rawMsg, key) + case "copyStatus": + err = unpopulate(val, "CopyStatus", &d.CopyStatus) + delete(rawMsg, key) + case "driveHeaderHash": + err = unpopulate(val, "DriveHeaderHash", &d.DriveHeaderHash) + delete(rawMsg, key) + case "driveId": + err = unpopulate(val, "DriveID", &d.DriveID) + delete(rawMsg, key) + case "errorLogUri": + err = unpopulate(val, "ErrorLogURI", &d.ErrorLogURI) + delete(rawMsg, key) + case "manifestFile": + err = unpopulate(val, "ManifestFile", &d.ManifestFile) + delete(rawMsg, key) + case "manifestHash": + err = unpopulate(val, "ManifestHash", &d.ManifestHash) + delete(rawMsg, key) + case "manifestUri": + err = unpopulate(val, "ManifestURI", &d.ManifestURI) + delete(rawMsg, key) + case "percentComplete": + err = unpopulate(val, "PercentComplete", &d.PercentComplete) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &d.State) + delete(rawMsg, key) + case "verboseLogUri": + err = unpopulate(val, "VerboseLogURI", &d.VerboseLogURI) + 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 EncryptionKeyDetails. +func (e EncryptionKeyDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "kekType", e.KekType) + populate(objectMap, "kekUrl", e.KekURL) + populate(objectMap, "kekVaultResourceID", e.KekVaultResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionKeyDetails. +func (e *EncryptionKeyDetails) UnmarshalJSON(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 "kekType": + err = unpopulate(val, "KekType", &e.KekType) + delete(rawMsg, key) + case "kekUrl": + err = unpopulate(val, "KekURL", &e.KekURL) + delete(rawMsg, key) + case "kekVaultResourceID": + err = unpopulate(val, "KekVaultResourceID", &e.KekVaultResourceID) + 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 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 ErrorResponseError. +func (e ErrorResponseError) 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 ErrorResponseError. +func (e *ErrorResponseError) UnmarshalJSON(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 ErrorResponseErrorDetailsItem. +func (e ErrorResponseErrorDetailsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseErrorDetailsItem. +func (e *ErrorResponseErrorDetailsItem) UnmarshalJSON(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 "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 Export. +func (e Export) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blobList", e.BlobList) + populate(objectMap, "blobListBlobPath", e.BlobListBlobPath) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Export. +func (e *Export) UnmarshalJSON(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 "blobList": + err = unpopulate(val, "BlobList", &e.BlobList) + delete(rawMsg, key) + case "blobListBlobPath": + err = unpopulate(val, "BlobListBlobPath", &e.BlobListBlobPath) + 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 ExportBlobList. +func (e ExportBlobList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blobPath", e.BlobPath) + populate(objectMap, "blobPathPrefix", e.BlobPathPrefix) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportBlobList. +func (e *ExportBlobList) UnmarshalJSON(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 "blobPath": + err = unpopulate(val, "BlobPath", &e.BlobPath) + delete(rawMsg, key) + case "blobPathPrefix": + err = unpopulate(val, "BlobPathPrefix", &e.BlobPathPrefix) + 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 GetBitLockerKeysResponse. +func (g GetBitLockerKeysResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GetBitLockerKeysResponse. +func (g *GetBitLockerKeysResponse) UnmarshalJSON(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 "value": + err = unpopulate(val, "Value", &g.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IdentityDetails. +func (i IdentityDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityDetails. +func (i *IdentityDetails) UnmarshalJSON(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 "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobDetails. +func (j JobDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupDriveManifest", j.BackupDriveManifest) + populate(objectMap, "cancelRequested", j.CancelRequested) + populate(objectMap, "deliveryPackage", j.DeliveryPackage) + populate(objectMap, "diagnosticsPath", j.DiagnosticsPath) + populate(objectMap, "driveList", j.DriveList) + populate(objectMap, "encryptionKey", j.EncryptionKey) + populate(objectMap, "export", j.Export) + populate(objectMap, "incompleteBlobListUri", j.IncompleteBlobListURI) + populate(objectMap, "jobType", j.JobType) + populate(objectMap, "logLevel", j.LogLevel) + populate(objectMap, "percentComplete", j.PercentComplete) + populate(objectMap, "provisioningState", j.ProvisioningState) + populate(objectMap, "returnAddress", j.ReturnAddress) + populate(objectMap, "returnPackage", j.ReturnPackage) + populate(objectMap, "returnShipping", j.ReturnShipping) + populate(objectMap, "shippingInformation", j.ShippingInformation) + populate(objectMap, "state", j.State) + populate(objectMap, "storageAccountId", j.StorageAccountID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobDetails. +func (j *JobDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupDriveManifest": + err = unpopulate(val, "BackupDriveManifest", &j.BackupDriveManifest) + delete(rawMsg, key) + case "cancelRequested": + err = unpopulate(val, "CancelRequested", &j.CancelRequested) + delete(rawMsg, key) + case "deliveryPackage": + err = unpopulate(val, "DeliveryPackage", &j.DeliveryPackage) + delete(rawMsg, key) + case "diagnosticsPath": + err = unpopulate(val, "DiagnosticsPath", &j.DiagnosticsPath) + delete(rawMsg, key) + case "driveList": + err = unpopulate(val, "DriveList", &j.DriveList) + delete(rawMsg, key) + case "encryptionKey": + err = unpopulate(val, "EncryptionKey", &j.EncryptionKey) + delete(rawMsg, key) + case "export": + err = unpopulate(val, "Export", &j.Export) + delete(rawMsg, key) + case "incompleteBlobListUri": + err = unpopulate(val, "IncompleteBlobListURI", &j.IncompleteBlobListURI) + delete(rawMsg, key) + case "jobType": + err = unpopulate(val, "JobType", &j.JobType) + delete(rawMsg, key) + case "logLevel": + err = unpopulate(val, "LogLevel", &j.LogLevel) + delete(rawMsg, key) + case "percentComplete": + err = unpopulate(val, "PercentComplete", &j.PercentComplete) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &j.ProvisioningState) + delete(rawMsg, key) + case "returnAddress": + err = unpopulate(val, "ReturnAddress", &j.ReturnAddress) + delete(rawMsg, key) + case "returnPackage": + err = unpopulate(val, "ReturnPackage", &j.ReturnPackage) + delete(rawMsg, key) + case "returnShipping": + err = unpopulate(val, "ReturnShipping", &j.ReturnShipping) + delete(rawMsg, key) + case "shippingInformation": + err = unpopulate(val, "ShippingInformation", &j.ShippingInformation) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &j.State) + delete(rawMsg, key) + case "storageAccountId": + err = unpopulate(val, "StorageAccountID", &j.StorageAccountID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobResponse. +func (j JobResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", j.ID) + populate(objectMap, "identity", j.Identity) + populate(objectMap, "location", j.Location) + populate(objectMap, "name", j.Name) + populate(objectMap, "properties", j.Properties) + populate(objectMap, "systemData", j.SystemData) + populate(objectMap, "tags", &j.Tags) + populate(objectMap, "type", j.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobResponse. +func (j *JobResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &j.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &j.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &j.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &j.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &j.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &j.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &j.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &j.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListJobsResponse. +func (l ListJobsResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListJobsResponse. +func (l *ListJobsResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListOperationsResponse. +func (l ListOperationsResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListOperationsResponse. +func (l *ListOperationsResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Location. +func (l Location) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", l.ID) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Location. +func (l *Location) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LocationProperties. +func (l LocationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalShippingInformation", l.AdditionalShippingInformation) + populate(objectMap, "alternateLocations", l.AlternateLocations) + populate(objectMap, "city", l.City) + populate(objectMap, "countryOrRegion", l.CountryOrRegion) + populate(objectMap, "phone", l.Phone) + populate(objectMap, "postalCode", l.PostalCode) + populate(objectMap, "recipientName", l.RecipientName) + populate(objectMap, "stateOrProvince", l.StateOrProvince) + populate(objectMap, "streetAddress1", l.StreetAddress1) + populate(objectMap, "streetAddress2", l.StreetAddress2) + populate(objectMap, "supportedCarriers", l.SupportedCarriers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocationProperties. +func (l *LocationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalShippingInformation": + err = unpopulate(val, "AdditionalShippingInformation", &l.AdditionalShippingInformation) + delete(rawMsg, key) + case "alternateLocations": + err = unpopulate(val, "AlternateLocations", &l.AlternateLocations) + delete(rawMsg, key) + case "city": + err = unpopulate(val, "City", &l.City) + delete(rawMsg, key) + case "countryOrRegion": + err = unpopulate(val, "CountryOrRegion", &l.CountryOrRegion) + delete(rawMsg, key) + case "phone": + err = unpopulate(val, "Phone", &l.Phone) + delete(rawMsg, key) + case "postalCode": + err = unpopulate(val, "PostalCode", &l.PostalCode) + delete(rawMsg, key) + case "recipientName": + err = unpopulate(val, "RecipientName", &l.RecipientName) + delete(rawMsg, key) + case "stateOrProvince": + err = unpopulate(val, "StateOrProvince", &l.StateOrProvince) + delete(rawMsg, key) + case "streetAddress1": + err = unpopulate(val, "StreetAddress1", &l.StreetAddress1) + delete(rawMsg, key) + case "streetAddress2": + err = unpopulate(val, "StreetAddress2", &l.StreetAddress2) + delete(rawMsg, key) + case "supportedCarriers": + err = unpopulate(val, "SupportedCarriers", &l.SupportedCarriers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LocationsResponse. +func (l LocationsResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocationsResponse. +func (l *LocationsResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, 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, "display", o.Display) + populate(objectMap, "name", o.Name) + 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 "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + 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 PackageInformation. +func (p PackageInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "carrierName", p.CarrierName) + populate(objectMap, "driveCount", p.DriveCount) + populate(objectMap, "shipDate", p.ShipDate) + populate(objectMap, "trackingNumber", p.TrackingNumber) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PackageInformation. +func (p *PackageInformation) UnmarshalJSON(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 "carrierName": + err = unpopulate(val, "CarrierName", &p.CarrierName) + delete(rawMsg, key) + case "driveCount": + err = unpopulate(val, "DriveCount", &p.DriveCount) + delete(rawMsg, key) + case "shipDate": + err = unpopulate(val, "ShipDate", &p.ShipDate) + delete(rawMsg, key) + case "trackingNumber": + err = unpopulate(val, "TrackingNumber", &p.TrackingNumber) + 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 PutJobParameters. +func (p PutJobParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "location", p.Location) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", &p.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PutJobParameters. +func (p *PutJobParameters) UnmarshalJSON(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 "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReturnAddress. +func (r ReturnAddress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "city", r.City) + populate(objectMap, "countryOrRegion", r.CountryOrRegion) + populate(objectMap, "email", r.Email) + populate(objectMap, "phone", r.Phone) + populate(objectMap, "postalCode", r.PostalCode) + populate(objectMap, "recipientName", r.RecipientName) + populate(objectMap, "stateOrProvince", r.StateOrProvince) + populate(objectMap, "streetAddress1", r.StreetAddress1) + populate(objectMap, "streetAddress2", r.StreetAddress2) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReturnAddress. +func (r *ReturnAddress) UnmarshalJSON(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 "city": + err = unpopulate(val, "City", &r.City) + delete(rawMsg, key) + case "countryOrRegion": + err = unpopulate(val, "CountryOrRegion", &r.CountryOrRegion) + delete(rawMsg, key) + case "email": + err = unpopulate(val, "Email", &r.Email) + delete(rawMsg, key) + case "phone": + err = unpopulate(val, "Phone", &r.Phone) + delete(rawMsg, key) + case "postalCode": + err = unpopulate(val, "PostalCode", &r.PostalCode) + delete(rawMsg, key) + case "recipientName": + err = unpopulate(val, "RecipientName", &r.RecipientName) + delete(rawMsg, key) + case "stateOrProvince": + err = unpopulate(val, "StateOrProvince", &r.StateOrProvince) + delete(rawMsg, key) + case "streetAddress1": + err = unpopulate(val, "StreetAddress1", &r.StreetAddress1) + delete(rawMsg, key) + case "streetAddress2": + err = unpopulate(val, "StreetAddress2", &r.StreetAddress2) + 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 ReturnShipping. +func (r ReturnShipping) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "carrierAccountNumber", r.CarrierAccountNumber) + populate(objectMap, "carrierName", r.CarrierName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReturnShipping. +func (r *ReturnShipping) UnmarshalJSON(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 "carrierAccountNumber": + err = unpopulate(val, "CarrierAccountNumber", &r.CarrierAccountNumber) + delete(rawMsg, key) + case "carrierName": + err = unpopulate(val, "CarrierName", &r.CarrierName) + 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 ShippingInformation. +func (s ShippingInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInformation", s.AdditionalInformation) + populate(objectMap, "city", s.City) + populate(objectMap, "countryOrRegion", s.CountryOrRegion) + populate(objectMap, "phone", s.Phone) + populate(objectMap, "postalCode", s.PostalCode) + populate(objectMap, "recipientName", s.RecipientName) + populate(objectMap, "stateOrProvince", s.StateOrProvince) + populate(objectMap, "streetAddress1", s.StreetAddress1) + populate(objectMap, "streetAddress2", s.StreetAddress2) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ShippingInformation. +func (s *ShippingInformation) UnmarshalJSON(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 "additionalInformation": + err = unpopulate(val, "AdditionalInformation", &s.AdditionalInformation) + delete(rawMsg, key) + case "city": + err = unpopulate(val, "City", &s.City) + delete(rawMsg, key) + case "countryOrRegion": + err = unpopulate(val, "CountryOrRegion", &s.CountryOrRegion) + delete(rawMsg, key) + case "phone": + err = unpopulate(val, "Phone", &s.Phone) + delete(rawMsg, key) + case "postalCode": + err = unpopulate(val, "PostalCode", &s.PostalCode) + delete(rawMsg, key) + case "recipientName": + err = unpopulate(val, "RecipientName", &s.RecipientName) + delete(rawMsg, key) + case "stateOrProvince": + err = unpopulate(val, "StateOrProvince", &s.StateOrProvince) + delete(rawMsg, key) + case "streetAddress1": + err = unpopulate(val, "StreetAddress1", &s.StreetAddress1) + delete(rawMsg, key) + case "streetAddress2": + err = unpopulate(val, "StreetAddress2", &s.StreetAddress2) + 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) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(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 = unpopulateTimeRFC3339(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 = unpopulateTimeRFC3339(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 UpdateJobParameters. +func (u UpdateJobParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "tags", &u.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateJobParameters. +func (u *UpdateJobParameters) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &u.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &u.Tags) + 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 UpdateJobParametersProperties. +func (u UpdateJobParametersProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupDriveManifest", u.BackupDriveManifest) + populate(objectMap, "cancelRequested", u.CancelRequested) + populate(objectMap, "deliveryPackage", u.DeliveryPackage) + populate(objectMap, "driveList", u.DriveList) + populate(objectMap, "logLevel", u.LogLevel) + populate(objectMap, "returnAddress", u.ReturnAddress) + populate(objectMap, "returnShipping", u.ReturnShipping) + populate(objectMap, "state", u.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateJobParametersProperties. +func (u *UpdateJobParametersProperties) UnmarshalJSON(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 "backupDriveManifest": + err = unpopulate(val, "BackupDriveManifest", &u.BackupDriveManifest) + delete(rawMsg, key) + case "cancelRequested": + err = unpopulate(val, "CancelRequested", &u.CancelRequested) + delete(rawMsg, key) + case "deliveryPackage": + err = unpopulate(val, "DeliveryPackage", &u.DeliveryPackage) + delete(rawMsg, key) + case "driveList": + err = unpopulate(val, "DriveList", &u.DriveList) + delete(rawMsg, key) + case "logLevel": + err = unpopulate(val, "LogLevel", &u.LogLevel) + delete(rawMsg, key) + case "returnAddress": + err = unpopulate(val, "ReturnAddress", &u.ReturnAddress) + delete(rawMsg, key) + case "returnShipping": + err = unpopulate(val, "ReturnShipping", &u.ReturnShipping) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &u.State) + 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 { + 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/storageimportexport/armstorageimportexport/zz_generated_operations_client.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/operations_client.go similarity index 75% rename from sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_operations_client.go rename to sdk/resourcemanager/storageimportexport/armstorageimportexport/operations_client.go index 20b304dbfe0b..c83343a7be88 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_operations_client.go +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/operations_client.go @@ -5,6 +5,7 @@ // 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 armstorageimportexport @@ -12,8 +13,6 @@ import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -22,39 +21,30 @@ import ( // OperationsClient contains the methods for the Operations group. // Don't use this type directly, use NewOperationsClient() instead. type OperationsClient struct { - host string + internal *arm.Client acceptLanguage *string - pl runtime.Pipeline } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -// acceptLanguage - Specifies the preferred language for the response. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - acceptLanguage - Specifies the preferred language for the response. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewOperationsClient(acceptLanguage *string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &OperationsClient{ acceptLanguage: acceptLanguage, - host: ep, - pl: pl, + internal: cl, } return client, nil } // NewListPager - Returns the list of operations supported by the import/export resource provider. -// If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-01-01 -// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// - 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 { @@ -65,7 +55,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption if err != nil { return OperationsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return OperationsClientListResponse{}, err } @@ -80,7 +70,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption // listCreateRequest creates the List request. func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.ImportExport/operations" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/operations_client_example_test.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/operations_client_example_test.go new file mode 100644 index 000000000000..8c630ac18a80 --- /dev/null +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/operations_client_example_test.go @@ -0,0 +1,100 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights 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 armstorageimportexport_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storageimportexport/armstorageimportexport" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/ListOperations.json +func ExampleOperationsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstorageimportexport.NewClientFactory("", nil, 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.ListOperationsResponse = armstorageimportexport.ListOperationsResponse{ + // Value: []*armstorageimportexport.Operation{ + // { + // Name: to.Ptr("Microsoft.ImportExport/locations/read"), + // Display: &armstorageimportexport.OperationDisplay{ + // Description: to.Ptr("Gets the properties for the specified location or returns the list of locations."), + // Operation: to.Ptr("Get or List Locations"), + // Provider: to.Ptr("Microsoft Import/Export"), + // Resource: to.Ptr("Locations"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.ImportExport/jobs/write"), + // Display: &armstorageimportexport.OperationDisplay{ + // Description: to.Ptr("Creates a job with the specified parameters or update the properties or tags for the specified job."), + // Operation: to.Ptr("Create or Update Job"), + // Provider: to.Ptr("Microsoft Import/Export"), + // Resource: to.Ptr("Jobs"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.ImportExport/jobs/read"), + // Display: &armstorageimportexport.OperationDisplay{ + // Description: to.Ptr("Gets the properties for the specified job or returns the list of jobs."), + // Operation: to.Ptr("Get or List Jobs"), + // Provider: to.Ptr("Microsoft Import/Export"), + // Resource: to.Ptr("Jobs"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.ImportExport/jobs/listBitLockerKeys/action"), + // Display: &armstorageimportexport.OperationDisplay{ + // Description: to.Ptr("Gets the BitLocker keys for the specified job."), + // Operation: to.Ptr("List BitLocker Keys"), + // Provider: to.Ptr("Microsoft Import/Export"), + // Resource: to.Ptr("Jobs"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.ImportExport/jobs/delete"), + // Display: &armstorageimportexport.OperationDisplay{ + // Description: to.Ptr("Deletes an existing job."), + // Operation: to.Ptr("Delete Job"), + // Provider: to.Ptr("Microsoft Import/Export"), + // Resource: to.Ptr("Jobs"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.ImportExport/register/action"), + // Display: &armstorageimportexport.OperationDisplay{ + // Description: to.Ptr("Registers the subscription for the import/export resource provider and enables the creation of import/export jobs."), + // Operation: to.Ptr("Registers the Import/Export Resource Provider"), + // Provider: to.Ptr("Microsoft Import/Export"), + // Resource: to.Ptr("Import/Export Resource Provider"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_response_types.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/response_types.go similarity index 88% rename from sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_response_types.go rename to sdk/resourcemanager/storageimportexport/armstorageimportexport/response_types.go index 6f9a8ca48d6b..9d00fbcf4913 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_response_types.go +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/response_types.go @@ -5,10 +5,11 @@ // 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 armstorageimportexport -// BitLockerKeysClientListResponse contains the response from method BitLockerKeysClient.List. +// BitLockerKeysClientListResponse contains the response from method BitLockerKeysClient.NewListPager. type BitLockerKeysClientListResponse struct { GetBitLockerKeysResponse } @@ -28,12 +29,12 @@ type JobsClientGetResponse struct { JobResponse } -// JobsClientListByResourceGroupResponse contains the response from method JobsClient.ListByResourceGroup. +// JobsClientListByResourceGroupResponse contains the response from method JobsClient.NewListByResourceGroupPager. type JobsClientListByResourceGroupResponse struct { ListJobsResponse } -// JobsClientListBySubscriptionResponse contains the response from method JobsClient.ListBySubscription. +// JobsClientListBySubscriptionResponse contains the response from method JobsClient.NewListBySubscriptionPager. type JobsClientListBySubscriptionResponse struct { ListJobsResponse } @@ -48,12 +49,12 @@ type LocationsClientGetResponse struct { Location } -// LocationsClientListResponse contains the response from method LocationsClient.List. +// LocationsClientListResponse contains the response from method LocationsClient.NewListPager. type LocationsClientListResponse struct { LocationsResponse } -// OperationsClientListResponse contains the response from method OperationsClient.List. +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { ListOperationsResponse } diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_time_rfc3339.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/time_rfc3339.go similarity index 96% rename from sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/storageimportexport/armstorageimportexport/time_rfc3339.go index 20f0dbf04eb7..4ba2f79b07ac 100644 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/storageimportexport/armstorageimportexport/time_rfc3339.go @@ -5,6 +5,7 @@ // 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 armstorageimportexport @@ -61,7 +62,7 @@ func (t *timeRFC3339) Parse(layout, value string) error { return err } -func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/ze_generated_example_bitlockerkeys_client_test.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/ze_generated_example_bitlockerkeys_client_test.go deleted file mode 100644 index d8536aa96e16..000000000000 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/ze_generated_example_bitlockerkeys_client_test.go +++ /dev/null @@ -1,44 +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. - -package armstorageimportexport_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storageimportexport/armstorageimportexport" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/ListBitLockerKeys.json -func ExampleBitLockerKeysClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorageimportexport.NewBitLockerKeysClient("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - nil, cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myJob", - "myResourceGroup", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/ze_generated_example_jobs_client_test.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/ze_generated_example_jobs_client_test.go deleted file mode 100644 index 7625aea480e4..000000000000 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/ze_generated_example_jobs_client_test.go +++ /dev/null @@ -1,201 +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. - -package armstorageimportexport_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/storageimportexport/armstorageimportexport" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/ListJobsInSubscription.json -func ExampleJobsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorageimportexport.NewJobsClient("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - nil, cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(&armstorageimportexport.JobsClientListBySubscriptionOptions{Top: nil, - Filter: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/ListJobsInResourceGroup.json -func ExampleJobsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorageimportexport.NewJobsClient("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - nil, cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("myResourceGroup", - &armstorageimportexport.JobsClientListByResourceGroupOptions{Top: nil, - Filter: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/GetExportJob.json -func ExampleJobsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorageimportexport.NewJobsClient("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - nil, cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myJob", - "myResourceGroup", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/UpdateExportJob.json -func ExampleJobsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorageimportexport.NewJobsClient("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - nil, cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "myExportJob", - "myResourceGroup", - armstorageimportexport.UpdateJobParameters{ - Properties: &armstorageimportexport.UpdateJobParametersProperties{ - BackupDriveManifest: to.Ptr(true), - LogLevel: to.Ptr("Verbose"), - State: to.Ptr(""), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/CreateExportJob.json -func ExampleJobsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorageimportexport.NewJobsClient("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - nil, cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, - "myExportJob", - "myResourceGroup", - armstorageimportexport.PutJobParameters{ - Location: to.Ptr("West US"), - Properties: &armstorageimportexport.JobDetails{ - BackupDriveManifest: to.Ptr(true), - DiagnosticsPath: to.Ptr("waimportexport"), - Export: &armstorageimportexport.Export{ - BlobList: &armstorageimportexport.ExportBlobList{ - BlobPathPrefix: []*string{ - to.Ptr("/")}, - }, - }, - JobType: to.Ptr("Export"), - LogLevel: to.Ptr("Verbose"), - ReturnAddress: &armstorageimportexport.ReturnAddress{ - City: to.Ptr("Redmond"), - CountryOrRegion: to.Ptr("USA"), - Email: to.Ptr("Test@contoso.com"), - Phone: to.Ptr("4250000000"), - PostalCode: to.Ptr("98007"), - RecipientName: to.Ptr("Test"), - StateOrProvince: to.Ptr("wa"), - StreetAddress1: to.Ptr("Street1"), - StreetAddress2: to.Ptr("street2"), - }, - ReturnShipping: &armstorageimportexport.ReturnShipping{ - CarrierAccountNumber: to.Ptr("989ffff"), - CarrierName: to.Ptr("FedEx"), - }, - StorageAccountID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ClassicStorage/storageAccounts/test"), - }, - }, - &armstorageimportexport.JobsClientCreateOptions{ClientTenantID: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/DeleteJob.json -func ExampleJobsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorageimportexport.NewJobsClient("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - nil, cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "myJob", - "myResourceGroup", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/ze_generated_example_locations_client_test.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/ze_generated_example_locations_client_test.go deleted file mode 100644 index f311aa58ba7f..000000000000 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/ze_generated_example_locations_client_test.go +++ /dev/null @@ -1,62 +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. - -package armstorageimportexport_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storageimportexport/armstorageimportexport" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/ListLocations.json -func ExampleLocationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorageimportexport.NewLocationsClient(nil, cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/GetLocation.json -func ExampleLocationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorageimportexport.NewLocationsClient(nil, cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "West US", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/ze_generated_example_operations_client_test.go deleted file mode 100644 index 16675034af83..000000000000 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/ze_generated_example_operations_client_test.go +++ /dev/null @@ -1,41 +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. - -package armstorageimportexport_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storageimportexport/armstorageimportexport" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/ListOperations.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorageimportexport.NewOperationsClient(nil, cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_models_serde.go b/sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_models_serde.go deleted file mode 100644 index 1c7a06176d27..000000000000 --- a/sdk/resourcemanager/storageimportexport/armstorageimportexport/zz_generated_models_serde.go +++ /dev/null @@ -1,125 +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. - -package armstorageimportexport - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type ExportBlobList. -func (e ExportBlobList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "blobPath", e.BlobPath) - populate(objectMap, "blobPathPrefix", e.BlobPathPrefix) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type JobDetails. -func (j JobDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "backupDriveManifest", j.BackupDriveManifest) - populate(objectMap, "cancelRequested", j.CancelRequested) - populate(objectMap, "deliveryPackage", j.DeliveryPackage) - populate(objectMap, "diagnosticsPath", j.DiagnosticsPath) - populate(objectMap, "driveList", j.DriveList) - populate(objectMap, "encryptionKey", j.EncryptionKey) - populate(objectMap, "export", j.Export) - populate(objectMap, "incompleteBlobListUri", j.IncompleteBlobListURI) - populate(objectMap, "jobType", j.JobType) - populate(objectMap, "logLevel", j.LogLevel) - populate(objectMap, "percentComplete", j.PercentComplete) - populate(objectMap, "provisioningState", j.ProvisioningState) - populate(objectMap, "returnAddress", j.ReturnAddress) - populate(objectMap, "returnPackage", j.ReturnPackage) - populate(objectMap, "returnShipping", j.ReturnShipping) - populate(objectMap, "shippingInformation", j.ShippingInformation) - populate(objectMap, "state", j.State) - populate(objectMap, "storageAccountId", j.StorageAccountID) - 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 = unpopulateTimeRFC3339(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 = unpopulateTimeRFC3339(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 UpdateJobParameters. -func (u UpdateJobParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", u.Properties) - populate(objectMap, "tags", &u.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type UpdateJobParametersProperties. -func (u UpdateJobParametersProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "backupDriveManifest", u.BackupDriveManifest) - populate(objectMap, "cancelRequested", u.CancelRequested) - populate(objectMap, "deliveryPackage", u.DeliveryPackage) - populate(objectMap, "driveList", u.DriveList) - populate(objectMap, "logLevel", u.LogLevel) - populate(objectMap, "returnAddress", u.ReturnAddress) - populate(objectMap, "returnShipping", u.ReturnShipping) - populate(objectMap, "state", u.State) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - 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 interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -}