From d91b5916d29f33385ed65e9c79541f7b65db35fa Mon Sep 17 00:00:00 2001 From: hc-github-team-tf-azure <> Date: Wed, 1 Oct 2025 15:48:56 +0000 Subject: [PATCH] Updating based on 655e1d064 --- .../2025-06-30/get/model_connectioninfo.go | 2 +- .../get/model_datamigrationservice.go | 2 +- .../get/model_mongodbconnectioninfo.go | 2 +- .../2025-06-30/get/model_project.go | 2 +- .../2025-06-30/get/predicates.go | 4 +- .../model_migrationservice.go | 2 +- .../migrationservices/predicates.go | 2 +- .../2025-06-30/patch/model_connectioninfo.go | 2 +- .../patch/model_datamigrationservice.go | 2 +- .../patch/model_mongodbconnectioninfo.go | 2 +- .../2025-06-30/patch/model_project.go | 2 +- .../projectresource/model_connectioninfo.go | 2 +- .../model_mongodbconnectioninfo.go | 2 +- .../projectresource/model_project.go | 2 +- .../2025-06-30/projectresource/predicates.go | 2 +- .../2025-06-30/put/model_connectioninfo.go | 2 +- .../put/model_datamigrationservice.go | 2 +- .../put/model_mongodbconnectioninfo.go | 2 +- .../2025-06-30/put/model_project.go | 2 +- .../serviceresource/model_connectioninfo.go | 2 +- .../model_datamigrationservice.go | 2 +- .../model_mongodbconnectioninfo.go | 2 +- .../2025-06-30/serviceresource/predicates.go | 2 +- .../model_connectioninfo.go | 2 +- .../model_mongodbconnectioninfo.go | 2 +- .../model_sqlmigrationservice.go | 2 +- .../sqlmigrationservices/predicates.go | 2 +- .../model_datamigrationservice.go | 2 +- .../standardoperation/model_project.go | 2 +- .../standardoperation/predicates.go | 4 +- .../taskresource/model_connectioninfo.go | 2 +- .../model_mongodbconnectioninfo.go | 2 +- .../constants.go | 6 - .../constants.go | 6 - .../constants.go | 6 - .../constants.go | 6 - .../constants.go | 6 + .../constants.go | 6 + .../constants.go | 6 + .../constants.go | 6 + .../autonomousdatabasebackups/README.md | 99 ++ .../autonomousdatabasebackups/client.go | 26 + .../autonomousdatabasebackups/constants.go | 151 ++ .../id_autonomousdatabase.go | 130 ++ .../id_autonomousdatabase_test.go | 282 ++++ .../id_autonomousdatabasebackup.go | 139 ++ .../id_autonomousdatabasebackup_test.go | 327 ++++ .../method_createorupdate.go | 75 + .../method_delete.go | 70 + .../autonomousdatabasebackups/method_get.go | 53 + .../method_listbyparent.go | 105 ++ .../method_update.go | 75 + .../model_autonomousdatabasebackup.go | 16 + ...odel_autonomousdatabasebackupproperties.go | 41 + .../model_autonomousdatabasebackupupdate.go | 8 + ...tonomousdatabasebackupupdateproperties.go} | 8 +- .../autonomousdatabasebackups/predicates.go | 27 + .../autonomousdatabasebackups/version.go | 10 + .../autonomousdatabasecharactersets/README.md | 53 + .../autonomousdatabasecharactersets/client.go | 26 + .../id_autonomousdatabasecharacterset.go | 130 ++ .../id_autonomousdatabasecharacterset_test.go | 282 ++++ .../id_location.go | 6 +- .../id_location_test.go | 28 +- .../method_get.go | 53 + .../method_listbylocation.go | 105 ++ .../model_autonomousdatabasecharacterset.go | 16 + ...utonomousdatabasecharactersetproperties.go | 8 + .../predicates.go | 27 + .../version.go | 10 + .../README.md | 53 + .../client.go | 26 + ..._autonomousdatabasenationalcharacterset.go | 130 ++ ...nomousdatabasenationalcharacterset_test.go | 282 ++++ .../id_location.go | 6 +- .../id_location_test.go | 28 +- .../method_get.go | 53 + .../method_listbylocation.go | 105 ++ ..._autonomousdatabasenationalcharacterset.go | 16 + ...sdatabasenationalcharactersetproperties.go | 8 + .../predicates.go | 27 + .../version.go | 10 + .../2025-09-01/autonomousdatabases/README.md | 235 +++ .../2025-09-01/autonomousdatabases/client.go | 26 + .../autonomousdatabases/constants.go | 1355 +++++++++++++++++ .../id_autonomousdatabase.go | 130 ++ .../id_autonomousdatabase_test.go | 282 ++++ .../autonomousdatabases/method_action.go | 75 + ...hod_changedisasterrecoveryconfiguration.go | 75 + .../method_createorupdate.go | 75 + .../autonomousdatabases/method_delete.go | 70 + .../autonomousdatabases/method_failover.go | 75 + .../method_generatewallet.go | 58 + .../autonomousdatabases/method_get.go | 53 + .../method_listbyresourcegroup.go | 106 ++ .../method_listbysubscription.go | 106 ++ .../autonomousdatabases/method_restore.go | 75 + .../autonomousdatabases/method_shrink.go | 71 + .../autonomousdatabases/method_switchover.go | 75 + .../autonomousdatabases/method_update.go | 75 + .../model_allconnectionstringtype.go | 10 + .../model_apexdetailstype.go | 9 + .../model_autonomousdatabase.go | 59 + .../model_autonomousdatabasebaseproperties.go | 175 +++ ...model_autonomousdatabasecloneproperties.go | 272 ++++ ...secrossregiondisasterrecoveryproperties.go | 270 ++++ ...usdatabasefrombackuptimestampproperties.go | 269 ++++ ...model_autonomousdatabaselifecycleaction.go | 8 + .../model_autonomousdatabaseproperties.go | 264 ++++ .../model_autonomousdatabasestandbysummary.go | 12 + .../model_autonomousdatabaseupdate.go | 9 + ...odel_autonomousdatabaseupdateproperties.go | 30 + .../model_autonomousdatabasewalletfile.go} | 6 +- .../model_connectionstringtype.go | 13 + .../model_connectionurltype.go | 14 + .../model_customercontact.go} | 7 +- .../autonomousdatabases/model_dayofweek.go | 8 + .../model_dayofweekupdate.go | 8 + ...el_disasterrecoveryconfigurationdetails.go | 29 + ...generateautonomousdatabasewalletdetails.go | 10 + .../model_longtermbackupscheduledetails.go | 29 + .../model_peerdbdetails.go | 10 + .../autonomousdatabases/model_profiletype.go | 16 + .../model_restoreautonomousdatabasedetails.go | 23 + .../model_scheduledoperationstype.go | 10 + .../model_scheduledoperationstypeupdate.go | 10 + .../autonomousdatabases}/predicates.go | 13 +- .../autonomousdatabases}/version.go | 6 +- .../autonomousdatabaseversions/README.md | 53 + .../autonomousdatabaseversions/client.go | 26 + .../autonomousdatabaseversions/constants.go | 57 + .../id_autonomousdbversion.go | 130 ++ .../id_autonomousdbversion_test.go | 282 ++++ .../autonomousdatabaseversions/id_location.go | 121 ++ .../id_location_test.go | 237 +++ .../autonomousdatabaseversions/method_get.go | 53 + .../method_listbylocation.go | 105 ++ .../model_autonomousdbversion.go | 16 + .../model_autonomousdbversionproperties.go | 13 + .../autonomousdatabaseversions/predicates.go | 27 + .../autonomousdatabaseversions}/version.go | 6 +- .../oracledatabase/2025-09-01/client.go | 244 +++ .../cloudexadatainfrastructures/README.md | 146 ++ .../cloudexadatainfrastructures/client.go | 26 + .../cloudexadatainfrastructures/constants.go | 363 +++++ .../id_cloudexadatainfrastructure.go | 130 ++ .../id_cloudexadatainfrastructure_test.go | 282 ++++ .../method_addstoragecapacity.go | 71 + .../method_configureexascale.go | 75 + .../method_createorupdate.go | 75 + .../method_delete.go | 70 + .../cloudexadatainfrastructures/method_get.go | 53 + .../method_listbyresourcegroup.go | 106 ++ .../method_listbysubscription.go | 106 ++ .../method_update.go | 75 + .../model_cloudexadatainfrastructure.go | 20 + ...el_cloudexadatainfrastructureproperties.go | 43 + .../model_cloudexadatainfrastructureupdate.go | 14 + ...udexadatainfrastructureupdateproperties.go | 12 + ...ascalecloudexadatainfrastructuredetails.go | 8 + .../model_customercontact.go | 8 + .../model_dayofweek.go | 8 + .../model_definedfilesystemconfiguration.go | 11 + .../model_estimatedpatchingtime.go | 11 + .../model_exascaleconfigdetails.go | 9 + .../model_maintenancewindow.go | 17 + .../model_month.go | 8 + .../predicates.go | 13 +- .../cloudexadatainfrastructures/version.go | 10 + .../2025-09-01/cloudvmclusters/README.md | 172 +++ .../2025-09-01/cloudvmclusters/client.go | 26 + .../2025-09-01/cloudvmclusters/constants.go | 377 +++++ .../cloudvmclusters/id_cloudvmcluster.go | 130 ++ .../cloudvmclusters/id_cloudvmcluster_test.go | 282 ++++ .../cloudvmclusters/method_addvms.go | 75 + .../cloudvmclusters/method_createorupdate.go | 75 + .../cloudvmclusters/method_delete.go | 70 + .../2025-09-01/cloudvmclusters/method_get.go | 53 + .../method_listbyresourcegroup.go | 106 ++ .../method_listbysubscription.go | 106 ++ .../method_listprivateipaddresses.go | 58 + .../cloudvmclusters/method_removevms.go | 75 + .../cloudvmclusters/method_update.go | 75 + .../cloudvmclusters/model_addremovedbnode.go | 8 + .../cloudvmclusters/model_cloudvmcluster.go | 18 + .../model_cloudvmclusterproperties.go | 77 + .../model_cloudvmclusterupdate.go | 9 + .../model_cloudvmclusterupdateproperties.go | 19 + .../model_datacollectionoptions.go | 10 + .../cloudvmclusters/model_dbiormconfig.go | 10 + .../model_exadataiormconfig.go | 11 + .../model_filesystemconfigurationdetails.go | 9 + .../cloudvmclusters/model_nsgcidr.go | 9 + .../cloudvmclusters/model_portrange.go | 9 + .../model_privateipaddressesfilter.go | 9 + .../model_privateipaddressproperties.go | 12 + .../2025-09-01/cloudvmclusters}/predicates.go | 13 +- .../2025-09-01/cloudvmclusters/version.go | 10 + .../2025-09-01/dbnodes/README.md | 70 + .../2025-09-01/dbnodes/client.go | 26 + .../2025-09-01/dbnodes/constants.go | 201 +++ .../2025-09-01/dbnodes/id_cloudvmcluster.go | 130 ++ .../dbnodes/id_cloudvmcluster_test.go} | 92 +- .../2025-09-01/dbnodes/id_dbnode.go | 139 ++ .../2025-09-01/dbnodes/id_dbnode_test.go | 327 ++++ .../2025-09-01/dbnodes/method_action.go | 75 + .../2025-09-01/dbnodes/method_get.go | 53 + .../2025-09-01/dbnodes/method_listbyparent.go | 105 ++ .../2025-09-01/dbnodes/model_dbnode.go | 16 + .../2025-09-01/dbnodes/model_dbnodeaction.go | 8 + .../dbnodes/model_dbnodeproperties.go | 69 + .../2025-09-01/dbnodes/predicates.go | 27 + .../2025-09-01/dbnodes}/version.go | 6 +- .../2025-09-01/dbservers/README.md | 53 + .../2025-09-01/dbservers/client.go | 26 + .../2025-09-01/dbservers/constants.go | 195 +++ .../id_cloudexadatainfrastructure.go | 130 ++ .../id_cloudexadatainfrastructure_test.go | 282 ++++ .../2025-09-01/dbservers/id_dbserver.go | 139 ++ .../2025-09-01/dbservers/id_dbserver_test.go | 327 ++++ .../2025-09-01/dbservers/method_get.go | 53 + .../dbservers/method_listbyparent.go | 105 ++ .../2025-09-01/dbservers/model_dbserver.go | 16 + .../model_dbserverpatchingdetails.go | 41 + .../dbservers/model_dbserverproperties.go | 46 + .../2025-09-01/dbservers/predicates.go | 27 + .../2025-09-01/dbservers}/version.go | 6 +- .../2025-09-01/dbsystems/README.md | 117 ++ .../2025-09-01/dbsystems/client.go | 26 + .../2025-09-01/dbsystems/constants.go | 450 ++++++ .../2025-09-01/dbsystems/id_dbsystem.go} | 74 +- .../2025-09-01/dbsystems/id_dbsystem_test.go} | 80 +- .../dbsystems/method_createorupdate.go | 75 + .../2025-09-01/dbsystems/method_delete.go | 70 + .../2025-09-01/dbsystems/method_get.go | 53 + .../dbsystems/method_listbyresourcegroup.go | 106 ++ .../dbsystems/method_listbysubscription.go | 106 ++ .../2025-09-01/dbsystems/method_update.go | 75 + .../2025-09-01/dbsystems/model_dbsystem.go | 20 + .../dbsystems/model_dbsystembaseproperties.go | 104 ++ .../dbsystems/model_dbsystemoptions.go | 8 + .../dbsystems/model_dbsystemproperties.go | 111 ++ .../dbsystems/model_dbsystemupdate.go | 14 + .../model_dbsystemupdateproperties.go | 8 + .../2025-09-01/dbsystems}/predicates.go | 13 +- .../2025-09-01/dbsystems}/version.go | 6 +- .../2025-09-01/dbsystemshapes/README.md | 53 + .../2025-09-01/dbsystemshapes/client.go | 26 + .../2025-09-01/dbsystemshapes/constants.go | 51 + .../dbsystemshapes/id_dbsystemshape.go | 130 ++ .../dbsystemshapes/id_dbsystemshape_test.go | 282 ++++ .../2025-09-01/dbsystemshapes/id_location.go | 121 ++ .../dbsystemshapes/id_location_test.go | 237 +++ .../2025-09-01/dbsystemshapes/method_get.go | 53 + .../dbsystemshapes/method_listbylocation.go | 138 ++ .../dbsystemshapes/model_dbsystemshape.go | 16 + .../model_dbsystemshapeproperties.go | 32 + .../2025-09-01/dbsystemshapes/predicates.go | 27 + .../2025-09-01/dbsystemshapes}/version.go | 6 +- .../2025-09-01/dbversions/README.md | 53 + .../2025-09-01/dbversions/client.go | 26 + .../2025-09-01/dbversions/constants.go | 133 ++ .../dbversions/id_dbsystemdbversion.go | 130 ++ .../dbversions/id_dbsystemdbversion_test.go | 282 ++++ .../2025-09-01/dbversions/id_location.go | 121 ++ .../2025-09-01/dbversions/id_location_test.go | 237 +++ .../2025-09-01/dbversions/method_get.go | 53 + .../dbversions/method_listbylocation.go | 154 ++ .../2025-09-01/dbversions/model_dbversion.go | 16 + .../dbversions/model_dbversionproperties.go | 12 + .../2025-09-01/dbversions/predicates.go | 27 + .../2025-09-01/dbversions/version.go | 10 + .../2025-09-01/dnsprivateviews/README.md | 53 + .../2025-09-01/dnsprivateviews/client.go | 26 + .../2025-09-01/dnsprivateviews/constants.go | 101 ++ .../dnsprivateviews/id_dnsprivateview.go | 130 ++ .../dnsprivateviews/id_dnsprivateview_test.go | 282 ++++ .../2025-09-01/dnsprivateviews/id_location.go | 121 ++ .../dnsprivateviews/id_location_test.go | 237 +++ .../2025-09-01/dnsprivateviews/method_get.go | 53 + .../dnsprivateviews/method_listbylocation.go | 105 ++ .../dnsprivateviews/model_dnsprivateview.go | 16 + .../model_dnsprivateviewproperties.go | 39 + .../2025-09-01/dnsprivateviews/predicates.go | 27 + .../2025-09-01/dnsprivateviews/version.go | 10 + .../2025-09-01/dnsprivatezones/README.md | 53 + .../2025-09-01/dnsprivatezones/client.go | 26 + .../2025-09-01/dnsprivatezones/constants.go | 145 ++ .../dnsprivatezones/id_dnsprivatezone.go | 130 ++ .../dnsprivatezones/id_dnsprivatezone_test.go | 282 ++++ .../2025-09-01/dnsprivatezones/id_location.go | 121 ++ .../dnsprivatezones/id_location_test.go | 237 +++ .../2025-09-01/dnsprivatezones/method_get.go | 53 + .../dnsprivatezones/method_listbylocation.go | 105 ++ .../dnsprivatezones/model_dnsprivatezone.go | 16 + .../model_dnsprivatezoneproperties.go | 32 + .../2025-09-01/dnsprivatezones/predicates.go | 27 + .../2025-09-01/dnsprivatezones/version.go | 10 + .../2025-09-01/exadbvmclusters/README.md | 134 ++ .../2025-09-01/exadbvmclusters/client.go | 26 + .../2025-09-01/exadbvmclusters/constants.go | 336 ++++ .../exadbvmclusters/id_exadbvmcluster.go | 130 ++ .../exadbvmclusters/id_exadbvmcluster_test.go | 282 ++++ .../exadbvmclusters/method_createorupdate.go | 75 + .../exadbvmclusters/method_delete.go | 70 + .../2025-09-01/exadbvmclusters/method_get.go | 53 + .../method_listbyresourcegroup.go | 106 ++ .../method_listbysubscription.go | 106 ++ .../exadbvmclusters/method_removevms.go | 75 + .../exadbvmclusters/method_update.go | 75 + .../model_datacollectionoptions.go | 10 + .../exadbvmclusters/model_dbiormconfig.go | 10 + .../exadbvmclusters/model_dbnodedetails.go | 8 + .../model_exadataiormconfig.go | 11 + .../exadbvmclusters/model_exadbvmcluster.go | 20 + .../model_exadbvmclusterproperties.go | 51 + .../model_exadbvmclusterstoragedetails.go | 8 + .../model_exadbvmclusterupdate.go | 14 + .../model_exadbvmclusterupdateproperties.go | 8 + .../exadbvmclusters/model_nsgcidr.go | 9 + .../exadbvmclusters/model_portrange.go | 9 + ...virtualmachinefromexadbvmclusterdetails.go | 8 + .../2025-09-01/exadbvmclusters/predicates.go | 32 + .../2025-09-01/exadbvmclusters/version.go | 10 + .../2025-09-01/exascaledbnodes/README.md | 70 + .../2025-09-01/exascaledbnodes/client.go | 26 + .../2025-09-01/exascaledbnodes/constants.go | 166 ++ .../exascaledbnodes/id_exadbvmcluster.go | 130 ++ .../exascaledbnodes/id_exadbvmcluster_test.go | 282 ++++ .../id_exadbvmclusterdbnode.go | 139 ++ .../id_exadbvmclusterdbnode_test.go | 327 ++++ .../exascaledbnodes/method_action.go | 75 + .../2025-09-01/exascaledbnodes/method_get.go | 53 + .../exascaledbnodes/method_listbyparent.go | 105 ++ .../exascaledbnodes/model_dbactionresponse.go | 8 + .../exascaledbnodes/model_dbnodeaction.go | 8 + .../exascaledbnodes/model_exascaledbnode.go | 16 + .../model_exascaledbnodeproperties.go | 50 + .../2025-09-01/exascaledbnodes/predicates.go | 27 + .../2025-09-01/exascaledbnodes/version.go | 10 + .../exascaledbstoragevaults/README.md | 117 ++ .../exascaledbstoragevaults/client.go | 26 + .../exascaledbstoragevaults/constants.go | 151 ++ .../id_exascaledbstoragevault.go | 130 ++ .../id_exascaledbstoragevault_test.go | 282 ++++ .../exascaledbstoragevaults/method_create.go | 75 + .../exascaledbstoragevaults/method_delete.go | 70 + .../exascaledbstoragevaults/method_get.go | 53 + .../method_listbyresourcegroup.go | 106 ++ .../method_listbysubscription.go | 106 ++ .../exascaledbstoragevaults/method_update.go | 75 + .../model_exascaledbstoragedetails.go | 9 + .../model_exascaledbstorageinputdetails.go | 8 + .../model_exascaledbstoragevault.go | 20 + .../model_exascaledbstoragevaultproperties.go | 21 + .../model_exascaledbstoragevaulttagsupdate.go | 8 + .../exascaledbstoragevaults/predicates.go | 32 + .../exascaledbstoragevaults}/version.go | 6 +- .../2025-09-01/flexcomponents/README.md | 53 + .../2025-09-01/flexcomponents/client.go | 26 + .../2025-09-01/flexcomponents/constants.go | 95 ++ .../flexcomponents/id_flexcomponent.go | 130 ++ .../flexcomponents/id_flexcomponent_test.go | 282 ++++ .../2025-09-01/flexcomponents/id_location.go | 121 ++ .../flexcomponents/id_location_test.go | 237 +++ .../2025-09-01/flexcomponents/method_get.go | 53 + .../flexcomponents/method_listbyparent.go | 134 ++ .../flexcomponents/model_flexcomponent.go | 16 + .../model_flexcomponentproperties.go | 17 + .../2025-09-01/flexcomponents/predicates.go | 27 + .../2025-09-01/flexcomponents/version.go | 10 + .../2025-09-01/giminorversions/README.md | 53 + .../2025-09-01/giminorversions/client.go | 26 + .../2025-09-01/giminorversions/constants.go | 51 + .../giminorversions/id_giminorversion.go | 139 ++ .../giminorversions/id_giminorversion_test.go | 327 ++++ .../giminorversions/id_giversion.go | 130 ++ .../giminorversions/id_giversion_test.go | 282 ++++ .../2025-09-01/giminorversions/method_get.go | 53 + .../giminorversions/method_listbyparent.go | 138 ++ .../giminorversions/model_giminorversion.go | 16 + .../model_giminorversionproperties.go | 9 + .../2025-09-01/giminorversions/predicates.go | 27 + .../2025-09-01/giminorversions/version.go | 10 + .../2025-09-01/giversions/README.md | 53 + .../2025-09-01/giversions/client.go | 26 + .../2025-09-01/giversions/constants.go | 54 + .../2025-09-01/giversions/id_giversion.go | 130 ++ .../giversions/id_giversion_test.go | 282 ++++ .../2025-09-01/giversions/id_location.go | 121 ++ .../2025-09-01/giversions/id_location_test.go | 237 +++ .../2025-09-01/giversions/method_get.go | 53 + .../giversions/method_listbylocation.go | 142 ++ .../2025-09-01/giversions/model_giversion.go | 16 + .../giversions/model_giversionproperties.go | 8 + .../2025-09-01/giversions/predicates.go | 27 + .../2025-09-01/giversions/version.go | 10 + .../2025-09-01/networkanchors/README.md | 117 ++ .../2025-09-01/networkanchors/client.go | 26 + .../2025-09-01/networkanchors/constants.go | 57 + .../networkanchors/id_networkanchor.go | 130 ++ .../networkanchors/id_networkanchor_test.go} | 80 +- .../networkanchors/method_createorupdate.go | 75 + .../networkanchors/method_delete.go | 70 + .../2025-09-01/networkanchors/method_get.go | 53 + .../method_listbyresourcegroup.go | 106 ++ .../method_listbysubscription.go | 106 ++ .../networkanchors/method_update.go | 75 + .../networkanchors/model_dnsforwardingrule.go | 9 + .../networkanchors/model_networkanchor.go | 20 + .../model_networkanchorproperties.go | 26 + .../model_networkanchorupdate.go | 14 + .../model_networkanchorupdateproperties.go | 11 + .../2025-09-01/networkanchors/predicates.go | 32 + .../2025-09-01/networkanchors/version.go | 10 + .../2025-09-01/oraclesubscriptions/README.md | 153 ++ .../2025-09-01/oraclesubscriptions/client.go | 26 + .../oraclesubscriptions/constants.go | 183 +++ .../method_addazuresubscriptions.go | 74 + .../method_createorupdate.go | 76 + .../oraclesubscriptions/method_delete.go | 71 + .../oraclesubscriptions/method_get.go | 55 + .../method_listactivationlinks.go | 72 + .../method_listbysubscription.go | 106 ++ .../method_listcloudaccountdetails.go | 72 + .../method_listsaassubscriptiondetails.go | 72 + .../oraclesubscriptions/method_update.go | 76 + .../model_activationlinks.go | 9 + .../model_azuresubscriptions.go | 8 + .../model_cloudaccountdetails.go | 9 + .../model_oraclesubscription.go | 17 + .../model_oraclesubscriptionproperties.go | 17 + .../model_oraclesubscriptionupdate.go | 9 + ...odel_oraclesubscriptionupdateproperties.go | 9 + .../oraclesubscriptions/model_plan.go | 12 + .../oraclesubscriptions/model_planupdate.go | 12 + .../model_saassubscriptiondetails.go | 37 + .../oraclesubscriptions/predicates.go | 27 + .../2025-09-01/oraclesubscriptions/version.go | 10 + .../2025-09-01/resourceanchors/README.md | 117 ++ .../2025-09-01/resourceanchors/client.go | 26 + .../2025-09-01/resourceanchors/constants.go | 57 + .../resourceanchors/id_resourceanchor.go | 130 ++ .../resourceanchors/id_resourceanchor_test.go | 282 ++++ .../resourceanchors/method_createorupdate.go | 75 + .../resourceanchors/method_delete.go | 70 + .../2025-09-01/resourceanchors/method_get.go | 53 + .../method_listbyresourcegroup.go | 106 ++ .../method_listbysubscription.go | 106 ++ .../resourceanchors/method_update.go | 75 + .../resourceanchors/model_resourceanchor.go | 18 + .../model_resourceanchorproperties.go | 9 + .../model_resourceanchorupdate.go | 8 + .../2025-09-01/resourceanchors/predicates.go | 32 + .../2025-09-01/resourceanchors/version.go | 10 + .../2025-09-01/systemversions/README.md | 53 + .../2025-09-01/systemversions/client.go | 26 + .../2025-09-01/systemversions/id_location.go | 121 ++ .../systemversions/id_location_test.go | 237 +++ .../systemversions/id_systemversion.go | 130 ++ .../systemversions/id_systemversion_test.go | 282 ++++ .../2025-09-01/systemversions/method_get.go | 53 + .../systemversions/method_listbylocation.go | 105 ++ .../systemversions/model_systemversion.go | 16 + .../model_systemversionproperties.go | 8 + .../2025-09-01/systemversions/predicates.go | 27 + .../2025-09-01/systemversions/version.go | 10 + .../virtualnetworkaddresses/README.md | 82 + .../virtualnetworkaddresses/client.go | 26 + .../virtualnetworkaddresses/constants.go | 107 ++ .../id_cloudvmcluster.go | 130 ++ .../id_cloudvmcluster_test.go | 282 ++++ .../id_virtualnetworkaddress.go | 139 ++ .../id_virtualnetworkaddress_test.go | 327 ++++ .../method_createorupdate.go | 75 + .../virtualnetworkaddresses/method_delete.go | 70 + .../virtualnetworkaddresses/method_get.go | 53 + .../method_listbyparent.go | 105 ++ .../model_virtualnetworkaddress.go | 16 + .../model_virtualnetworkaddressproperties.go | 33 + .../virtualnetworkaddresses/predicates.go | 27 + .../virtualnetworkaddresses}/version.go | 6 +- .../model_backupenginebaseresource.go | 31 +- .../backupjobs/model_jobresource.go | 31 +- .../model_protectionpolicyresource.go | 31 +- .../backupprotectableitems/README.md | 37 - .../backupprotectableitems/constants.go | 107 -- .../backupprotectableitems/id_vault.go | 130 -- .../method_list_autorest.go | 215 --- .../model_distributednodesinfo.go | 11 - .../model_errordetail.go | 10 - .../backupprotectableitems/predicates.go | 37 - .../2025-02-01/backupprotecteditems/README.md | 37 - .../backupprotecteditems/constants.go | 389 ----- .../backupprotecteditems/id_vault.go | 130 -- .../method_list_autorest.go | 215 --- .../backupprotecteditems/model_errordetail.go | 10 - .../backupprotectioncontainers/README.md | 37 - .../backupprotectioncontainers/client.go | 18 - .../backupprotectioncontainers/constants.go | 335 ---- .../method_list_autorest.go | 215 --- .../model_azurebackupservercontainer.go | 67 - ...odel_azureiaasclassiccomputevmcontainer.go | 62 - .../model_azureiaascomputevmcontainer.go | 62 - ...lagworkloadcontainerprotectioncontainer.go | 64 - .../model_azuresqlcontainer.go | 59 - .../model_azurestoragecontainer.go | 65 - ..._azurevmappcontainerprotectioncontainer.go | 64 - .../model_azureworkloadcontainer.go | 64 - ...odel_azureworkloadcontainerextendedinfo.go | 10 - .../model_containeridentityinfo.go | 11 - .../model_distributednodesinfo.go | 11 - .../model_dpmcontainer.go | 67 - .../model_dpmcontainerextendedinfo.go | 26 - .../model_errordetail.go | 10 - .../model_genericcontainer.go | 61 - .../model_genericcontainerextendedinfo.go | 10 - .../model_iaasvmcontainer.go | 62 - .../model_inquiryinfo.go | 10 - .../model_inquiryvalidation.go | 11 - .../model_mabcontainer.go | 66 - .../model_mabcontainerextendedinfo.go | 30 - .../model_mabcontainerhealthdetails.go | 11 - .../model_protectioncontainer.go | 168 -- .../model_workloadinquirydetails.go | 10 - .../backupprotectioncontainers/predicates.go | 37 - .../backupprotectionintent/README.md | 37 - .../backupprotectionintent/client.go | 18 - .../method_list_autorest.go | 215 --- ...esourceencryptionconfigextendedresource.go | 5 + ..._backupresourceencryptionconfigresource.go | 5 + .../README.md | 34 + .../constants.go | 31 + .../method_bmspreparedatamove_autorest.go | 14 +- .../method_bmstriggerdatamove_autorest.go | 14 +- .../model_backupresourceconfigresource.go | 19 +- .../model_preparedatamoverequest.go | 2 +- .../model_triggerdatamoverequest.go | 2 +- ...model_backupresourcevaultconfigresource.go | 5 + .../backups/model_backuprequestresource.go | 31 +- .../2025-02-01/backupstatus/README.md | 41 - .../2025-02-01/backupstatus/client.go | 18 - .../2025-02-01/backupstatus/constants.go | 171 --- .../2025-02-01/backupusagesummaries/README.md | 36 - .../2025-02-01/backupusagesummaries/client.go | 18 - .../backupusagesummaries/constants.go | 48 - .../backupusagesummaries/id_vault.go | 130 -- .../backupusagesummaries/id_vault_test.go | 282 ---- .../method_list_autorest.go | 98 -- .../model_workloaditemresource.go | 31 +- .../2025-02-01/bms/README.md | 342 +++++ .../2025-02-01/{jobs => bms}/client.go | 8 +- .../2025-02-01/bms/constants.go | 1325 ++++++++++++++++ .../id_backupfabric.go | 2 +- .../id_backupfabric_test.go | 2 +- .../id_backupoperation.go} | 72 +- .../id_backupoperation_test.go} | 74 +- .../id_backupvalidateoperationsstatus.go} | 67 +- ...id_backupvalidateoperationsstatus_test.go} | 95 +- .../{backupstatus => bms}/id_location.go | 2 +- .../{backupstatus => bms}/id_location_test.go | 2 +- .../2025-02-01/{jobs => bms}/id_vault.go | 2 +- .../2025-02-01/{jobs => bms}/id_vault_test.go | 2 +- ...hod_backupoperationstatusesget_autorest.go | 68 + ...hod_backupprotectableitemslist_autorest.go | 215 +++ ...ethod_backupprotecteditemslist_autorest.go | 215 +++ ...backupprotectioncontainerslist_autorest.go | 215 +++ ...hod_backupprotectionintentlist_autorest.go | 215 +++ .../method_backupstatusget_autorest.go} | 26 +- ...ethod_backupusagesummarieslist_autorest.go | 215 +++ ...eletedprotectioncontainerslist_autorest.go | 26 +- .../method_featuresupportvalidate_autorest.go | 70 + .../method_fetchtieringcostpost_autorest.go | 80 + .../method_jobsexport_autorest.go} | 36 +- .../method_operationvalidate_autorest.go} | 26 +- ...thod_protectablecontainerslist_autorest.go | 215 +++ ...od_protectioncontainersrefresh_autorest.go | 96 ++ ...ethod_protectionintentvalidate_autorest.go | 70 + .../method_securitypinsget_autorest.go} | 36 +- ...d_validateoperationstatusesget_autorest.go | 68 + ...ethod_validateoperationtrigger_autorest.go | 79 + ...el_azurebackupgoalfeaturesupportrequest.go | 2 +- .../model_azurebackupservercontainer.go | 2 +- .../model_azurefileshareprotectableitem.go | 2 +- .../model_azurefileshareprotecteditem.go | 2 +- ...azurefileshareprotecteditemextendedinfo.go | 2 +- .../model_azurefilesharerestorerequest.go | 2 +- ...odel_azureiaasclassiccomputevmcontainer.go | 2 +- ...zureiaasclassiccomputevmprotectableitem.go | 2 +- ..._azureiaasclassiccomputevmprotecteditem.go | 2 +- .../model_azureiaascomputevmcontainer.go | 2 +- ...model_azureiaascomputevmprotectableitem.go | 2 +- .../model_azureiaascomputevmprotecteditem.go | 2 +- .../model_azureiaasvmprotecteditem.go | 2 +- ...el_azureiaasvmprotecteditemextendedinfo.go | 2 +- ...urerecoveryservicevaultprotectionintent.go | 2 +- .../model_azureresourceprotectionintent.go | 2 +- ...lagworkloadcontainerprotectioncontainer.go | 2 +- .../model_azuresqlcontainer.go | 2 +- .../model_azuresqlprotecteditem.go | 2 +- ...model_azuresqlprotecteditemextendedinfo.go | 2 +- .../model_azurestoragecontainer.go | 2 +- .../model_azurestorageprotectablecontainer.go | 2 +- ...azurevmappcontainerprotectablecontainer.go | 2 +- ..._azurevmappcontainerprotectioncontainer.go | 2 +- ...el_azurevmresourcefeaturesupportrequest.go | 2 +- ...l_azurevmresourcefeaturesupportresponse.go | 2 +- .../model_azurevmworkloadprotectableitem.go | 2 +- .../model_azurevmworkloadprotecteditem.go | 2 +- ...zurevmworkloadprotecteditemextendedinfo.go | 2 +- ...vmworkloadsapasedatabaseprotectableitem.go | 2 +- ...revmworkloadsapasedatabaseprotecteditem.go | 2 +- ...revmworkloadsapasesystemprotectableitem.go | 2 +- ...mworkloadsaphanadatabaseprotectableitem.go | 2 +- ...evmworkloadsaphanadatabaseprotecteditem.go | 2 +- .../model_azurevmworkloadsaphanadbinstance.go | 2 +- ...mworkloadsaphanadbinstanceprotecteditem.go | 2 +- ...zurevmworkloadsaphanahsrprotectableitem.go | 2 +- ...evmworkloadsaphanasystemprotectableitem.go | 2 +- ...loadsqlavailabilitygroupprotectableitem.go | 2 +- ...urevmworkloadsqldatabaseprotectableitem.go | 2 +- ...azurevmworkloadsqldatabaseprotecteditem.go | 2 +- ...urevmworkloadsqlinstanceprotectableitem.go | 2 +- ...model_azureworkloadautoprotectionintent.go | 2 +- .../model_azureworkloadcontainer.go | 2 +- ...reworkloadcontainerautoprotectionintent.go | 2 +- ...odel_azureworkloadcontainerextendedinfo.go | 2 +- ..._azureworkloadpointintimerestorerequest.go | 2 +- .../model_azureworkloadrestorerequest.go | 2 +- ...workloadsapasepointintimerestorerequest.go | 2 +- ...model_azureworkloadsapaserestorerequest.go | 2 +- ...orkloadsaphanapointintimerestorerequest.go | 2 +- ...apointintimerestorewithrehydraterequest.go | 2 +- ...odel_azureworkloadsaphanarestorerequest.go | 2 +- ...kloadsaphanarestorewithrehydraterequest.go | 2 +- ...el_azureworkloadsqlautoprotectionintent.go | 2 +- ...ureworkloadsqlpointintimerestorerequest.go | 2 +- ...lpointintimerestorewithrehydraterequest.go | 2 +- .../model_azureworkloadsqlrestorerequest.go | 2 +- ...eworkloadsqlrestorewithrehydraterequest.go | 2 +- .../model_backupmanagementusage.go | 2 +- .../model_backupstatusrequest.go | 2 +- .../model_backupstatusresponse.go | 2 +- .../bms/model_clientscriptforconnect.go | 12 + .../model_containeridentityinfo.go | 2 +- .../model_diskexclusionproperties.go | 2 +- .../model_distributednodesinfo.go | 2 +- .../model_dpmcontainer.go | 2 +- .../model_dpmcontainerextendedinfo.go | 2 +- .../model_dpmprotecteditem.go | 2 +- .../model_dpmprotecteditemextendedinfo.go | 2 +- .../model_encryptiondetails.go | 2 +- .../{operation => bms}/model_errordetail.go | 2 +- .../model_extendedlocation.go | 2 +- .../model_extendedproperties.go | 2 +- .../model_featuresupportrequest.go | 2 +- ...tchtieringcostinfoforrehydrationrequest.go | 2 +- .../model_fetchtieringcostinforequest.go | 2 +- ...htieringcostsavingsinfoforpolicyrequest.go | 2 +- ...gcostsavingsinfoforprotecteditemrequest.go | 2 +- ...chtieringcostsavingsinfoforvaultrequest.go | 2 +- .../model_genericcontainer.go | 2 +- .../model_genericcontainerextendedinfo.go | 2 +- .../model_genericprotecteditem.go | 2 +- .../model_iaasvmcontainer.go | 2 +- .../model_iaasvmprotectableitem.go | 2 +- .../model_iaasvmrestorerequest.go | 2 +- ...del_iaasvmrestorewithrehydrationrequest.go | 2 +- .../model_identitybasedrestoredetails.go | 2 +- .../{operation => bms}/model_identityinfo.go | 2 +- .../model_inquiryinfo.go | 2 +- .../model_inquiryvalidation.go | 2 +- .../bms/model_instantitemrecoverytarget.go | 8 + .../model_kpiresourcehealthdetails.go | 2 +- .../model_mabcontainer.go | 2 +- .../model_mabcontainerextendedinfo.go | 2 +- .../model_mabcontainerhealthdetails.go | 2 +- .../model_mabfilefolderprotecteditem.go | 2 +- ..._mabfilefolderprotecteditemextendedinfo.go | 2 +- .../model_nameinfo.go | 2 +- .../2025-02-01/bms/model_operationstatus.go | 84 + .../bms/model_operationstatuserror.go | 9 + .../bms/model_operationstatusextendedinfo.go | 99 ++ .../model_operationstatusjobextendedinfo.go | 50 + .../model_operationstatusjobsextendedinfo.go | 51 + ...operationstatusprovisionilrextendedinfo.go | 50 + ...tionstatusvalidateoperationextendedinfo.go | 50 + .../model_prebackupvalidation.go | 2 +- .../model_prevalidateenablebackuprequest.go | 2 +- .../model_prevalidateenablebackupresponse.go | 2 +- .../model_protectablecontainer.go | 2 +- .../model_protectablecontainerresource.go | 33 +- .../model_protecteditem.go | 2 +- .../model_protecteditemresource.go | 33 +- .../model_protectioncontainer.go | 2 +- .../model_protectioncontainerresource.go | 33 +- .../model_protectionintent.go | 2 +- .../model_protectionintentresource.go | 33 +- .../model_recoverypointrehydrationinfo.go | 2 +- .../model_resourcehealthdetails.go | 2 +- .../model_restorefilespecs.go | 2 +- .../model_restorerequest.go | 2 +- .../model_securedvmdetails.go | 2 +- .../model_securitypinbase.go | 2 +- .../model_snapshotrestoreparameters.go | 2 +- .../model_sqldatadirectorymapping.go | 2 +- .../model_targetafsrestoreinfo.go | 2 +- .../model_targetdisknetworkaccesssettings.go | 2 +- .../model_targetrestoreinfo.go | 2 +- .../model_tieringcostinfo.go | 2 +- .../model_tieringcostrehydrationinfo.go | 2 +- .../model_tieringcostsavinginfo.go | 2 +- .../model_tokeninformation.go | 2 +- .../model_userassignedidentityproperties.go | 2 +- ...odel_userassignedmanagedidentitydetails.go | 2 +- ...l_validateiaasvmrestoreoperationrequest.go | 2 +- .../model_validateoperationrequest.go | 2 +- .../model_validateoperationrequestresource.go | 2 +- .../model_validateoperationresponse.go | 2 +- .../model_validateoperationsresponse.go | 2 +- .../model_validaterestoreoperationrequest.go | 2 +- .../model_workloadinquirydetails.go | 2 +- .../model_workloadprotectableitem.go | 2 +- .../model_workloadprotectableitemresource.go | 19 +- .../2025-02-01/bms/predicates.go | 197 +++ .../2025-02-01/{jobs => bms}/version.go | 4 +- .../2025-02-01/client.go | 120 +- .../2025-02-01/datamove/README.md | 54 - .../2025-02-01/datamove/client.go | 18 - .../2025-02-01/datamove/constants.go | 39 - .../2025-02-01/datamove/id_vault.go | 130 -- .../2025-02-01/datamove/id_vault_test.go | 282 ---- .../2025-02-01/featuresupport/README.md | 41 - .../2025-02-01/featuresupport/client.go | 18 - .../2025-02-01/featuresupport/constants.go | 45 - .../method_validate_autorest.go | 70 - .../2025-02-01/fetchtieringcost/README.md | 37 - .../2025-02-01/fetchtieringcost/client.go | 18 - .../2025-02-01/fetchtieringcost/constants.go | 70 - .../2025-02-01/fetchtieringcost/id_vault.go | 130 -- .../fetchtieringcost/id_vault_test.go | 282 ---- .../fetchtieringcost/method_post_autorest.go | 80 - .../model_ilrrequestresource.go | 31 +- .../jobdetails/model_jobresource.go | 31 +- .../2025-02-01/operation/README.md | 41 - .../2025-02-01/operation/client.go | 18 - .../2025-02-01/operation/constants.go | 274 ---- .../2025-02-01/operation/id_vault.go | 130 -- .../2025-02-01/operation/id_vault_test.go | 282 ---- .../privateendpointconnection/README.md | 65 - .../privateendpointconnection/client.go | 18 - .../method_delete_autorest.go | 78 - .../method_get_autorest.go | 68 - .../method_put_autorest.go | 80 - .../README.md | 65 + .../client.go | 8 +- .../constants.go | 2 +- .../id_privateendpointconnection.go | 2 +- .../id_privateendpointconnection_test.go | 2 +- ...rivateendpointconnectiondelete_autorest.go | 78 + ...d_privateendpointconnectionget_autorest.go | 68 + ...d_privateendpointconnectionput_autorest.go | 80 + .../model_privateendpoint.go | 2 +- .../model_privateendpointconnection.go | 2 +- ...model_privateendpointconnectionresource.go | 7 +- ...model_privatelinkserviceconnectionstate.go | 2 +- .../version.go | 4 +- .../protectablecontainers/README.md | 37 - .../protectablecontainers/client.go | 18 - .../protectablecontainers/constants.go | 133 -- .../method_list_autorest.go | 215 --- .../protectablecontainers/version.go | 10 - .../model_protecteditemresource.go | 31 +- .../2025-02-01/protectioncontainers/README.md | 16 - .../method_refresh_autorest.go | 96 -- .../model_protectioncontainerresource.go | 31 +- .../2025-02-01/protectionintent/README.md | 94 -- .../2025-02-01/protectionintent/client.go | 18 - .../2025-02-01/protectionintent/constants.go | 281 ---- .../method_createorupdate_autorest.go | 69 - .../method_delete_autorest.go | 66 - .../protectionintent/method_get_autorest.go | 68 - .../method_validate_autorest.go | 70 - .../2025-02-01/protectionintent/version.go | 10 - .../protectionintentresources/README.md | 73 + .../client.go | 8 +- .../constants.go | 2 +- .../id_backupprotectionintent.go | 2 +- .../id_backupprotectionintent_test.go | 2 +- ...protectionintentcreateorupdate_autorest.go | 69 + .../method_protectionintentdelete_autorest.go | 66 + .../method_protectionintentget_autorest.go | 68 + ...urerecoveryservicevaultprotectionintent.go | 2 +- .../model_azureresourceprotectionintent.go | 2 +- ...model_azureworkloadautoprotectionintent.go | 2 +- ...reworkloadcontainerautoprotectionintent.go | 2 +- ...el_azureworkloadsqlautoprotectionintent.go | 2 +- .../model_protectionintent.go | 2 +- .../model_protectionintentresource.go | 33 +- .../version.go | 4 +- .../model_protectionpolicyresource.go | 31 +- .../2025-02-01/recoverypoint/README.md | 37 - .../2025-02-01/recoverypoint/client.go | 18 - .../2025-02-01/recoverypoint/constants.go | 42 - .../recoverypoint/id_recoverypoint.go | 166 -- .../recoverypoint/id_recoverypoint_test.go | 462 ------ .../2025-02-01/recoverypoint/version.go | 10 - .../2025-02-01/recoverypoints/README.md | 17 + .../method_moverecoverypoint_autorest.go | 14 +- .../model_moverpacrosstiersrequest.go | 2 +- .../model_recoverypointresource.go | 31 +- .../model_recoverypointresource.go | 31 +- .../model_resourceguardproxybaseresource.go | 5 + .../model_resourceguardproxybaseresource.go | 5 + .../restores/model_restorerequestresource.go | 31 +- .../2025-02-01/securitypins/README.md | 41 - .../2025-02-01/securitypins/client.go | 18 - .../2025-02-01/securitypins/id_vault.go | 130 -- .../2025-02-01/securitypins/id_vault_test.go | 282 ---- .../2025-02-01/securitypins/version.go | 10 - .../softdeletedcontainers/README.md | 37 - .../softdeletedcontainers/client.go | 18 - .../softdeletedcontainers/constants.go | 335 ---- .../softdeletedcontainers/id_vault.go | 130 -- .../softdeletedcontainers/id_vault_test.go | 282 ---- .../model_distributednodesinfo.go | 11 - .../model_errordetail.go | 10 - .../model_protectioncontainerresource.go | 57 - .../softdeletedcontainers/version.go | 10 - .../2025-02-01/validateoperation/README.md | 37 - .../2025-02-01/validateoperation/client.go | 18 - .../2025-02-01/validateoperation/constants.go | 274 ---- .../2025-02-01/validateoperation/id_vault.go | 130 -- .../validateoperation/id_vault_test.go | 282 ---- .../method_trigger_autorest.go | 79 - .../model_azurefilesharerestorerequest.go | 57 - ..._azureworkloadpointintimerestorerequest.go | 61 - .../model_azureworkloadrestorerequest.go | 60 - ...workloadsapasepointintimerestorerequest.go | 61 - ...model_azureworkloadsapaserestorerequest.go | 60 - ...orkloadsaphanapointintimerestorerequest.go | 61 - ...apointintimerestorewithrehydraterequest.go | 62 - ...odel_azureworkloadsaphanarestorerequest.go | 60 - ...kloadsaphanarestorewithrehydraterequest.go | 61 - ...ureworkloadsqlpointintimerestorerequest.go | 64 - ...lpointintimerestorewithrehydraterequest.go | 65 - .../model_azureworkloadsqlrestorerequest.go | 63 - ...eworkloadsqlrestorewithrehydraterequest.go | 64 - .../model_encryptiondetails.go | 12 - .../model_iaasvmrestorerequest.go | 76 - ...del_iaasvmrestorewithrehydrationrequest.go | 77 - .../model_identitybasedrestoredetails.go | 9 - .../validateoperation/model_identityinfo.go | 9 - .../model_recoverypointrehydrationinfo.go | 9 - .../model_restorefilespecs.go | 10 - .../validateoperation/model_restorerequest.go | 188 --- .../model_securedvmdetails.go | 8 - .../model_snapshotrestoreparameters.go | 9 - .../model_sqldatadirectorymapping.go | 11 - .../model_targetafsrestoreinfo.go | 9 - .../model_targetdisknetworkaccesssettings.go | 9 - .../model_targetrestoreinfo.go | 11 - .../model_userassignedidentityproperties.go | 9 - ...odel_userassignedmanagedidentitydetails.go | 10 - ...l_validateiaasvmrestoreoperationrequest.go | 78 - .../model_validateoperationrequest.go | 83 - .../model_validateoperationrequestresource.go | 42 - .../model_validaterestoreoperationrequest.go | 78 - .../2025-02-01/validateoperation/version.go | 10 - 869 files changed, 41384 insertions(+), 13294 deletions(-) create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/constants.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/id_autonomousdatabase.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/id_autonomousdatabase_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/id_autonomousdatabasebackup.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/id_autonomousdatabasebackup_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/method_createorupdate.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/method_delete.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/method_listbyparent.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/method_update.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/model_autonomousdatabasebackup.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/model_autonomousdatabasebackupproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/model_autonomousdatabasebackupupdate.go rename resource-manager/{recoveryservicesbackup/2025-02-01/backupusagesummaries/version.go => oracledatabase/2025-09-01/autonomousdatabasebackups/model_autonomousdatabasebackupupdateproperties.go} (50%) create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/predicates.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/version.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/id_autonomousdatabasecharacterset.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/id_autonomousdatabasecharacterset_test.go rename resource-manager/{recoveryservicesbackup/2025-02-01/featuresupport => oracledatabase/2025-09-01/autonomousdatabasecharactersets}/id_location.go (93%) rename resource-manager/{recoveryservicesbackup/2025-02-01/featuresupport => oracledatabase/2025-09-01/autonomousdatabasecharactersets}/id_location_test.go (89%) create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/method_listbylocation.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/model_autonomousdatabasecharacterset.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/model_autonomousdatabasecharactersetproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/predicates.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/version.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/id_autonomousdatabasenationalcharacterset.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/id_autonomousdatabasenationalcharacterset_test.go rename resource-manager/{recoveryservicesbackup/2025-02-01/protectionintent => oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets}/id_location.go (93%) rename resource-manager/{recoveryservicesbackup/2025-02-01/protectionintent => oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets}/id_location_test.go (89%) create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/method_listbylocation.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/model_autonomousdatabasenationalcharacterset.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/model_autonomousdatabasenationalcharactersetproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/predicates.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/version.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/constants.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/id_autonomousdatabase.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/id_autonomousdatabase_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_action.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_changedisasterrecoveryconfiguration.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_createorupdate.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_delete.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_failover.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_generatewallet.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_listbyresourcegroup.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_listbysubscription.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_restore.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_shrink.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_switchover.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_update.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_allconnectionstringtype.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_apexdetailstype.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabase.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasebaseproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasecloneproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasecrossregiondisasterrecoveryproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasefrombackuptimestampproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabaselifecycleaction.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabaseproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasestandbysummary.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabaseupdate.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabaseupdateproperties.go rename resource-manager/{recoveryservicesbackup/2025-02-01/backupusagesummaries/model_backupmanagementusagelist.go => oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasewalletfile.go} (55%) create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_connectionstringtype.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_connectionurltype.go rename resource-manager/{recoveryservicesbackup/2025-02-01/validateoperation/model_extendedlocation.go => oracledatabase/2025-09-01/autonomousdatabases/model_customercontact.go} (54%) create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_dayofweek.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_dayofweekupdate.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_disasterrecoveryconfigurationdetails.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_generateautonomousdatabasewalletdetails.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_longtermbackupscheduledetails.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_peerdbdetails.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_profiletype.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_restoreautonomousdatabasedetails.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_scheduledoperationstype.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_scheduledoperationstypeupdate.go rename resource-manager/{recoveryservicesbackup/2025-02-01/backupprotecteditems => oracledatabase/2025-09-01/autonomousdatabases}/predicates.go (58%) rename resource-manager/{recoveryservicesbackup/2025-02-01/fetchtieringcost => oracledatabase/2025-09-01/autonomousdatabases}/version.go (58%) create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/constants.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/id_autonomousdbversion.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/id_autonomousdbversion_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/id_location.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/id_location_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/method_listbylocation.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/model_autonomousdbversion.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/model_autonomousdbversionproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/predicates.go rename resource-manager/{recoveryservicesbackup/2025-02-01/backupprotectioncontainers => oracledatabase/2025-09-01/autonomousdatabaseversions}/version.go (56%) create mode 100644 resource-manager/oracledatabase/2025-09-01/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/constants.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/id_cloudexadatainfrastructure.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/id_cloudexadatainfrastructure_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_addstoragecapacity.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_configureexascale.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_createorupdate.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_delete.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_listbyresourcegroup.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_listbysubscription.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_update.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_cloudexadatainfrastructure.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_cloudexadatainfrastructureproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_cloudexadatainfrastructureupdate.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_cloudexadatainfrastructureupdateproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_configureexascalecloudexadatainfrastructuredetails.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_customercontact.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_dayofweek.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_definedfilesystemconfiguration.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_estimatedpatchingtime.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_exascaleconfigdetails.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_maintenancewindow.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_month.go rename resource-manager/{recoveryservicesbackup/2025-02-01/backupprotectionintent => oracledatabase/2025-09-01/cloudexadatainfrastructures}/predicates.go (58%) create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/version.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/constants.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/id_cloudvmcluster.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/id_cloudvmcluster_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_addvms.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_createorupdate.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_delete.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_listbyresourcegroup.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_listbysubscription.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_listprivateipaddresses.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_removevms.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_update.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_addremovedbnode.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_cloudvmcluster.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_cloudvmclusterproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_cloudvmclusterupdate.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_cloudvmclusterupdateproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_datacollectionoptions.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_dbiormconfig.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_exadataiormconfig.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_filesystemconfigurationdetails.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_nsgcidr.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_portrange.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_privateipaddressesfilter.go create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_privateipaddressproperties.go rename resource-manager/{recoveryservicesbackup/2025-02-01/softdeletedcontainers => oracledatabase/2025-09-01/cloudvmclusters}/predicates.go (57%) create mode 100644 resource-manager/oracledatabase/2025-09-01/cloudvmclusters/version.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbnodes/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/dbnodes/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbnodes/constants.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbnodes/id_cloudvmcluster.go rename resource-manager/{recoveryservicesbackup/2025-02-01/backupprotecteditems/id_vault_test.go => oracledatabase/2025-09-01/dbnodes/id_cloudvmcluster_test.go} (66%) create mode 100644 resource-manager/oracledatabase/2025-09-01/dbnodes/id_dbnode.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbnodes/id_dbnode_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbnodes/method_action.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbnodes/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbnodes/method_listbyparent.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbnodes/model_dbnode.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbnodes/model_dbnodeaction.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbnodes/model_dbnodeproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbnodes/predicates.go rename resource-manager/{recoveryservicesbackup/2025-02-01/datamove => oracledatabase/2025-09-01/dbnodes}/version.go (63%) create mode 100644 resource-manager/oracledatabase/2025-09-01/dbservers/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/dbservers/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbservers/constants.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbservers/id_cloudexadatainfrastructure.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbservers/id_cloudexadatainfrastructure_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbservers/id_dbserver.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbservers/id_dbserver_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbservers/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbservers/method_listbyparent.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbservers/model_dbserver.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbservers/model_dbserverpatchingdetails.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbservers/model_dbserverproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbservers/predicates.go rename resource-manager/{recoveryservicesbackup/2025-02-01/operation => oracledatabase/2025-09-01/dbservers}/version.go (62%) create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystems/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystems/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystems/constants.go rename resource-manager/{recoveryservicesbackup/2025-02-01/backupprotectioncontainers/id_vault.go => oracledatabase/2025-09-01/dbsystems/id_dbsystem.go} (52%) rename resource-manager/{recoveryservicesbackup/2025-02-01/backupprotectableitems/id_vault_test.go => oracledatabase/2025-09-01/dbsystems/id_dbsystem_test.go} (72%) create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystems/method_createorupdate.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystems/method_delete.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystems/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystems/method_listbyresourcegroup.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystems/method_listbysubscription.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystems/method_update.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystem.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystembaseproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystemoptions.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystemproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystemupdate.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystemupdateproperties.go rename resource-manager/{recoveryservicesbackup/2025-02-01/protectablecontainers => oracledatabase/2025-09-01/dbsystems}/predicates.go (57%) rename resource-manager/{recoveryservicesbackup/2025-02-01/backupstatus => oracledatabase/2025-09-01/dbsystems}/version.go (61%) create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystemshapes/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystemshapes/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystemshapes/constants.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystemshapes/id_dbsystemshape.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystemshapes/id_dbsystemshape_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystemshapes/id_location.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystemshapes/id_location_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystemshapes/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystemshapes/method_listbylocation.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystemshapes/model_dbsystemshape.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystemshapes/model_dbsystemshapeproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbsystemshapes/predicates.go rename resource-manager/{recoveryservicesbackup/2025-02-01/featuresupport => oracledatabase/2025-09-01/dbsystemshapes}/version.go (60%) create mode 100644 resource-manager/oracledatabase/2025-09-01/dbversions/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/dbversions/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbversions/constants.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbversions/id_dbsystemdbversion.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbversions/id_dbsystemdbversion_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbversions/id_location.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbversions/id_location_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbversions/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbversions/method_listbylocation.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbversions/model_dbversion.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbversions/model_dbversionproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbversions/predicates.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dbversions/version.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivateviews/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivateviews/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivateviews/constants.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivateviews/id_dnsprivateview.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivateviews/id_dnsprivateview_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivateviews/id_location.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivateviews/id_location_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivateviews/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivateviews/method_listbylocation.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivateviews/model_dnsprivateview.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivateviews/model_dnsprivateviewproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivateviews/predicates.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivateviews/version.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivatezones/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivatezones/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivatezones/constants.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivatezones/id_dnsprivatezone.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivatezones/id_dnsprivatezone_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivatezones/id_location.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivatezones/id_location_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivatezones/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivatezones/method_listbylocation.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivatezones/model_dnsprivatezone.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivatezones/model_dnsprivatezoneproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivatezones/predicates.go create mode 100644 resource-manager/oracledatabase/2025-09-01/dnsprivatezones/version.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/constants.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/id_exadbvmcluster.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/id_exadbvmcluster_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_createorupdate.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_delete.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_listbyresourcegroup.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_listbysubscription.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_removevms.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_update.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_datacollectionoptions.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_dbiormconfig.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_dbnodedetails.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadataiormconfig.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadbvmcluster.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadbvmclusterproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadbvmclusterstoragedetails.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadbvmclusterupdate.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadbvmclusterupdateproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_nsgcidr.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_portrange.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_removevirtualmachinefromexadbvmclusterdetails.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/predicates.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exadbvmclusters/version.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbnodes/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbnodes/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbnodes/constants.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbnodes/id_exadbvmcluster.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbnodes/id_exadbvmcluster_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbnodes/id_exadbvmclusterdbnode.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbnodes/id_exadbvmclusterdbnode_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbnodes/method_action.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbnodes/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbnodes/method_listbyparent.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbnodes/model_dbactionresponse.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbnodes/model_dbnodeaction.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbnodes/model_exascaledbnode.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbnodes/model_exascaledbnodeproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbnodes/predicates.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbnodes/version.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/constants.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/id_exascaledbstoragevault.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/id_exascaledbstoragevault_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_create.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_delete.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_listbyresourcegroup.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_listbysubscription.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_update.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/model_exascaledbstoragedetails.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/model_exascaledbstorageinputdetails.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/model_exascaledbstoragevault.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/model_exascaledbstoragevaultproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/model_exascaledbstoragevaulttagsupdate.go create mode 100644 resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/predicates.go rename resource-manager/{recoveryservicesbackup/2025-02-01/backupprotecteditems => oracledatabase/2025-09-01/exascaledbstoragevaults}/version.go (57%) create mode 100644 resource-manager/oracledatabase/2025-09-01/flexcomponents/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/flexcomponents/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/flexcomponents/constants.go create mode 100644 resource-manager/oracledatabase/2025-09-01/flexcomponents/id_flexcomponent.go create mode 100644 resource-manager/oracledatabase/2025-09-01/flexcomponents/id_flexcomponent_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/flexcomponents/id_location.go create mode 100644 resource-manager/oracledatabase/2025-09-01/flexcomponents/id_location_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/flexcomponents/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/flexcomponents/method_listbyparent.go create mode 100644 resource-manager/oracledatabase/2025-09-01/flexcomponents/model_flexcomponent.go create mode 100644 resource-manager/oracledatabase/2025-09-01/flexcomponents/model_flexcomponentproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/flexcomponents/predicates.go create mode 100644 resource-manager/oracledatabase/2025-09-01/flexcomponents/version.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giminorversions/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/giminorversions/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giminorversions/constants.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giminorversions/id_giminorversion.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giminorversions/id_giminorversion_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giminorversions/id_giversion.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giminorversions/id_giversion_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giminorversions/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giminorversions/method_listbyparent.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giminorversions/model_giminorversion.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giminorversions/model_giminorversionproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giminorversions/predicates.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giminorversions/version.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giversions/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/giversions/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giversions/constants.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giversions/id_giversion.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giversions/id_giversion_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giversions/id_location.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giversions/id_location_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giversions/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giversions/method_listbylocation.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giversions/model_giversion.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giversions/model_giversionproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giversions/predicates.go create mode 100644 resource-manager/oracledatabase/2025-09-01/giversions/version.go create mode 100644 resource-manager/oracledatabase/2025-09-01/networkanchors/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/networkanchors/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/networkanchors/constants.go create mode 100644 resource-manager/oracledatabase/2025-09-01/networkanchors/id_networkanchor.go rename resource-manager/{recoveryservicesbackup/2025-02-01/backupprotectioncontainers/id_vault_test.go => oracledatabase/2025-09-01/networkanchors/id_networkanchor_test.go} (70%) create mode 100644 resource-manager/oracledatabase/2025-09-01/networkanchors/method_createorupdate.go create mode 100644 resource-manager/oracledatabase/2025-09-01/networkanchors/method_delete.go create mode 100644 resource-manager/oracledatabase/2025-09-01/networkanchors/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/networkanchors/method_listbyresourcegroup.go create mode 100644 resource-manager/oracledatabase/2025-09-01/networkanchors/method_listbysubscription.go create mode 100644 resource-manager/oracledatabase/2025-09-01/networkanchors/method_update.go create mode 100644 resource-manager/oracledatabase/2025-09-01/networkanchors/model_dnsforwardingrule.go create mode 100644 resource-manager/oracledatabase/2025-09-01/networkanchors/model_networkanchor.go create mode 100644 resource-manager/oracledatabase/2025-09-01/networkanchors/model_networkanchorproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/networkanchors/model_networkanchorupdate.go create mode 100644 resource-manager/oracledatabase/2025-09-01/networkanchors/model_networkanchorupdateproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/networkanchors/predicates.go create mode 100644 resource-manager/oracledatabase/2025-09-01/networkanchors/version.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/constants.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_addazuresubscriptions.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_createorupdate.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_delete.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_listactivationlinks.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_listbysubscription.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_listcloudaccountdetails.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_listsaassubscriptiondetails.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_update.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_activationlinks.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_azuresubscriptions.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_cloudaccountdetails.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_oraclesubscription.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_oraclesubscriptionproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_oraclesubscriptionupdate.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_oraclesubscriptionupdateproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_plan.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_planupdate.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_saassubscriptiondetails.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/predicates.go create mode 100644 resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/version.go create mode 100644 resource-manager/oracledatabase/2025-09-01/resourceanchors/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/resourceanchors/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/resourceanchors/constants.go create mode 100644 resource-manager/oracledatabase/2025-09-01/resourceanchors/id_resourceanchor.go create mode 100644 resource-manager/oracledatabase/2025-09-01/resourceanchors/id_resourceanchor_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/resourceanchors/method_createorupdate.go create mode 100644 resource-manager/oracledatabase/2025-09-01/resourceanchors/method_delete.go create mode 100644 resource-manager/oracledatabase/2025-09-01/resourceanchors/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/resourceanchors/method_listbyresourcegroup.go create mode 100644 resource-manager/oracledatabase/2025-09-01/resourceanchors/method_listbysubscription.go create mode 100644 resource-manager/oracledatabase/2025-09-01/resourceanchors/method_update.go create mode 100644 resource-manager/oracledatabase/2025-09-01/resourceanchors/model_resourceanchor.go create mode 100644 resource-manager/oracledatabase/2025-09-01/resourceanchors/model_resourceanchorproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/resourceanchors/model_resourceanchorupdate.go create mode 100644 resource-manager/oracledatabase/2025-09-01/resourceanchors/predicates.go create mode 100644 resource-manager/oracledatabase/2025-09-01/resourceanchors/version.go create mode 100644 resource-manager/oracledatabase/2025-09-01/systemversions/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/systemversions/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/systemversions/id_location.go create mode 100644 resource-manager/oracledatabase/2025-09-01/systemversions/id_location_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/systemversions/id_systemversion.go create mode 100644 resource-manager/oracledatabase/2025-09-01/systemversions/id_systemversion_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/systemversions/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/systemversions/method_listbylocation.go create mode 100644 resource-manager/oracledatabase/2025-09-01/systemversions/model_systemversion.go create mode 100644 resource-manager/oracledatabase/2025-09-01/systemversions/model_systemversionproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/systemversions/predicates.go create mode 100644 resource-manager/oracledatabase/2025-09-01/systemversions/version.go create mode 100644 resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/README.md create mode 100644 resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/client.go create mode 100644 resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/constants.go create mode 100644 resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/id_cloudvmcluster.go create mode 100644 resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/id_cloudvmcluster_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/id_virtualnetworkaddress.go create mode 100644 resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/id_virtualnetworkaddress_test.go create mode 100644 resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/method_createorupdate.go create mode 100644 resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/method_delete.go create mode 100644 resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/method_get.go create mode 100644 resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/method_listbyparent.go create mode 100644 resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/model_virtualnetworkaddress.go create mode 100644 resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/model_virtualnetworkaddressproperties.go create mode 100644 resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/predicates.go rename resource-manager/{recoveryservicesbackup/2025-02-01/backupprotectableitems => oracledatabase/2025-09-01/virtualnetworkaddresses}/version.go (57%) delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/README.md delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/constants.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/id_vault.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/method_list_autorest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_distributednodesinfo.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_errordetail.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/predicates.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/README.md delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/constants.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/id_vault.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/method_list_autorest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_errordetail.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/README.md delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/client.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/constants.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/method_list_autorest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azurebackupservercontainer.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azureiaasclassiccomputevmcontainer.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azureiaascomputevmcontainer.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azuresqlagworkloadcontainerprotectioncontainer.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azuresqlcontainer.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azurestoragecontainer.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azurevmappcontainerprotectioncontainer.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azureworkloadcontainer.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azureworkloadcontainerextendedinfo.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_containeridentityinfo.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_distributednodesinfo.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_dpmcontainer.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_dpmcontainerextendedinfo.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_errordetail.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_genericcontainer.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_genericcontainerextendedinfo.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_iaasvmcontainer.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_inquiryinfo.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_inquiryvalidation.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_mabcontainer.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_mabcontainerextendedinfo.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_mabcontainerhealthdetails.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_protectioncontainer.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_workloadinquirydetails.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/predicates.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/README.md delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/client.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/method_list_autorest.go rename resource-manager/recoveryservicesbackup/2025-02-01/{datamove => backupresourcestorageconfigsnoncrr}/method_bmspreparedatamove_autorest.go (64%) rename resource-manager/recoveryservicesbackup/2025-02-01/{datamove => backupresourcestorageconfigsnoncrr}/method_bmstriggerdatamove_autorest.go (64%) rename resource-manager/recoveryservicesbackup/2025-02-01/{datamove => backupresourcestorageconfigsnoncrr}/model_preparedatamoverequest.go (92%) rename resource-manager/recoveryservicesbackup/2025-02-01/{datamove => backupresourcestorageconfigsnoncrr}/model_triggerdatamoverequest.go (93%) delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/README.md delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/client.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/constants.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/README.md delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/client.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/constants.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/id_vault.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/id_vault_test.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/method_list_autorest.go create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/README.md rename resource-manager/recoveryservicesbackup/2025-02-01/{jobs => bms}/client.go (73%) create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/constants.go rename resource-manager/recoveryservicesbackup/2025-02-01/{protectioncontainers => bms}/id_backupfabric.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{protectioncontainers => bms}/id_backupfabric_test.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{protectablecontainers/id_backupfabric.go => bms/id_backupoperation.go} (56%) rename resource-manager/recoveryservicesbackup/2025-02-01/{protectablecontainers/id_backupfabric_test.go => bms/id_backupoperation_test.go} (81%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectionintent/id_vault.go => bms/id_backupvalidateoperationsstatus.go} (50%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectionintent/id_vault_test.go => bms/id_backupvalidateoperationsstatus_test.go} (69%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupstatus => bms}/id_location.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupstatus => bms}/id_location_test.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{jobs => bms}/id_vault.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{jobs => bms}/id_vault_test.go (99%) create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupoperationstatusesget_autorest.go create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupprotectableitemslist_autorest.go create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupprotecteditemslist_autorest.go create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupprotectioncontainerslist_autorest.go create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupprotectionintentlist_autorest.go rename resource-manager/recoveryservicesbackup/2025-02-01/{backupstatus/method_get_autorest.go => bms/method_backupstatusget_autorest.go} (51%) create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupusagesummarieslist_autorest.go rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/method_deletedprotectioncontainerslist_autorest.go (70%) create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/method_featuresupportvalidate_autorest.go create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/method_fetchtieringcostpost_autorest.go rename resource-manager/recoveryservicesbackup/2025-02-01/{jobs/method_export_autorest.go => bms/method_jobsexport_autorest.go} (51%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation/method_validate_autorest.go => bms/method_operationvalidate_autorest.go} (50%) create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/method_protectablecontainerslist_autorest.go create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/method_protectioncontainersrefresh_autorest.go create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/method_protectionintentvalidate_autorest.go rename resource-manager/recoveryservicesbackup/2025-02-01/{securitypins/method_get_autorest.go => bms/method_securitypinsget_autorest.go} (51%) create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/method_validateoperationstatusesget_autorest.go create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/method_validateoperationtrigger_autorest.go rename resource-manager/recoveryservicesbackup/2025-02-01/{featuresupport => bms}/model_azurebackupgoalfeaturesupportrequest.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/model_azurebackupservercontainer.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectableitems => bms}/model_azurefileshareprotectableitem.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_azurefileshareprotecteditem.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_azurefileshareprotecteditemextendedinfo.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_azurefilesharerestorerequest.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/model_azureiaasclassiccomputevmcontainer.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectableitems => bms}/model_azureiaasclassiccomputevmprotectableitem.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_azureiaasclassiccomputevmprotecteditem.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/model_azureiaascomputevmcontainer.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectableitems => bms}/model_azureiaascomputevmprotectableitem.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_azureiaascomputevmprotecteditem.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_azureiaasvmprotecteditem.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_azureiaasvmprotecteditemextendedinfo.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{protectionintent => bms}/model_azurerecoveryservicevaultprotectionintent.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{protectionintent => bms}/model_azureresourceprotectionintent.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/model_azuresqlagworkloadcontainerprotectioncontainer.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/model_azuresqlcontainer.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_azuresqlprotecteditem.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_azuresqlprotecteditemextendedinfo.go (96%) rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/model_azurestoragecontainer.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{protectablecontainers => bms}/model_azurestorageprotectablecontainer.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{protectablecontainers => bms}/model_azurevmappcontainerprotectablecontainer.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/model_azurevmappcontainerprotectioncontainer.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{featuresupport => bms}/model_azurevmresourcefeaturesupportrequest.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{featuresupport => bms}/model_azurevmresourcefeaturesupportresponse.go (92%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectableitems => bms}/model_azurevmworkloadprotectableitem.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_azurevmworkloadprotecteditem.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_azurevmworkloadprotecteditemextendedinfo.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectableitems => bms}/model_azurevmworkloadsapasedatabaseprotectableitem.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_azurevmworkloadsapasedatabaseprotecteditem.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectableitems => bms}/model_azurevmworkloadsapasesystemprotectableitem.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectableitems => bms}/model_azurevmworkloadsaphanadatabaseprotectableitem.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_azurevmworkloadsaphanadatabaseprotecteditem.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectableitems => bms}/model_azurevmworkloadsaphanadbinstance.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_azurevmworkloadsaphanadbinstanceprotecteditem.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectableitems => bms}/model_azurevmworkloadsaphanahsrprotectableitem.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectableitems => bms}/model_azurevmworkloadsaphanasystemprotectableitem.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectableitems => bms}/model_azurevmworkloadsqlavailabilitygroupprotectableitem.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectableitems => bms}/model_azurevmworkloadsqldatabaseprotectableitem.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_azurevmworkloadsqldatabaseprotecteditem.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectableitems => bms}/model_azurevmworkloadsqlinstanceprotectableitem.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{protectionintent => bms}/model_azureworkloadautoprotectionintent.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/model_azureworkloadcontainer.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{protectionintent => bms}/model_azureworkloadcontainerautoprotectionintent.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/model_azureworkloadcontainerextendedinfo.go (93%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_azureworkloadpointintimerestorerequest.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_azureworkloadrestorerequest.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_azureworkloadsapasepointintimerestorerequest.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_azureworkloadsapaserestorerequest.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_azureworkloadsaphanapointintimerestorerequest.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_azureworkloadsaphanapointintimerestorewithrehydraterequest.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_azureworkloadsaphanarestorerequest.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_azureworkloadsaphanarestorewithrehydraterequest.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{protectionintent => bms}/model_azureworkloadsqlautoprotectionintent.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_azureworkloadsqlpointintimerestorerequest.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_azureworkloadsqlpointintimerestorewithrehydraterequest.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_azureworkloadsqlrestorerequest.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_azureworkloadsqlrestorewithrehydraterequest.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupusagesummaries => bms}/model_backupmanagementusage.go (97%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupstatus => bms}/model_backupstatusrequest.go (94%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupstatus => bms}/model_backupstatusresponse.go (98%) create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/model_clientscriptforconnect.go rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/model_containeridentityinfo.go (93%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_diskexclusionproperties.go (91%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_distributednodesinfo.go (93%) rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/model_dpmcontainer.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/model_dpmcontainerextendedinfo.go (95%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_dpmprotecteditem.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_dpmprotecteditemextendedinfo.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_encryptiondetails.go (96%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_errordetail.go (95%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_extendedlocation.go (93%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_extendedproperties.go (92%) rename resource-manager/recoveryservicesbackup/2025-02-01/{featuresupport => bms}/model_featuresupportrequest.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{fetchtieringcost => bms}/model_fetchtieringcostinfoforrehydrationrequest.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{fetchtieringcost => bms}/model_fetchtieringcostinforequest.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{fetchtieringcost => bms}/model_fetchtieringcostsavingsinfoforpolicyrequest.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{fetchtieringcost => bms}/model_fetchtieringcostsavingsinfoforprotecteditemrequest.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{fetchtieringcost => bms}/model_fetchtieringcostsavingsinfoforvaultrequest.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/model_genericcontainer.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/model_genericcontainerextendedinfo.go (93%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_genericprotecteditem.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/model_iaasvmcontainer.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectableitems => bms}/model_iaasvmprotectableitem.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_iaasvmrestorerequest.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_iaasvmrestorewithrehydrationrequest.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_identitybasedrestoredetails.go (94%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_identityinfo.go (95%) rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/model_inquiryinfo.go (93%) rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/model_inquiryvalidation.go (93%) create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/model_instantitemrecoverytarget.go rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_kpiresourcehealthdetails.go (92%) rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/model_mabcontainer.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/model_mabcontainerextendedinfo.go (97%) rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/model_mabcontainerhealthdetails.go (93%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_mabfilefolderprotecteditem.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_mabfilefolderprotecteditemextendedinfo.go (97%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupusagesummaries => bms}/model_nameinfo.go (90%) create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatus.go create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatuserror.go create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatusextendedinfo.go create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatusjobextendedinfo.go create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatusjobsextendedinfo.go create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatusprovisionilrextendedinfo.go create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatusvalidateoperationextendedinfo.go rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectableitems => bms}/model_prebackupvalidation.go (91%) rename resource-manager/recoveryservicesbackup/2025-02-01/{protectionintent => bms}/model_prevalidateenablebackuprequest.go (94%) rename resource-manager/recoveryservicesbackup/2025-02-01/{protectionintent => bms}/model_prevalidateenablebackupresponse.go (96%) rename resource-manager/recoveryservicesbackup/2025-02-01/{protectablecontainers => bms}/model_protectablecontainer.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{protectablecontainers => bms}/model_protectablecontainerresource.go (52%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_protecteditem.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_protecteditemresource.go (51%) rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/model_protectioncontainer.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectioncontainers => bms}/model_protectioncontainerresource.go (52%) rename resource-manager/recoveryservicesbackup/2025-02-01/{protectionintent => bms}/model_protectionintent.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{protectionintent => bms}/model_protectionintentresource.go (51%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_recoverypointrehydrationinfo.go (95%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => bms}/model_resourcehealthdetails.go (93%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_restorefilespecs.go (95%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_restorerequest.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_securedvmdetails.go (93%) rename resource-manager/recoveryservicesbackup/2025-02-01/{securitypins => bms}/model_securitypinbase.go (93%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_snapshotrestoreparameters.go (95%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_sqldatadirectorymapping.go (96%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_targetafsrestoreinfo.go (94%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_targetdisknetworkaccesssettings.go (95%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_targetrestoreinfo.go (96%) rename resource-manager/recoveryservicesbackup/2025-02-01/{fetchtieringcost => bms}/model_tieringcostinfo.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{fetchtieringcost => bms}/model_tieringcostrehydrationinfo.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{fetchtieringcost => bms}/model_tieringcostsavinginfo.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{securitypins => bms}/model_tokeninformation.go (94%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_userassignedidentityproperties.go (94%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_userassignedmanagedidentitydetails.go (96%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_validateiaasvmrestoreoperationrequest.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_validateoperationrequest.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_validateoperationrequestresource.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_validateoperationresponse.go (93%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_validateoperationsresponse.go (94%) rename resource-manager/recoveryservicesbackup/2025-02-01/{operation => bms}/model_validaterestoreoperationrequest.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{softdeletedcontainers => bms}/model_workloadinquirydetails.go (93%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectableitems => bms}/model_workloadprotectableitem.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectableitems => bms}/model_workloadprotectableitemresource.go (71%) create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/bms/predicates.go rename resource-manager/recoveryservicesbackup/2025-02-01/{jobs => bms}/version.go (78%) delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/datamove/README.md delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/datamove/client.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/datamove/constants.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/datamove/id_vault.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/datamove/id_vault_test.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/README.md delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/client.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/constants.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/method_validate_autorest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/README.md delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/client.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/constants.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/id_vault.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/id_vault_test.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/method_post_autorest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/operation/README.md delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/operation/client.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/operation/constants.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/operation/id_vault.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/operation/id_vault_test.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/README.md delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/client.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/method_delete_autorest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/method_get_autorest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/method_put_autorest.go create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/README.md rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectableitems => privateendpointconnectionresources}/client.go (55%) rename resource-manager/recoveryservicesbackup/2025-02-01/{privateendpointconnection => privateendpointconnectionresources}/constants.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{privateendpointconnection => privateendpointconnectionresources}/id_privateendpointconnection.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{privateendpointconnection => privateendpointconnectionresources}/id_privateendpointconnection_test.go (99%) create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/method_privateendpointconnectiondelete_autorest.go create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/method_privateendpointconnectionget_autorest.go create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/method_privateendpointconnectionput_autorest.go rename resource-manager/recoveryservicesbackup/2025-02-01/{privateendpointconnection => privateendpointconnectionresources}/model_privateendpoint.go (83%) rename resource-manager/recoveryservicesbackup/2025-02-01/{privateendpointconnection => privateendpointconnectionresources}/model_privateendpointconnection.go (93%) rename resource-manager/recoveryservicesbackup/2025-02-01/{privateendpointconnection => privateendpointconnectionresources}/model_privateendpointconnectionresource.go (77%) rename resource-manager/recoveryservicesbackup/2025-02-01/{privateendpointconnection => privateendpointconnectionresources}/model_privatelinkserviceconnectionstate.go (91%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectionintent => privateendpointconnectionresources}/version.go (64%) delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/README.md delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/client.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/constants.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/method_list_autorest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/version.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/protectioncontainers/method_refresh_autorest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/README.md delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/client.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/constants.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/method_createorupdate_autorest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/method_delete_autorest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/method_get_autorest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/method_validate_autorest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/version.go create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/README.md rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotecteditems => protectionintentresources}/client.go (59%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectionintent => protectionintentresources}/constants.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{protectionintent => protectionintentresources}/id_backupprotectionintent.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{protectionintent => protectionintentresources}/id_backupprotectionintent_test.go (99%) create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/method_protectionintentcreateorupdate_autorest.go create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/method_protectionintentdelete_autorest.go create mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/method_protectionintentget_autorest.go rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectionintent => protectionintentresources}/model_azurerecoveryservicevaultprotectionintent.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectionintent => protectionintentresources}/model_azureresourceprotectionintent.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectionintent => protectionintentresources}/model_azureworkloadautoprotectionintent.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectionintent => protectionintentresources}/model_azureworkloadcontainerautoprotectionintent.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectionintent => protectionintentresources}/model_azureworkloadsqlautoprotectionintent.go (98%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectionintent => protectionintentresources}/model_protectionintent.go (99%) rename resource-manager/recoveryservicesbackup/2025-02-01/{backupprotectionintent => protectionintentresources}/model_protectionintentresource.go (51%) rename resource-manager/recoveryservicesbackup/2025-02-01/{privateendpointconnection => protectionintentresources}/version.go (70%) delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/README.md delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/client.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/constants.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/id_recoverypoint.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/id_recoverypoint_test.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/version.go rename resource-manager/recoveryservicesbackup/2025-02-01/{recoverypoint => recoverypoints}/method_moverecoverypoint_autorest.go (67%) rename resource-manager/recoveryservicesbackup/2025-02-01/{recoverypoint => recoverypoints}/model_moverpacrosstiersrequest.go (94%) delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/securitypins/README.md delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/securitypins/client.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/securitypins/id_vault.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/securitypins/id_vault_test.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/securitypins/version.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/README.md delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/client.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/constants.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/id_vault.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/id_vault_test.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_distributednodesinfo.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_errordetail.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_protectioncontainerresource.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/version.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/README.md delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/client.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/constants.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/id_vault.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/id_vault_test.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/method_trigger_autorest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azurefilesharerestorerequest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadpointintimerestorerequest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadrestorerequest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsapasepointintimerestorerequest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsapaserestorerequest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsaphanapointintimerestorerequest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsaphanapointintimerestorewithrehydraterequest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsaphanarestorerequest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsaphanarestorewithrehydraterequest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsqlpointintimerestorerequest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsqlpointintimerestorewithrehydraterequest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsqlrestorerequest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsqlrestorewithrehydraterequest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_encryptiondetails.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_iaasvmrestorerequest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_iaasvmrestorewithrehydrationrequest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_identitybasedrestoredetails.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_identityinfo.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_recoverypointrehydrationinfo.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_restorefilespecs.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_restorerequest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_securedvmdetails.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_snapshotrestoreparameters.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_sqldatadirectorymapping.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_targetafsrestoreinfo.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_targetdisknetworkaccesssettings.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_targetrestoreinfo.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_userassignedidentityproperties.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_userassignedmanagedidentitydetails.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_validateiaasvmrestoreoperationrequest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_validateoperationrequest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_validateoperationrequestresource.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_validaterestoreoperationrequest.go delete mode 100644 resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/version.go diff --git a/resource-manager/datamigration/2025-06-30/get/model_connectioninfo.go b/resource-manager/datamigration/2025-06-30/get/model_connectioninfo.go index 7f4ef6edd53..17449325861 100644 --- a/resource-manager/datamigration/2025-06-30/get/model_connectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/get/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "MongoDbConnectionInfo") { + if strings.EqualFold(value, "mongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2025-06-30/get/model_datamigrationservice.go b/resource-manager/datamigration/2025-06-30/get/model_datamigrationservice.go index b17b42d9b69..74425fc625e 100644 --- a/resource-manager/datamigration/2025-06-30/get/model_datamigrationservice.go +++ b/resource-manager/datamigration/2025-06-30/get/model_datamigrationservice.go @@ -11,7 +11,7 @@ type DataMigrationService struct { Etag *string `json:"etag,omitempty"` Id *string `json:"id,omitempty"` Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` + Location string `json:"location"` Name *string `json:"name,omitempty"` Properties *DataMigrationServiceProperties `json:"properties,omitempty"` Sku *ServiceSku `json:"sku,omitempty"` diff --git a/resource-manager/datamigration/2025-06-30/get/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2025-06-30/get/model_mongodbconnectioninfo.go index f4b03f64482..04df0597abd 100644 --- a/resource-manager/datamigration/2025-06-30/get/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/get/model_mongodbconnectioninfo.go @@ -53,7 +53,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "MongoDbConnectionInfo" + decoded["type"] = "mongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/datamigration/2025-06-30/get/model_project.go b/resource-manager/datamigration/2025-06-30/get/model_project.go index ac5c7dab02a..1fa51b05c1c 100644 --- a/resource-manager/datamigration/2025-06-30/get/model_project.go +++ b/resource-manager/datamigration/2025-06-30/get/model_project.go @@ -10,7 +10,7 @@ import ( type Project struct { Etag *string `json:"etag,omitempty"` Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` + Location string `json:"location"` Name *string `json:"name,omitempty"` Properties *ProjectProperties `json:"properties,omitempty"` SystemData *systemdata.SystemData `json:"systemData,omitempty"` diff --git a/resource-manager/datamigration/2025-06-30/get/predicates.go b/resource-manager/datamigration/2025-06-30/get/predicates.go index b4dbd9be7bb..b2c00fb3bda 100644 --- a/resource-manager/datamigration/2025-06-30/get/predicates.go +++ b/resource-manager/datamigration/2025-06-30/get/predicates.go @@ -39,7 +39,7 @@ func (p DataMigrationServiceOperationPredicate) Matches(input DataMigrationServi return false } - if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + if p.Location != nil && *p.Location != input.Location { return false } @@ -72,7 +72,7 @@ func (p ProjectOperationPredicate) Matches(input Project) bool { return false } - if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + if p.Location != nil && *p.Location != input.Location { return false } diff --git a/resource-manager/datamigration/2025-06-30/migrationservices/model_migrationservice.go b/resource-manager/datamigration/2025-06-30/migrationservices/model_migrationservice.go index c784df2cbd6..e01616c376d 100644 --- a/resource-manager/datamigration/2025-06-30/migrationservices/model_migrationservice.go +++ b/resource-manager/datamigration/2025-06-30/migrationservices/model_migrationservice.go @@ -9,7 +9,7 @@ import ( type MigrationService struct { Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` + Location string `json:"location"` Name *string `json:"name,omitempty"` Properties *MigrationServiceProperties `json:"properties,omitempty"` SystemData *systemdata.SystemData `json:"systemData,omitempty"` diff --git a/resource-manager/datamigration/2025-06-30/migrationservices/predicates.go b/resource-manager/datamigration/2025-06-30/migrationservices/predicates.go index 41b16e58cda..72b1260946f 100644 --- a/resource-manager/datamigration/2025-06-30/migrationservices/predicates.go +++ b/resource-manager/datamigration/2025-06-30/migrationservices/predicates.go @@ -39,7 +39,7 @@ func (p MigrationServiceOperationPredicate) Matches(input MigrationService) bool return false } - if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + if p.Location != nil && *p.Location != input.Location { return false } diff --git a/resource-manager/datamigration/2025-06-30/patch/model_connectioninfo.go b/resource-manager/datamigration/2025-06-30/patch/model_connectioninfo.go index c2f31e4cfc7..d4e2552112f 100644 --- a/resource-manager/datamigration/2025-06-30/patch/model_connectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/patch/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "mongoDbConnectionInfo") { + if strings.EqualFold(value, "MongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2025-06-30/patch/model_datamigrationservice.go b/resource-manager/datamigration/2025-06-30/patch/model_datamigrationservice.go index a03d00b7aec..96d3a6ef75f 100644 --- a/resource-manager/datamigration/2025-06-30/patch/model_datamigrationservice.go +++ b/resource-manager/datamigration/2025-06-30/patch/model_datamigrationservice.go @@ -11,7 +11,7 @@ type DataMigrationService struct { Etag *string `json:"etag,omitempty"` Id *string `json:"id,omitempty"` Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` + Location string `json:"location"` Name *string `json:"name,omitempty"` Properties *DataMigrationServiceProperties `json:"properties,omitempty"` Sku *ServiceSku `json:"sku,omitempty"` diff --git a/resource-manager/datamigration/2025-06-30/patch/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2025-06-30/patch/model_mongodbconnectioninfo.go index 00b80cf489b..15d26059cff 100644 --- a/resource-manager/datamigration/2025-06-30/patch/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/patch/model_mongodbconnectioninfo.go @@ -53,7 +53,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "mongoDbConnectionInfo" + decoded["type"] = "MongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/datamigration/2025-06-30/patch/model_project.go b/resource-manager/datamigration/2025-06-30/patch/model_project.go index dc5473e62e5..bea14fe2e61 100644 --- a/resource-manager/datamigration/2025-06-30/patch/model_project.go +++ b/resource-manager/datamigration/2025-06-30/patch/model_project.go @@ -10,7 +10,7 @@ import ( type Project struct { Etag *string `json:"etag,omitempty"` Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` + Location string `json:"location"` Name *string `json:"name,omitempty"` Properties *ProjectProperties `json:"properties,omitempty"` SystemData *systemdata.SystemData `json:"systemData,omitempty"` diff --git a/resource-manager/datamigration/2025-06-30/projectresource/model_connectioninfo.go b/resource-manager/datamigration/2025-06-30/projectresource/model_connectioninfo.go index 2c2c6b0788a..0465da61fa2 100644 --- a/resource-manager/datamigration/2025-06-30/projectresource/model_connectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/projectresource/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "MongoDbConnectionInfo") { + if strings.EqualFold(value, "mongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2025-06-30/projectresource/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2025-06-30/projectresource/model_mongodbconnectioninfo.go index 48be3eb1426..a3d142d43a1 100644 --- a/resource-manager/datamigration/2025-06-30/projectresource/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/projectresource/model_mongodbconnectioninfo.go @@ -53,7 +53,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "MongoDbConnectionInfo" + decoded["type"] = "mongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/datamigration/2025-06-30/projectresource/model_project.go b/resource-manager/datamigration/2025-06-30/projectresource/model_project.go index e6bb76bf9e4..6c5f28e95f1 100644 --- a/resource-manager/datamigration/2025-06-30/projectresource/model_project.go +++ b/resource-manager/datamigration/2025-06-30/projectresource/model_project.go @@ -10,7 +10,7 @@ import ( type Project struct { Etag *string `json:"etag,omitempty"` Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` + Location string `json:"location"` Name *string `json:"name,omitempty"` Properties *ProjectProperties `json:"properties,omitempty"` SystemData *systemdata.SystemData `json:"systemData,omitempty"` diff --git a/resource-manager/datamigration/2025-06-30/projectresource/predicates.go b/resource-manager/datamigration/2025-06-30/projectresource/predicates.go index 1c5cd5921bd..2a6ee85a886 100644 --- a/resource-manager/datamigration/2025-06-30/projectresource/predicates.go +++ b/resource-manager/datamigration/2025-06-30/projectresource/predicates.go @@ -21,7 +21,7 @@ func (p ProjectOperationPredicate) Matches(input Project) bool { return false } - if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + if p.Location != nil && *p.Location != input.Location { return false } diff --git a/resource-manager/datamigration/2025-06-30/put/model_connectioninfo.go b/resource-manager/datamigration/2025-06-30/put/model_connectioninfo.go index aab36e3c9aa..f6fdab8b586 100644 --- a/resource-manager/datamigration/2025-06-30/put/model_connectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/put/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "mongoDbConnectionInfo") { + if strings.EqualFold(value, "MongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2025-06-30/put/model_datamigrationservice.go b/resource-manager/datamigration/2025-06-30/put/model_datamigrationservice.go index 02fc17c318a..cdddb623299 100644 --- a/resource-manager/datamigration/2025-06-30/put/model_datamigrationservice.go +++ b/resource-manager/datamigration/2025-06-30/put/model_datamigrationservice.go @@ -11,7 +11,7 @@ type DataMigrationService struct { Etag *string `json:"etag,omitempty"` Id *string `json:"id,omitempty"` Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` + Location string `json:"location"` Name *string `json:"name,omitempty"` Properties *DataMigrationServiceProperties `json:"properties,omitempty"` Sku *ServiceSku `json:"sku,omitempty"` diff --git a/resource-manager/datamigration/2025-06-30/put/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2025-06-30/put/model_mongodbconnectioninfo.go index 8f0fa9efafe..c6c4a84ac0e 100644 --- a/resource-manager/datamigration/2025-06-30/put/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/put/model_mongodbconnectioninfo.go @@ -53,7 +53,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "mongoDbConnectionInfo" + decoded["type"] = "MongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/datamigration/2025-06-30/put/model_project.go b/resource-manager/datamigration/2025-06-30/put/model_project.go index e4bdb34bf05..7ae44f33f1f 100644 --- a/resource-manager/datamigration/2025-06-30/put/model_project.go +++ b/resource-manager/datamigration/2025-06-30/put/model_project.go @@ -10,7 +10,7 @@ import ( type Project struct { Etag *string `json:"etag,omitempty"` Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` + Location string `json:"location"` Name *string `json:"name,omitempty"` Properties *ProjectProperties `json:"properties,omitempty"` SystemData *systemdata.SystemData `json:"systemData,omitempty"` diff --git a/resource-manager/datamigration/2025-06-30/serviceresource/model_connectioninfo.go b/resource-manager/datamigration/2025-06-30/serviceresource/model_connectioninfo.go index 3047b7e0a50..6e9f1a364e2 100644 --- a/resource-manager/datamigration/2025-06-30/serviceresource/model_connectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/serviceresource/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "MongoDbConnectionInfo") { + if strings.EqualFold(value, "mongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2025-06-30/serviceresource/model_datamigrationservice.go b/resource-manager/datamigration/2025-06-30/serviceresource/model_datamigrationservice.go index 2dbba2c0cb8..7045e79b9ff 100644 --- a/resource-manager/datamigration/2025-06-30/serviceresource/model_datamigrationservice.go +++ b/resource-manager/datamigration/2025-06-30/serviceresource/model_datamigrationservice.go @@ -11,7 +11,7 @@ type DataMigrationService struct { Etag *string `json:"etag,omitempty"` Id *string `json:"id,omitempty"` Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` + Location string `json:"location"` Name *string `json:"name,omitempty"` Properties *DataMigrationServiceProperties `json:"properties,omitempty"` Sku *ServiceSku `json:"sku,omitempty"` diff --git a/resource-manager/datamigration/2025-06-30/serviceresource/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2025-06-30/serviceresource/model_mongodbconnectioninfo.go index 3a521195e00..767bc368136 100644 --- a/resource-manager/datamigration/2025-06-30/serviceresource/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/serviceresource/model_mongodbconnectioninfo.go @@ -53,7 +53,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "MongoDbConnectionInfo" + decoded["type"] = "mongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/datamigration/2025-06-30/serviceresource/predicates.go b/resource-manager/datamigration/2025-06-30/serviceresource/predicates.go index 95cce1e7e97..e7e7f4218cf 100644 --- a/resource-manager/datamigration/2025-06-30/serviceresource/predicates.go +++ b/resource-manager/datamigration/2025-06-30/serviceresource/predicates.go @@ -39,7 +39,7 @@ func (p DataMigrationServiceOperationPredicate) Matches(input DataMigrationServi return false } - if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + if p.Location != nil && *p.Location != input.Location { return false } diff --git a/resource-manager/datamigration/2025-06-30/servicetaskresource/model_connectioninfo.go b/resource-manager/datamigration/2025-06-30/servicetaskresource/model_connectioninfo.go index a2c64b788f0..ec590fac48b 100644 --- a/resource-manager/datamigration/2025-06-30/servicetaskresource/model_connectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/servicetaskresource/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "MongoDbConnectionInfo") { + if strings.EqualFold(value, "mongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2025-06-30/servicetaskresource/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2025-06-30/servicetaskresource/model_mongodbconnectioninfo.go index 1e1be2df7fa..65db8947ef2 100644 --- a/resource-manager/datamigration/2025-06-30/servicetaskresource/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/servicetaskresource/model_mongodbconnectioninfo.go @@ -53,7 +53,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "MongoDbConnectionInfo" + decoded["type"] = "mongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/datamigration/2025-06-30/sqlmigrationservices/model_sqlmigrationservice.go b/resource-manager/datamigration/2025-06-30/sqlmigrationservices/model_sqlmigrationservice.go index 4094b8e66bc..45e8e96899e 100644 --- a/resource-manager/datamigration/2025-06-30/sqlmigrationservices/model_sqlmigrationservice.go +++ b/resource-manager/datamigration/2025-06-30/sqlmigrationservices/model_sqlmigrationservice.go @@ -9,7 +9,7 @@ import ( type SqlMigrationService struct { Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` + Location string `json:"location"` Name *string `json:"name,omitempty"` Properties *SqlMigrationServiceProperties `json:"properties,omitempty"` SystemData *systemdata.SystemData `json:"systemData,omitempty"` diff --git a/resource-manager/datamigration/2025-06-30/sqlmigrationservices/predicates.go b/resource-manager/datamigration/2025-06-30/sqlmigrationservices/predicates.go index 52b49aaab83..15d977b9bae 100644 --- a/resource-manager/datamigration/2025-06-30/sqlmigrationservices/predicates.go +++ b/resource-manager/datamigration/2025-06-30/sqlmigrationservices/predicates.go @@ -39,7 +39,7 @@ func (p SqlMigrationServiceOperationPredicate) Matches(input SqlMigrationService return false } - if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + if p.Location != nil && *p.Location != input.Location { return false } diff --git a/resource-manager/datamigration/2025-06-30/standardoperation/model_datamigrationservice.go b/resource-manager/datamigration/2025-06-30/standardoperation/model_datamigrationservice.go index 1229d665e3c..3650d7a6151 100644 --- a/resource-manager/datamigration/2025-06-30/standardoperation/model_datamigrationservice.go +++ b/resource-manager/datamigration/2025-06-30/standardoperation/model_datamigrationservice.go @@ -11,7 +11,7 @@ type DataMigrationService struct { Etag *string `json:"etag,omitempty"` Id *string `json:"id,omitempty"` Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` + Location string `json:"location"` Name *string `json:"name,omitempty"` Properties *DataMigrationServiceProperties `json:"properties,omitempty"` Sku *ServiceSku `json:"sku,omitempty"` diff --git a/resource-manager/datamigration/2025-06-30/standardoperation/model_project.go b/resource-manager/datamigration/2025-06-30/standardoperation/model_project.go index 2f3f2e18944..37408e9d278 100644 --- a/resource-manager/datamigration/2025-06-30/standardoperation/model_project.go +++ b/resource-manager/datamigration/2025-06-30/standardoperation/model_project.go @@ -10,7 +10,7 @@ import ( type Project struct { Etag *string `json:"etag,omitempty"` Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` + Location string `json:"location"` Name *string `json:"name,omitempty"` Properties *ProjectProperties `json:"properties,omitempty"` SystemData *systemdata.SystemData `json:"systemData,omitempty"` diff --git a/resource-manager/datamigration/2025-06-30/standardoperation/predicates.go b/resource-manager/datamigration/2025-06-30/standardoperation/predicates.go index a6de023e49d..c6dabbd3ae2 100644 --- a/resource-manager/datamigration/2025-06-30/standardoperation/predicates.go +++ b/resource-manager/datamigration/2025-06-30/standardoperation/predicates.go @@ -39,7 +39,7 @@ func (p DataMigrationServiceOperationPredicate) Matches(input DataMigrationServi return false } - if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + if p.Location != nil && *p.Location != input.Location { return false } @@ -72,7 +72,7 @@ func (p ProjectOperationPredicate) Matches(input Project) bool { return false } - if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + if p.Location != nil && *p.Location != input.Location { return false } diff --git a/resource-manager/datamigration/2025-06-30/taskresource/model_connectioninfo.go b/resource-manager/datamigration/2025-06-30/taskresource/model_connectioninfo.go index 75a9f172f04..41c28de5b58 100644 --- a/resource-manager/datamigration/2025-06-30/taskresource/model_connectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/taskresource/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "MongoDbConnectionInfo") { + if strings.EqualFold(value, "mongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2025-06-30/taskresource/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2025-06-30/taskresource/model_mongodbconnectioninfo.go index 7fcca941b2c..c54f00935ed 100644 --- a/resource-manager/datamigration/2025-06-30/taskresource/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/taskresource/model_mongodbconnectioninfo.go @@ -53,7 +53,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "MongoDbConnectionInfo" + decoded["type"] = "mongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/network/2024-05-01/networkmanagereffectiveconnectivityconfiguration/constants.go b/resource-manager/network/2024-05-01/networkmanagereffectiveconnectivityconfiguration/constants.go index 9007e4a33df..caa8b3c8747 100644 --- a/resource-manager/network/2024-05-01/networkmanagereffectiveconnectivityconfiguration/constants.go +++ b/resource-manager/network/2024-05-01/networkmanagereffectiveconnectivityconfiguration/constants.go @@ -217,8 +217,6 @@ func parseIsGlobal(input string) (*IsGlobal, error) { type ProvisioningState string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -227,8 +225,6 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -251,8 +247,6 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ - "canceled": ProvisioningStateCanceled, - "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/network/2024-05-01/networkmanagereffectivesecurityadminrules/constants.go b/resource-manager/network/2024-05-01/networkmanagereffectivesecurityadminrules/constants.go index 6dbd1e6db74..67086d778e3 100644 --- a/resource-manager/network/2024-05-01/networkmanagereffectivesecurityadminrules/constants.go +++ b/resource-manager/network/2024-05-01/networkmanagereffectivesecurityadminrules/constants.go @@ -138,8 +138,6 @@ func parseGroupMemberType(input string) (*GroupMemberType, error) { type ProvisioningState string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -148,8 +146,6 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -172,8 +168,6 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ - "canceled": ProvisioningStateCanceled, - "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/network/2024-07-01/networkmanageractiveconfigurations/constants.go b/resource-manager/network/2024-07-01/networkmanageractiveconfigurations/constants.go index 793caeabedc..c9291fb2fab 100644 --- a/resource-manager/network/2024-07-01/networkmanageractiveconfigurations/constants.go +++ b/resource-manager/network/2024-07-01/networkmanageractiveconfigurations/constants.go @@ -138,8 +138,6 @@ func parseGroupMemberType(input string) (*GroupMemberType, error) { type ProvisioningState string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -148,8 +146,6 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -172,8 +168,6 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ - "canceled": ProvisioningStateCanceled, - "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/network/2024-07-01/networkmanageractiveconnectivityconfigurations/constants.go b/resource-manager/network/2024-07-01/networkmanageractiveconnectivityconfigurations/constants.go index 451770f8cbb..8195863c49a 100644 --- a/resource-manager/network/2024-07-01/networkmanageractiveconnectivityconfigurations/constants.go +++ b/resource-manager/network/2024-07-01/networkmanageractiveconnectivityconfigurations/constants.go @@ -340,8 +340,6 @@ func parsePeeringEnforcement(input string) (*PeeringEnforcement, error) { type ProvisioningState string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -350,8 +348,6 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -374,8 +370,6 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ - "canceled": ProvisioningStateCanceled, - "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/network/2024-07-01/networkmanagereffectiveconnectivityconfiguration/constants.go b/resource-manager/network/2024-07-01/networkmanagereffectiveconnectivityconfiguration/constants.go index aa292723727..c5bc0377dcd 100644 --- a/resource-manager/network/2024-07-01/networkmanagereffectiveconnectivityconfiguration/constants.go +++ b/resource-manager/network/2024-07-01/networkmanagereffectiveconnectivityconfiguration/constants.go @@ -340,6 +340,8 @@ func parsePeeringEnforcement(input string) (*PeeringEnforcement, error) { type ProvisioningState string const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -348,6 +350,8 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -370,6 +374,8 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/network/2024-07-01/networkmanagereffectivesecurityadminrules/constants.go b/resource-manager/network/2024-07-01/networkmanagereffectivesecurityadminrules/constants.go index 67086d778e3..6dbd1e6db74 100644 --- a/resource-manager/network/2024-07-01/networkmanagereffectivesecurityadminrules/constants.go +++ b/resource-manager/network/2024-07-01/networkmanagereffectivesecurityadminrules/constants.go @@ -138,6 +138,8 @@ func parseGroupMemberType(input string) (*GroupMemberType, error) { type ProvisioningState string const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -146,6 +148,8 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -168,6 +172,8 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/network/2024-10-01/networkmanageractiveconfigurations/constants.go b/resource-manager/network/2024-10-01/networkmanageractiveconfigurations/constants.go index c9291fb2fab..793caeabedc 100644 --- a/resource-manager/network/2024-10-01/networkmanageractiveconfigurations/constants.go +++ b/resource-manager/network/2024-10-01/networkmanageractiveconfigurations/constants.go @@ -138,6 +138,8 @@ func parseGroupMemberType(input string) (*GroupMemberType, error) { type ProvisioningState string const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -146,6 +148,8 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -168,6 +172,8 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/network/2024-10-01/networkmanageractiveconnectivityconfigurations/constants.go b/resource-manager/network/2024-10-01/networkmanageractiveconnectivityconfigurations/constants.go index 8195863c49a..451770f8cbb 100644 --- a/resource-manager/network/2024-10-01/networkmanageractiveconnectivityconfigurations/constants.go +++ b/resource-manager/network/2024-10-01/networkmanageractiveconnectivityconfigurations/constants.go @@ -340,6 +340,8 @@ func parsePeeringEnforcement(input string) (*PeeringEnforcement, error) { type ProvisioningState string const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -348,6 +350,8 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -370,6 +374,8 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/README.md b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/README.md new file mode 100644 index 00000000000..6fe57ff7589 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups` Documentation + +The `autonomousdatabasebackups` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups" +``` + + +### Client Initialization + +```go +client := autonomousdatabasebackups.NewAutonomousDatabaseBackupsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AutonomousDatabaseBackupsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := autonomousdatabasebackups.NewAutonomousDatabaseBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseName", "autonomousDatabaseBackupName") + +payload := autonomousdatabasebackups.AutonomousDatabaseBackup{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AutonomousDatabaseBackupsClient.Delete` + +```go +ctx := context.TODO() +id := autonomousdatabasebackups.NewAutonomousDatabaseBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseName", "autonomousDatabaseBackupName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AutonomousDatabaseBackupsClient.Get` + +```go +ctx := context.TODO() +id := autonomousdatabasebackups.NewAutonomousDatabaseBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseName", "autonomousDatabaseBackupName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AutonomousDatabaseBackupsClient.ListByParent` + +```go +ctx := context.TODO() +id := autonomousdatabasebackups.NewAutonomousDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseName") + +// alternatively `client.ListByParent(ctx, id)` can be used to do batched pagination +items, err := client.ListByParentComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AutonomousDatabaseBackupsClient.Update` + +```go +ctx := context.TODO() +id := autonomousdatabasebackups.NewAutonomousDatabaseBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseName", "autonomousDatabaseBackupName") + +payload := autonomousdatabasebackups.AutonomousDatabaseBackupUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/client.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/client.go new file mode 100644 index 00000000000..4ed28329666 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/client.go @@ -0,0 +1,26 @@ +package autonomousdatabasebackups + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabaseBackupsClient struct { + Client *resourcemanager.Client +} + +func NewAutonomousDatabaseBackupsClientWithBaseURI(sdkApi sdkEnv.Api) (*AutonomousDatabaseBackupsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "autonomousdatabasebackups", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AutonomousDatabaseBackupsClient: %+v", err) + } + + return &AutonomousDatabaseBackupsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/constants.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/constants.go new file mode 100644 index 00000000000..95360d30614 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/constants.go @@ -0,0 +1,151 @@ +package autonomousdatabasebackups + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabaseBackupLifecycleState string + +const ( + AutonomousDatabaseBackupLifecycleStateActive AutonomousDatabaseBackupLifecycleState = "Active" + AutonomousDatabaseBackupLifecycleStateCreating AutonomousDatabaseBackupLifecycleState = "Creating" + AutonomousDatabaseBackupLifecycleStateDeleting AutonomousDatabaseBackupLifecycleState = "Deleting" + AutonomousDatabaseBackupLifecycleStateFailed AutonomousDatabaseBackupLifecycleState = "Failed" + AutonomousDatabaseBackupLifecycleStateUpdating AutonomousDatabaseBackupLifecycleState = "Updating" +) + +func PossibleValuesForAutonomousDatabaseBackupLifecycleState() []string { + return []string{ + string(AutonomousDatabaseBackupLifecycleStateActive), + string(AutonomousDatabaseBackupLifecycleStateCreating), + string(AutonomousDatabaseBackupLifecycleStateDeleting), + string(AutonomousDatabaseBackupLifecycleStateFailed), + string(AutonomousDatabaseBackupLifecycleStateUpdating), + } +} + +func (s *AutonomousDatabaseBackupLifecycleState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAutonomousDatabaseBackupLifecycleState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAutonomousDatabaseBackupLifecycleState(input string) (*AutonomousDatabaseBackupLifecycleState, error) { + vals := map[string]AutonomousDatabaseBackupLifecycleState{ + "active": AutonomousDatabaseBackupLifecycleStateActive, + "creating": AutonomousDatabaseBackupLifecycleStateCreating, + "deleting": AutonomousDatabaseBackupLifecycleStateDeleting, + "failed": AutonomousDatabaseBackupLifecycleStateFailed, + "updating": AutonomousDatabaseBackupLifecycleStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AutonomousDatabaseBackupLifecycleState(input) + return &out, nil +} + +type AutonomousDatabaseBackupType string + +const ( + AutonomousDatabaseBackupTypeFull AutonomousDatabaseBackupType = "Full" + AutonomousDatabaseBackupTypeIncremental AutonomousDatabaseBackupType = "Incremental" + AutonomousDatabaseBackupTypeLongTerm AutonomousDatabaseBackupType = "LongTerm" +) + +func PossibleValuesForAutonomousDatabaseBackupType() []string { + return []string{ + string(AutonomousDatabaseBackupTypeFull), + string(AutonomousDatabaseBackupTypeIncremental), + string(AutonomousDatabaseBackupTypeLongTerm), + } +} + +func (s *AutonomousDatabaseBackupType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAutonomousDatabaseBackupType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAutonomousDatabaseBackupType(input string) (*AutonomousDatabaseBackupType, error) { + vals := map[string]AutonomousDatabaseBackupType{ + "full": AutonomousDatabaseBackupTypeFull, + "incremental": AutonomousDatabaseBackupTypeIncremental, + "longterm": AutonomousDatabaseBackupTypeLongTerm, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AutonomousDatabaseBackupType(input) + return &out, nil +} + +type AzureResourceProvisioningState string + +const ( + AzureResourceProvisioningStateCanceled AzureResourceProvisioningState = "Canceled" + AzureResourceProvisioningStateFailed AzureResourceProvisioningState = "Failed" + AzureResourceProvisioningStateProvisioning AzureResourceProvisioningState = "Provisioning" + AzureResourceProvisioningStateSucceeded AzureResourceProvisioningState = "Succeeded" +) + +func PossibleValuesForAzureResourceProvisioningState() []string { + return []string{ + string(AzureResourceProvisioningStateCanceled), + string(AzureResourceProvisioningStateFailed), + string(AzureResourceProvisioningStateProvisioning), + string(AzureResourceProvisioningStateSucceeded), + } +} + +func (s *AzureResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAzureResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAzureResourceProvisioningState(input string) (*AzureResourceProvisioningState, error) { + vals := map[string]AzureResourceProvisioningState{ + "canceled": AzureResourceProvisioningStateCanceled, + "failed": AzureResourceProvisioningStateFailed, + "provisioning": AzureResourceProvisioningStateProvisioning, + "succeeded": AzureResourceProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AzureResourceProvisioningState(input) + return &out, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/id_autonomousdatabase.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/id_autonomousdatabase.go new file mode 100644 index 00000000000..116d0282b39 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/id_autonomousdatabase.go @@ -0,0 +1,130 @@ +package autonomousdatabasebackups + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&AutonomousDatabaseId{}) +} + +var _ resourceids.ResourceId = &AutonomousDatabaseId{} + +// AutonomousDatabaseId is a struct representing the Resource ID for a Autonomous Database +type AutonomousDatabaseId struct { + SubscriptionId string + ResourceGroupName string + AutonomousDatabaseName string +} + +// NewAutonomousDatabaseID returns a new AutonomousDatabaseId struct +func NewAutonomousDatabaseID(subscriptionId string, resourceGroupName string, autonomousDatabaseName string) AutonomousDatabaseId { + return AutonomousDatabaseId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AutonomousDatabaseName: autonomousDatabaseName, + } +} + +// ParseAutonomousDatabaseID parses 'input' into a AutonomousDatabaseId +func ParseAutonomousDatabaseID(input string) (*AutonomousDatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(&AutonomousDatabaseId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AutonomousDatabaseId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseAutonomousDatabaseIDInsensitively parses 'input' case-insensitively into a AutonomousDatabaseId +// note: this method should only be used for API response data and not user input +func ParseAutonomousDatabaseIDInsensitively(input string) (*AutonomousDatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(&AutonomousDatabaseId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AutonomousDatabaseId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AutonomousDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.AutonomousDatabaseName, ok = input.Parsed["autonomousDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "autonomousDatabaseName", input) + } + + return nil +} + +// ValidateAutonomousDatabaseID checks that 'input' can be parsed as a Autonomous Database ID +func ValidateAutonomousDatabaseID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAutonomousDatabaseID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Autonomous Database ID +func (id AutonomousDatabaseId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Oracle.Database/autonomousDatabases/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AutonomousDatabaseName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Autonomous Database ID +func (id AutonomousDatabaseId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticAutonomousDatabases", "autonomousDatabases", "autonomousDatabases"), + resourceids.UserSpecifiedSegment("autonomousDatabaseName", "autonomousDatabaseName"), + } +} + +// String returns a human-readable description of this Autonomous Database ID +func (id AutonomousDatabaseId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Autonomous Database Name: %q", id.AutonomousDatabaseName), + } + return fmt.Sprintf("Autonomous Database (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/id_autonomousdatabase_test.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/id_autonomousdatabase_test.go new file mode 100644 index 00000000000..10502560755 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/id_autonomousdatabase_test.go @@ -0,0 +1,282 @@ +package autonomousdatabasebackups + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &AutonomousDatabaseId{} + +func TestNewAutonomousDatabaseID(t *testing.T) { + id := NewAutonomousDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.AutonomousDatabaseName != "autonomousDatabaseName" { + t.Fatalf("Expected %q but got %q for Segment 'AutonomousDatabaseName'", id.AutonomousDatabaseName, "autonomousDatabaseName") + } +} + +func TestFormatAutonomousDatabaseID(t *testing.T) { + actual := NewAutonomousDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases/autonomousDatabaseName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseAutonomousDatabaseID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AutonomousDatabaseId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases/autonomousDatabaseName", + Expected: &AutonomousDatabaseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + AutonomousDatabaseName: "autonomousDatabaseName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases/autonomousDatabaseName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAutonomousDatabaseID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.AutonomousDatabaseName != v.Expected.AutonomousDatabaseName { + t.Fatalf("Expected %q but got %q for AutonomousDatabaseName", v.Expected.AutonomousDatabaseName, actual.AutonomousDatabaseName) + } + + } +} + +func TestParseAutonomousDatabaseIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AutonomousDatabaseId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/aUtOnOmOuSdAtAbAsEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases/autonomousDatabaseName", + Expected: &AutonomousDatabaseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + AutonomousDatabaseName: "autonomousDatabaseName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases/autonomousDatabaseName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/aUtOnOmOuSdAtAbAsEs/aUtOnOmOuSdAtAbAsEnAmE", + Expected: &AutonomousDatabaseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + AutonomousDatabaseName: "aUtOnOmOuSdAtAbAsEnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/aUtOnOmOuSdAtAbAsEs/aUtOnOmOuSdAtAbAsEnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAutonomousDatabaseIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.AutonomousDatabaseName != v.Expected.AutonomousDatabaseName { + t.Fatalf("Expected %q but got %q for AutonomousDatabaseName", v.Expected.AutonomousDatabaseName, actual.AutonomousDatabaseName) + } + + } +} + +func TestSegmentsForAutonomousDatabaseId(t *testing.T) { + segments := AutonomousDatabaseId{}.Segments() + if len(segments) == 0 { + t.Fatalf("AutonomousDatabaseId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/id_autonomousdatabasebackup.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/id_autonomousdatabasebackup.go new file mode 100644 index 00000000000..01f5c286121 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/id_autonomousdatabasebackup.go @@ -0,0 +1,139 @@ +package autonomousdatabasebackups + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&AutonomousDatabaseBackupId{}) +} + +var _ resourceids.ResourceId = &AutonomousDatabaseBackupId{} + +// AutonomousDatabaseBackupId is a struct representing the Resource ID for a Autonomous Database Backup +type AutonomousDatabaseBackupId struct { + SubscriptionId string + ResourceGroupName string + AutonomousDatabaseName string + AutonomousDatabaseBackupName string +} + +// NewAutonomousDatabaseBackupID returns a new AutonomousDatabaseBackupId struct +func NewAutonomousDatabaseBackupID(subscriptionId string, resourceGroupName string, autonomousDatabaseName string, autonomousDatabaseBackupName string) AutonomousDatabaseBackupId { + return AutonomousDatabaseBackupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AutonomousDatabaseName: autonomousDatabaseName, + AutonomousDatabaseBackupName: autonomousDatabaseBackupName, + } +} + +// ParseAutonomousDatabaseBackupID parses 'input' into a AutonomousDatabaseBackupId +func ParseAutonomousDatabaseBackupID(input string) (*AutonomousDatabaseBackupId, error) { + parser := resourceids.NewParserFromResourceIdType(&AutonomousDatabaseBackupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AutonomousDatabaseBackupId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseAutonomousDatabaseBackupIDInsensitively parses 'input' case-insensitively into a AutonomousDatabaseBackupId +// note: this method should only be used for API response data and not user input +func ParseAutonomousDatabaseBackupIDInsensitively(input string) (*AutonomousDatabaseBackupId, error) { + parser := resourceids.NewParserFromResourceIdType(&AutonomousDatabaseBackupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AutonomousDatabaseBackupId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AutonomousDatabaseBackupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.AutonomousDatabaseName, ok = input.Parsed["autonomousDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "autonomousDatabaseName", input) + } + + if id.AutonomousDatabaseBackupName, ok = input.Parsed["autonomousDatabaseBackupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "autonomousDatabaseBackupName", input) + } + + return nil +} + +// ValidateAutonomousDatabaseBackupID checks that 'input' can be parsed as a Autonomous Database Backup ID +func ValidateAutonomousDatabaseBackupID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAutonomousDatabaseBackupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Autonomous Database Backup ID +func (id AutonomousDatabaseBackupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Oracle.Database/autonomousDatabases/%s/autonomousDatabaseBackups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AutonomousDatabaseName, id.AutonomousDatabaseBackupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Autonomous Database Backup ID +func (id AutonomousDatabaseBackupId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticAutonomousDatabases", "autonomousDatabases", "autonomousDatabases"), + resourceids.UserSpecifiedSegment("autonomousDatabaseName", "autonomousDatabaseName"), + resourceids.StaticSegment("staticAutonomousDatabaseBackups", "autonomousDatabaseBackups", "autonomousDatabaseBackups"), + resourceids.UserSpecifiedSegment("autonomousDatabaseBackupName", "autonomousDatabaseBackupName"), + } +} + +// String returns a human-readable description of this Autonomous Database Backup ID +func (id AutonomousDatabaseBackupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Autonomous Database Name: %q", id.AutonomousDatabaseName), + fmt.Sprintf("Autonomous Database Backup Name: %q", id.AutonomousDatabaseBackupName), + } + return fmt.Sprintf("Autonomous Database Backup (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/id_autonomousdatabasebackup_test.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/id_autonomousdatabasebackup_test.go new file mode 100644 index 00000000000..095d7f88ef1 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/id_autonomousdatabasebackup_test.go @@ -0,0 +1,327 @@ +package autonomousdatabasebackups + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &AutonomousDatabaseBackupId{} + +func TestNewAutonomousDatabaseBackupID(t *testing.T) { + id := NewAutonomousDatabaseBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseName", "autonomousDatabaseBackupName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.AutonomousDatabaseName != "autonomousDatabaseName" { + t.Fatalf("Expected %q but got %q for Segment 'AutonomousDatabaseName'", id.AutonomousDatabaseName, "autonomousDatabaseName") + } + + if id.AutonomousDatabaseBackupName != "autonomousDatabaseBackupName" { + t.Fatalf("Expected %q but got %q for Segment 'AutonomousDatabaseBackupName'", id.AutonomousDatabaseBackupName, "autonomousDatabaseBackupName") + } +} + +func TestFormatAutonomousDatabaseBackupID(t *testing.T) { + actual := NewAutonomousDatabaseBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseName", "autonomousDatabaseBackupName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases/autonomousDatabaseName/autonomousDatabaseBackups/autonomousDatabaseBackupName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseAutonomousDatabaseBackupID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AutonomousDatabaseBackupId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases/autonomousDatabaseName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases/autonomousDatabaseName/autonomousDatabaseBackups", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases/autonomousDatabaseName/autonomousDatabaseBackups/autonomousDatabaseBackupName", + Expected: &AutonomousDatabaseBackupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + AutonomousDatabaseName: "autonomousDatabaseName", + AutonomousDatabaseBackupName: "autonomousDatabaseBackupName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases/autonomousDatabaseName/autonomousDatabaseBackups/autonomousDatabaseBackupName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAutonomousDatabaseBackupID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.AutonomousDatabaseName != v.Expected.AutonomousDatabaseName { + t.Fatalf("Expected %q but got %q for AutonomousDatabaseName", v.Expected.AutonomousDatabaseName, actual.AutonomousDatabaseName) + } + + if actual.AutonomousDatabaseBackupName != v.Expected.AutonomousDatabaseBackupName { + t.Fatalf("Expected %q but got %q for AutonomousDatabaseBackupName", v.Expected.AutonomousDatabaseBackupName, actual.AutonomousDatabaseBackupName) + } + + } +} + +func TestParseAutonomousDatabaseBackupIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AutonomousDatabaseBackupId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/aUtOnOmOuSdAtAbAsEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases/autonomousDatabaseName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/aUtOnOmOuSdAtAbAsEs/aUtOnOmOuSdAtAbAsEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases/autonomousDatabaseName/autonomousDatabaseBackups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/aUtOnOmOuSdAtAbAsEs/aUtOnOmOuSdAtAbAsEnAmE/aUtOnOmOuSdAtAbAsEbAcKuPs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases/autonomousDatabaseName/autonomousDatabaseBackups/autonomousDatabaseBackupName", + Expected: &AutonomousDatabaseBackupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + AutonomousDatabaseName: "autonomousDatabaseName", + AutonomousDatabaseBackupName: "autonomousDatabaseBackupName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases/autonomousDatabaseName/autonomousDatabaseBackups/autonomousDatabaseBackupName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/aUtOnOmOuSdAtAbAsEs/aUtOnOmOuSdAtAbAsEnAmE/aUtOnOmOuSdAtAbAsEbAcKuPs/aUtOnOmOuSdAtAbAsEbAcKuPnAmE", + Expected: &AutonomousDatabaseBackupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + AutonomousDatabaseName: "aUtOnOmOuSdAtAbAsEnAmE", + AutonomousDatabaseBackupName: "aUtOnOmOuSdAtAbAsEbAcKuPnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/aUtOnOmOuSdAtAbAsEs/aUtOnOmOuSdAtAbAsEnAmE/aUtOnOmOuSdAtAbAsEbAcKuPs/aUtOnOmOuSdAtAbAsEbAcKuPnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAutonomousDatabaseBackupIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.AutonomousDatabaseName != v.Expected.AutonomousDatabaseName { + t.Fatalf("Expected %q but got %q for AutonomousDatabaseName", v.Expected.AutonomousDatabaseName, actual.AutonomousDatabaseName) + } + + if actual.AutonomousDatabaseBackupName != v.Expected.AutonomousDatabaseBackupName { + t.Fatalf("Expected %q but got %q for AutonomousDatabaseBackupName", v.Expected.AutonomousDatabaseBackupName, actual.AutonomousDatabaseBackupName) + } + + } +} + +func TestSegmentsForAutonomousDatabaseBackupId(t *testing.T) { + segments := AutonomousDatabaseBackupId{}.Segments() + if len(segments) == 0 { + t.Fatalf("AutonomousDatabaseBackupId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/method_createorupdate.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/method_createorupdate.go new file mode 100644 index 00000000000..81b5ea2dbce --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/method_createorupdate.go @@ -0,0 +1,75 @@ +package autonomousdatabasebackups + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AutonomousDatabaseBackup +} + +// CreateOrUpdate ... +func (c AutonomousDatabaseBackupsClient) CreateOrUpdate(ctx context.Context, id AutonomousDatabaseBackupId, input AutonomousDatabaseBackup) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c AutonomousDatabaseBackupsClient) CreateOrUpdateThenPoll(ctx context.Context, id AutonomousDatabaseBackupId, input AutonomousDatabaseBackup) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/method_delete.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/method_delete.go new file mode 100644 index 00000000000..4af10c5bf28 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/method_delete.go @@ -0,0 +1,70 @@ +package autonomousdatabasebackups + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c AutonomousDatabaseBackupsClient) Delete(ctx context.Context, id AutonomousDatabaseBackupId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c AutonomousDatabaseBackupsClient) DeleteThenPoll(ctx context.Context, id AutonomousDatabaseBackupId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/method_get.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/method_get.go new file mode 100644 index 00000000000..57459c26d22 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/method_get.go @@ -0,0 +1,53 @@ +package autonomousdatabasebackups + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AutonomousDatabaseBackup +} + +// Get ... +func (c AutonomousDatabaseBackupsClient) Get(ctx context.Context, id AutonomousDatabaseBackupId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model AutonomousDatabaseBackup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/method_listbyparent.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/method_listbyparent.go new file mode 100644 index 00000000000..6db542ef277 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/method_listbyparent.go @@ -0,0 +1,105 @@ +package autonomousdatabasebackups + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByParentOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AutonomousDatabaseBackup +} + +type ListByParentCompleteResult struct { + LatestHttpResponse *http.Response + Items []AutonomousDatabaseBackup +} + +type ListByParentCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByParentCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByParent ... +func (c AutonomousDatabaseBackupsClient) ListByParent(ctx context.Context, id AutonomousDatabaseId) (result ListByParentOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByParentCustomPager{}, + Path: fmt.Sprintf("%s/autonomousDatabaseBackups", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]AutonomousDatabaseBackup `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByParentComplete retrieves all the results into a single object +func (c AutonomousDatabaseBackupsClient) ListByParentComplete(ctx context.Context, id AutonomousDatabaseId) (ListByParentCompleteResult, error) { + return c.ListByParentCompleteMatchingPredicate(ctx, id, AutonomousDatabaseBackupOperationPredicate{}) +} + +// ListByParentCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AutonomousDatabaseBackupsClient) ListByParentCompleteMatchingPredicate(ctx context.Context, id AutonomousDatabaseId, predicate AutonomousDatabaseBackupOperationPredicate) (result ListByParentCompleteResult, err error) { + items := make([]AutonomousDatabaseBackup, 0) + + resp, err := c.ListByParent(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByParentCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/method_update.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/method_update.go new file mode 100644 index 00000000000..e769ca8bab9 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/method_update.go @@ -0,0 +1,75 @@ +package autonomousdatabasebackups + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AutonomousDatabaseBackup +} + +// Update ... +func (c AutonomousDatabaseBackupsClient) Update(ctx context.Context, id AutonomousDatabaseBackupId, input AutonomousDatabaseBackupUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c AutonomousDatabaseBackupsClient) UpdateThenPoll(ctx context.Context, id AutonomousDatabaseBackupId, input AutonomousDatabaseBackupUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/model_autonomousdatabasebackup.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/model_autonomousdatabasebackup.go new file mode 100644 index 00000000000..d58ba310e22 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/model_autonomousdatabasebackup.go @@ -0,0 +1,16 @@ +package autonomousdatabasebackups + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabaseBackup struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AutonomousDatabaseBackupProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/model_autonomousdatabasebackupproperties.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/model_autonomousdatabasebackupproperties.go new file mode 100644 index 00000000000..bb592faa99a --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/model_autonomousdatabasebackupproperties.go @@ -0,0 +1,41 @@ +package autonomousdatabasebackups + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabaseBackupProperties struct { + AutonomousDatabaseOcid *string `json:"autonomousDatabaseOcid,omitempty"` + BackupType *AutonomousDatabaseBackupType `json:"backupType,omitempty"` + DatabaseSizeInTbs *float64 `json:"databaseSizeInTbs,omitempty"` + DbVersion *string `json:"dbVersion,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + IsAutomatic *bool `json:"isAutomatic,omitempty"` + IsRestorable *bool `json:"isRestorable,omitempty"` + LifecycleDetails *string `json:"lifecycleDetails,omitempty"` + LifecycleState *AutonomousDatabaseBackupLifecycleState `json:"lifecycleState,omitempty"` + Ocid *string `json:"ocid,omitempty"` + ProvisioningState *AzureResourceProvisioningState `json:"provisioningState,omitempty"` + RetentionPeriodInDays *int64 `json:"retentionPeriodInDays,omitempty"` + SizeInTbs *float64 `json:"sizeInTbs,omitempty"` + TimeAvailableTil *string `json:"timeAvailableTil,omitempty"` + TimeEnded *string `json:"timeEnded,omitempty"` + TimeStarted *string `json:"timeStarted,omitempty"` +} + +func (o *AutonomousDatabaseBackupProperties) GetTimeAvailableTilAsTime() (*time.Time, error) { + if o.TimeAvailableTil == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeAvailableTil, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutonomousDatabaseBackupProperties) SetTimeAvailableTilAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeAvailableTil = &formatted +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/model_autonomousdatabasebackupupdate.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/model_autonomousdatabasebackupupdate.go new file mode 100644 index 00000000000..4ccab72b0dc --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/model_autonomousdatabasebackupupdate.go @@ -0,0 +1,8 @@ +package autonomousdatabasebackups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabaseBackupUpdate struct { + Properties *AutonomousDatabaseBackupUpdateProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/version.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/model_autonomousdatabasebackupupdateproperties.go similarity index 50% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/version.go rename to resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/model_autonomousdatabasebackupupdateproperties.go index 733481aa8ad..cebcbe7eb15 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/version.go +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/model_autonomousdatabasebackupupdateproperties.go @@ -1,10 +1,8 @@ -package backupusagesummaries +package autonomousdatabasebackups // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2025-02-01" - -func userAgent() string { - return "hashicorp/go-azure-sdk/backupusagesummaries/2025-02-01" +type AutonomousDatabaseBackupUpdateProperties struct { + RetentionPeriodInDays *int64 `json:"retentionPeriodInDays,omitempty"` } diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/predicates.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/predicates.go new file mode 100644 index 00000000000..ba62aa1ff05 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/predicates.go @@ -0,0 +1,27 @@ +package autonomousdatabasebackups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabaseBackupOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p AutonomousDatabaseBackupOperationPredicate) Matches(input AutonomousDatabaseBackup) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/version.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/version.go new file mode 100644 index 00000000000..4dd333981d0 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups/version.go @@ -0,0 +1,10 @@ +package autonomousdatabasebackups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-09-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/autonomousdatabasebackups/2025-09-01" +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/README.md b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/README.md new file mode 100644 index 00000000000..410bb373ed4 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets` Documentation + +The `autonomousdatabasecharactersets` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets" +``` + + +### Client Initialization + +```go +client := autonomousdatabasecharactersets.NewAutonomousDatabaseCharacterSetsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AutonomousDatabaseCharacterSetsClient.Get` + +```go +ctx := context.TODO() +id := autonomousdatabasecharactersets.NewAutonomousDatabaseCharacterSetID("12345678-1234-9876-4563-123456789012", "locationName", "autonomousDatabaseCharacterSetName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AutonomousDatabaseCharacterSetsClient.ListByLocation` + +```go +ctx := context.TODO() +id := autonomousdatabasecharactersets.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +// alternatively `client.ListByLocation(ctx, id)` can be used to do batched pagination +items, err := client.ListByLocationComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/client.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/client.go new file mode 100644 index 00000000000..9ce4a4fa357 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/client.go @@ -0,0 +1,26 @@ +package autonomousdatabasecharactersets + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabaseCharacterSetsClient struct { + Client *resourcemanager.Client +} + +func NewAutonomousDatabaseCharacterSetsClientWithBaseURI(sdkApi sdkEnv.Api) (*AutonomousDatabaseCharacterSetsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "autonomousdatabasecharactersets", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AutonomousDatabaseCharacterSetsClient: %+v", err) + } + + return &AutonomousDatabaseCharacterSetsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/id_autonomousdatabasecharacterset.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/id_autonomousdatabasecharacterset.go new file mode 100644 index 00000000000..5bd55410b85 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/id_autonomousdatabasecharacterset.go @@ -0,0 +1,130 @@ +package autonomousdatabasecharactersets + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&AutonomousDatabaseCharacterSetId{}) +} + +var _ resourceids.ResourceId = &AutonomousDatabaseCharacterSetId{} + +// AutonomousDatabaseCharacterSetId is a struct representing the Resource ID for a Autonomous Database Character Set +type AutonomousDatabaseCharacterSetId struct { + SubscriptionId string + LocationName string + AutonomousDatabaseCharacterSetName string +} + +// NewAutonomousDatabaseCharacterSetID returns a new AutonomousDatabaseCharacterSetId struct +func NewAutonomousDatabaseCharacterSetID(subscriptionId string, locationName string, autonomousDatabaseCharacterSetName string) AutonomousDatabaseCharacterSetId { + return AutonomousDatabaseCharacterSetId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + AutonomousDatabaseCharacterSetName: autonomousDatabaseCharacterSetName, + } +} + +// ParseAutonomousDatabaseCharacterSetID parses 'input' into a AutonomousDatabaseCharacterSetId +func ParseAutonomousDatabaseCharacterSetID(input string) (*AutonomousDatabaseCharacterSetId, error) { + parser := resourceids.NewParserFromResourceIdType(&AutonomousDatabaseCharacterSetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AutonomousDatabaseCharacterSetId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseAutonomousDatabaseCharacterSetIDInsensitively parses 'input' case-insensitively into a AutonomousDatabaseCharacterSetId +// note: this method should only be used for API response data and not user input +func ParseAutonomousDatabaseCharacterSetIDInsensitively(input string) (*AutonomousDatabaseCharacterSetId, error) { + parser := resourceids.NewParserFromResourceIdType(&AutonomousDatabaseCharacterSetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AutonomousDatabaseCharacterSetId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AutonomousDatabaseCharacterSetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.AutonomousDatabaseCharacterSetName, ok = input.Parsed["autonomousDatabaseCharacterSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "autonomousDatabaseCharacterSetName", input) + } + + return nil +} + +// ValidateAutonomousDatabaseCharacterSetID checks that 'input' can be parsed as a Autonomous Database Character Set ID +func ValidateAutonomousDatabaseCharacterSetID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAutonomousDatabaseCharacterSetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Autonomous Database Character Set ID +func (id AutonomousDatabaseCharacterSetId) ID() string { + fmtString := "/subscriptions/%s/providers/Oracle.Database/locations/%s/autonomousDatabaseCharacterSets/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.AutonomousDatabaseCharacterSetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Autonomous Database Character Set ID +func (id AutonomousDatabaseCharacterSetId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticAutonomousDatabaseCharacterSets", "autonomousDatabaseCharacterSets", "autonomousDatabaseCharacterSets"), + resourceids.UserSpecifiedSegment("autonomousDatabaseCharacterSetName", "autonomousDatabaseCharacterSetName"), + } +} + +// String returns a human-readable description of this Autonomous Database Character Set ID +func (id AutonomousDatabaseCharacterSetId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Autonomous Database Character Set Name: %q", id.AutonomousDatabaseCharacterSetName), + } + return fmt.Sprintf("Autonomous Database Character Set (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/id_autonomousdatabasecharacterset_test.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/id_autonomousdatabasecharacterset_test.go new file mode 100644 index 00000000000..7ba24b7d0f9 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/id_autonomousdatabasecharacterset_test.go @@ -0,0 +1,282 @@ +package autonomousdatabasecharactersets + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &AutonomousDatabaseCharacterSetId{} + +func TestNewAutonomousDatabaseCharacterSetID(t *testing.T) { + id := NewAutonomousDatabaseCharacterSetID("12345678-1234-9876-4563-123456789012", "locationName", "autonomousDatabaseCharacterSetName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.AutonomousDatabaseCharacterSetName != "autonomousDatabaseCharacterSetName" { + t.Fatalf("Expected %q but got %q for Segment 'AutonomousDatabaseCharacterSetName'", id.AutonomousDatabaseCharacterSetName, "autonomousDatabaseCharacterSetName") + } +} + +func TestFormatAutonomousDatabaseCharacterSetID(t *testing.T) { + actual := NewAutonomousDatabaseCharacterSetID("12345678-1234-9876-4563-123456789012", "locationName", "autonomousDatabaseCharacterSetName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/autonomousDatabaseCharacterSets/autonomousDatabaseCharacterSetName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseAutonomousDatabaseCharacterSetID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AutonomousDatabaseCharacterSetId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/autonomousDatabaseCharacterSets", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/autonomousDatabaseCharacterSets/autonomousDatabaseCharacterSetName", + Expected: &AutonomousDatabaseCharacterSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + AutonomousDatabaseCharacterSetName: "autonomousDatabaseCharacterSetName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/autonomousDatabaseCharacterSets/autonomousDatabaseCharacterSetName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAutonomousDatabaseCharacterSetID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.AutonomousDatabaseCharacterSetName != v.Expected.AutonomousDatabaseCharacterSetName { + t.Fatalf("Expected %q but got %q for AutonomousDatabaseCharacterSetName", v.Expected.AutonomousDatabaseCharacterSetName, actual.AutonomousDatabaseCharacterSetName) + } + + } +} + +func TestParseAutonomousDatabaseCharacterSetIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AutonomousDatabaseCharacterSetId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/autonomousDatabaseCharacterSets", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/aUtOnOmOuSdAtAbAsEcHaRaCtErSeTs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/autonomousDatabaseCharacterSets/autonomousDatabaseCharacterSetName", + Expected: &AutonomousDatabaseCharacterSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + AutonomousDatabaseCharacterSetName: "autonomousDatabaseCharacterSetName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/autonomousDatabaseCharacterSets/autonomousDatabaseCharacterSetName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/aUtOnOmOuSdAtAbAsEcHaRaCtErSeTs/aUtOnOmOuSdAtAbAsEcHaRaCtErSeTnAmE", + Expected: &AutonomousDatabaseCharacterSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + AutonomousDatabaseCharacterSetName: "aUtOnOmOuSdAtAbAsEcHaRaCtErSeTnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/aUtOnOmOuSdAtAbAsEcHaRaCtErSeTs/aUtOnOmOuSdAtAbAsEcHaRaCtErSeTnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAutonomousDatabaseCharacterSetIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.AutonomousDatabaseCharacterSetName != v.Expected.AutonomousDatabaseCharacterSetName { + t.Fatalf("Expected %q but got %q for AutonomousDatabaseCharacterSetName", v.Expected.AutonomousDatabaseCharacterSetName, actual.AutonomousDatabaseCharacterSetName) + } + + } +} + +func TestSegmentsForAutonomousDatabaseCharacterSetId(t *testing.T) { + segments := AutonomousDatabaseCharacterSetId{}.Segments() + if len(segments) == 0 { + t.Fatalf("AutonomousDatabaseCharacterSetId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/id_location.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/id_location.go similarity index 93% rename from resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/id_location.go rename to resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/id_location.go index 8347c40e5d8..1afa483132c 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/id_location.go +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/id_location.go @@ -1,4 +1,4 @@ -package featuresupport +package autonomousdatabasecharactersets import ( "fmt" @@ -95,7 +95,7 @@ func ValidateLocationID(input interface{}, key string) (warnings []string, error // ID returns the formatted Location ID func (id LocationId) ID() string { - fmtString := "/subscriptions/%s/providers/Microsoft.RecoveryServices/locations/%s" + fmtString := "/subscriptions/%s/providers/Oracle.Database/locations/%s" return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) } @@ -105,7 +105,7 @@ func (id LocationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), resourceids.StaticSegment("staticLocations", "locations", "locations"), resourceids.UserSpecifiedSegment("locationName", "locationName"), } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/id_location_test.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/id_location_test.go similarity index 89% rename from resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/id_location_test.go rename to resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/id_location_test.go index c8e2c22eea9..bbf6cec32fe 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/id_location_test.go +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/id_location_test.go @@ -1,4 +1,4 @@ -package featuresupport +package autonomousdatabasecharactersets import ( "testing" @@ -25,7 +25,7 @@ func TestNewLocationID(t *testing.T) { func TestFormatLocationID(t *testing.T) { actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName" + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName" if actual != expected { t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) } @@ -59,17 +59,17 @@ func TestParseLocationID(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", Expected: &LocationId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", LocationName: "locationName", @@ -77,7 +77,7 @@ func TestParseLocationID(t *testing.T) { }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/extra", Error: true, }, } @@ -150,27 +150,27 @@ func TestParseLocationIDInsensitively(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/lOcAtIoNs", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", Expected: &LocationId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", LocationName: "locationName", @@ -178,12 +178,12 @@ func TestParseLocationIDInsensitively(t *testing.T) { }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/extra", Error: true, }, { // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/lOcAtIoNs/lOcAtIoNnAmE", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE", Expected: &LocationId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", LocationName: "lOcAtIoNnAmE", @@ -191,7 +191,7 @@ func TestParseLocationIDInsensitively(t *testing.T) { }, { // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/lOcAtIoNs/lOcAtIoNnAmE/extra", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/extra", Error: true, }, } diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/method_get.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/method_get.go new file mode 100644 index 00000000000..a221ce4e867 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/method_get.go @@ -0,0 +1,53 @@ +package autonomousdatabasecharactersets + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AutonomousDatabaseCharacterSet +} + +// Get ... +func (c AutonomousDatabaseCharacterSetsClient) Get(ctx context.Context, id AutonomousDatabaseCharacterSetId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model AutonomousDatabaseCharacterSet + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/method_listbylocation.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/method_listbylocation.go new file mode 100644 index 00000000000..fed9644ac13 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/method_listbylocation.go @@ -0,0 +1,105 @@ +package autonomousdatabasecharactersets + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByLocationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AutonomousDatabaseCharacterSet +} + +type ListByLocationCompleteResult struct { + LatestHttpResponse *http.Response + Items []AutonomousDatabaseCharacterSet +} + +type ListByLocationCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByLocationCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByLocation ... +func (c AutonomousDatabaseCharacterSetsClient) ListByLocation(ctx context.Context, id LocationId) (result ListByLocationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByLocationCustomPager{}, + Path: fmt.Sprintf("%s/autonomousDatabaseCharacterSets", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]AutonomousDatabaseCharacterSet `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByLocationComplete retrieves all the results into a single object +func (c AutonomousDatabaseCharacterSetsClient) ListByLocationComplete(ctx context.Context, id LocationId) (ListByLocationCompleteResult, error) { + return c.ListByLocationCompleteMatchingPredicate(ctx, id, AutonomousDatabaseCharacterSetOperationPredicate{}) +} + +// ListByLocationCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AutonomousDatabaseCharacterSetsClient) ListByLocationCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate AutonomousDatabaseCharacterSetOperationPredicate) (result ListByLocationCompleteResult, err error) { + items := make([]AutonomousDatabaseCharacterSet, 0) + + resp, err := c.ListByLocation(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByLocationCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/model_autonomousdatabasecharacterset.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/model_autonomousdatabasecharacterset.go new file mode 100644 index 00000000000..6fa0b10b403 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/model_autonomousdatabasecharacterset.go @@ -0,0 +1,16 @@ +package autonomousdatabasecharactersets + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabaseCharacterSet struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AutonomousDatabaseCharacterSetProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/model_autonomousdatabasecharactersetproperties.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/model_autonomousdatabasecharactersetproperties.go new file mode 100644 index 00000000000..7be031b5131 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/model_autonomousdatabasecharactersetproperties.go @@ -0,0 +1,8 @@ +package autonomousdatabasecharactersets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabaseCharacterSetProperties struct { + CharacterSet string `json:"characterSet"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/predicates.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/predicates.go new file mode 100644 index 00000000000..248c5399d40 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/predicates.go @@ -0,0 +1,27 @@ +package autonomousdatabasecharactersets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabaseCharacterSetOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p AutonomousDatabaseCharacterSetOperationPredicate) Matches(input AutonomousDatabaseCharacterSet) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/version.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/version.go new file mode 100644 index 00000000000..5346a58d924 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets/version.go @@ -0,0 +1,10 @@ +package autonomousdatabasecharactersets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-09-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/autonomousdatabasecharactersets/2025-09-01" +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/README.md b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/README.md new file mode 100644 index 00000000000..194e7fa6a6a --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets` Documentation + +The `autonomousdatabasenationalcharactersets` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets" +``` + + +### Client Initialization + +```go +client := autonomousdatabasenationalcharactersets.NewAutonomousDatabaseNationalCharacterSetsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AutonomousDatabaseNationalCharacterSetsClient.Get` + +```go +ctx := context.TODO() +id := autonomousdatabasenationalcharactersets.NewAutonomousDatabaseNationalCharacterSetID("12345678-1234-9876-4563-123456789012", "locationName", "autonomousDatabaseNationalCharacterSetName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AutonomousDatabaseNationalCharacterSetsClient.ListByLocation` + +```go +ctx := context.TODO() +id := autonomousdatabasenationalcharactersets.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +// alternatively `client.ListByLocation(ctx, id)` can be used to do batched pagination +items, err := client.ListByLocationComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/client.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/client.go new file mode 100644 index 00000000000..a02efac62b7 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/client.go @@ -0,0 +1,26 @@ +package autonomousdatabasenationalcharactersets + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabaseNationalCharacterSetsClient struct { + Client *resourcemanager.Client +} + +func NewAutonomousDatabaseNationalCharacterSetsClientWithBaseURI(sdkApi sdkEnv.Api) (*AutonomousDatabaseNationalCharacterSetsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "autonomousdatabasenationalcharactersets", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AutonomousDatabaseNationalCharacterSetsClient: %+v", err) + } + + return &AutonomousDatabaseNationalCharacterSetsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/id_autonomousdatabasenationalcharacterset.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/id_autonomousdatabasenationalcharacterset.go new file mode 100644 index 00000000000..97a41a6ea49 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/id_autonomousdatabasenationalcharacterset.go @@ -0,0 +1,130 @@ +package autonomousdatabasenationalcharactersets + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&AutonomousDatabaseNationalCharacterSetId{}) +} + +var _ resourceids.ResourceId = &AutonomousDatabaseNationalCharacterSetId{} + +// AutonomousDatabaseNationalCharacterSetId is a struct representing the Resource ID for a Autonomous Database National Character Set +type AutonomousDatabaseNationalCharacterSetId struct { + SubscriptionId string + LocationName string + AutonomousDatabaseNationalCharacterSetName string +} + +// NewAutonomousDatabaseNationalCharacterSetID returns a new AutonomousDatabaseNationalCharacterSetId struct +func NewAutonomousDatabaseNationalCharacterSetID(subscriptionId string, locationName string, autonomousDatabaseNationalCharacterSetName string) AutonomousDatabaseNationalCharacterSetId { + return AutonomousDatabaseNationalCharacterSetId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + AutonomousDatabaseNationalCharacterSetName: autonomousDatabaseNationalCharacterSetName, + } +} + +// ParseAutonomousDatabaseNationalCharacterSetID parses 'input' into a AutonomousDatabaseNationalCharacterSetId +func ParseAutonomousDatabaseNationalCharacterSetID(input string) (*AutonomousDatabaseNationalCharacterSetId, error) { + parser := resourceids.NewParserFromResourceIdType(&AutonomousDatabaseNationalCharacterSetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AutonomousDatabaseNationalCharacterSetId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseAutonomousDatabaseNationalCharacterSetIDInsensitively parses 'input' case-insensitively into a AutonomousDatabaseNationalCharacterSetId +// note: this method should only be used for API response data and not user input +func ParseAutonomousDatabaseNationalCharacterSetIDInsensitively(input string) (*AutonomousDatabaseNationalCharacterSetId, error) { + parser := resourceids.NewParserFromResourceIdType(&AutonomousDatabaseNationalCharacterSetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AutonomousDatabaseNationalCharacterSetId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AutonomousDatabaseNationalCharacterSetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.AutonomousDatabaseNationalCharacterSetName, ok = input.Parsed["autonomousDatabaseNationalCharacterSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "autonomousDatabaseNationalCharacterSetName", input) + } + + return nil +} + +// ValidateAutonomousDatabaseNationalCharacterSetID checks that 'input' can be parsed as a Autonomous Database National Character Set ID +func ValidateAutonomousDatabaseNationalCharacterSetID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAutonomousDatabaseNationalCharacterSetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Autonomous Database National Character Set ID +func (id AutonomousDatabaseNationalCharacterSetId) ID() string { + fmtString := "/subscriptions/%s/providers/Oracle.Database/locations/%s/autonomousDatabaseNationalCharacterSets/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.AutonomousDatabaseNationalCharacterSetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Autonomous Database National Character Set ID +func (id AutonomousDatabaseNationalCharacterSetId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticAutonomousDatabaseNationalCharacterSets", "autonomousDatabaseNationalCharacterSets", "autonomousDatabaseNationalCharacterSets"), + resourceids.UserSpecifiedSegment("autonomousDatabaseNationalCharacterSetName", "autonomousDatabaseNationalCharacterSetName"), + } +} + +// String returns a human-readable description of this Autonomous Database National Character Set ID +func (id AutonomousDatabaseNationalCharacterSetId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Autonomous Database National Character Set Name: %q", id.AutonomousDatabaseNationalCharacterSetName), + } + return fmt.Sprintf("Autonomous Database National Character Set (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/id_autonomousdatabasenationalcharacterset_test.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/id_autonomousdatabasenationalcharacterset_test.go new file mode 100644 index 00000000000..9c0aa774406 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/id_autonomousdatabasenationalcharacterset_test.go @@ -0,0 +1,282 @@ +package autonomousdatabasenationalcharactersets + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &AutonomousDatabaseNationalCharacterSetId{} + +func TestNewAutonomousDatabaseNationalCharacterSetID(t *testing.T) { + id := NewAutonomousDatabaseNationalCharacterSetID("12345678-1234-9876-4563-123456789012", "locationName", "autonomousDatabaseNationalCharacterSetName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.AutonomousDatabaseNationalCharacterSetName != "autonomousDatabaseNationalCharacterSetName" { + t.Fatalf("Expected %q but got %q for Segment 'AutonomousDatabaseNationalCharacterSetName'", id.AutonomousDatabaseNationalCharacterSetName, "autonomousDatabaseNationalCharacterSetName") + } +} + +func TestFormatAutonomousDatabaseNationalCharacterSetID(t *testing.T) { + actual := NewAutonomousDatabaseNationalCharacterSetID("12345678-1234-9876-4563-123456789012", "locationName", "autonomousDatabaseNationalCharacterSetName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/autonomousDatabaseNationalCharacterSets/autonomousDatabaseNationalCharacterSetName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseAutonomousDatabaseNationalCharacterSetID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AutonomousDatabaseNationalCharacterSetId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/autonomousDatabaseNationalCharacterSets", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/autonomousDatabaseNationalCharacterSets/autonomousDatabaseNationalCharacterSetName", + Expected: &AutonomousDatabaseNationalCharacterSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + AutonomousDatabaseNationalCharacterSetName: "autonomousDatabaseNationalCharacterSetName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/autonomousDatabaseNationalCharacterSets/autonomousDatabaseNationalCharacterSetName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAutonomousDatabaseNationalCharacterSetID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.AutonomousDatabaseNationalCharacterSetName != v.Expected.AutonomousDatabaseNationalCharacterSetName { + t.Fatalf("Expected %q but got %q for AutonomousDatabaseNationalCharacterSetName", v.Expected.AutonomousDatabaseNationalCharacterSetName, actual.AutonomousDatabaseNationalCharacterSetName) + } + + } +} + +func TestParseAutonomousDatabaseNationalCharacterSetIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AutonomousDatabaseNationalCharacterSetId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/autonomousDatabaseNationalCharacterSets", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/aUtOnOmOuSdAtAbAsEnAtIoNaLcHaRaCtErSeTs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/autonomousDatabaseNationalCharacterSets/autonomousDatabaseNationalCharacterSetName", + Expected: &AutonomousDatabaseNationalCharacterSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + AutonomousDatabaseNationalCharacterSetName: "autonomousDatabaseNationalCharacterSetName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/autonomousDatabaseNationalCharacterSets/autonomousDatabaseNationalCharacterSetName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/aUtOnOmOuSdAtAbAsEnAtIoNaLcHaRaCtErSeTs/aUtOnOmOuSdAtAbAsEnAtIoNaLcHaRaCtErSeTnAmE", + Expected: &AutonomousDatabaseNationalCharacterSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + AutonomousDatabaseNationalCharacterSetName: "aUtOnOmOuSdAtAbAsEnAtIoNaLcHaRaCtErSeTnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/aUtOnOmOuSdAtAbAsEnAtIoNaLcHaRaCtErSeTs/aUtOnOmOuSdAtAbAsEnAtIoNaLcHaRaCtErSeTnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAutonomousDatabaseNationalCharacterSetIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.AutonomousDatabaseNationalCharacterSetName != v.Expected.AutonomousDatabaseNationalCharacterSetName { + t.Fatalf("Expected %q but got %q for AutonomousDatabaseNationalCharacterSetName", v.Expected.AutonomousDatabaseNationalCharacterSetName, actual.AutonomousDatabaseNationalCharacterSetName) + } + + } +} + +func TestSegmentsForAutonomousDatabaseNationalCharacterSetId(t *testing.T) { + segments := AutonomousDatabaseNationalCharacterSetId{}.Segments() + if len(segments) == 0 { + t.Fatalf("AutonomousDatabaseNationalCharacterSetId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/id_location.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/id_location.go similarity index 93% rename from resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/id_location.go rename to resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/id_location.go index 98c32ddf030..a999a7f708c 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/id_location.go +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/id_location.go @@ -1,4 +1,4 @@ -package protectionintent +package autonomousdatabasenationalcharactersets import ( "fmt" @@ -95,7 +95,7 @@ func ValidateLocationID(input interface{}, key string) (warnings []string, error // ID returns the formatted Location ID func (id LocationId) ID() string { - fmtString := "/subscriptions/%s/providers/Microsoft.RecoveryServices/locations/%s" + fmtString := "/subscriptions/%s/providers/Oracle.Database/locations/%s" return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) } @@ -105,7 +105,7 @@ func (id LocationId) Segments() []resourceids.Segment { resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), resourceids.StaticSegment("staticLocations", "locations", "locations"), resourceids.UserSpecifiedSegment("locationName", "locationName"), } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/id_location_test.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/id_location_test.go similarity index 89% rename from resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/id_location_test.go rename to resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/id_location_test.go index 091fdeda511..bb93e326887 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/id_location_test.go +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/id_location_test.go @@ -1,4 +1,4 @@ -package protectionintent +package autonomousdatabasenationalcharactersets import ( "testing" @@ -25,7 +25,7 @@ func TestNewLocationID(t *testing.T) { func TestFormatLocationID(t *testing.T) { actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName" + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName" if actual != expected { t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) } @@ -59,17 +59,17 @@ func TestParseLocationID(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", Expected: &LocationId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", LocationName: "locationName", @@ -77,7 +77,7 @@ func TestParseLocationID(t *testing.T) { }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/extra", Error: true, }, } @@ -150,27 +150,27 @@ func TestParseLocationIDInsensitively(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/lOcAtIoNs", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", Expected: &LocationId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", LocationName: "locationName", @@ -178,12 +178,12 @@ func TestParseLocationIDInsensitively(t *testing.T) { }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/extra", Error: true, }, { // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/lOcAtIoNs/lOcAtIoNnAmE", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE", Expected: &LocationId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", LocationName: "lOcAtIoNnAmE", @@ -191,7 +191,7 @@ func TestParseLocationIDInsensitively(t *testing.T) { }, { // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/lOcAtIoNs/lOcAtIoNnAmE/extra", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/extra", Error: true, }, } diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/method_get.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/method_get.go new file mode 100644 index 00000000000..363ea0b0a5a --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/method_get.go @@ -0,0 +1,53 @@ +package autonomousdatabasenationalcharactersets + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AutonomousDatabaseNationalCharacterSet +} + +// Get ... +func (c AutonomousDatabaseNationalCharacterSetsClient) Get(ctx context.Context, id AutonomousDatabaseNationalCharacterSetId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model AutonomousDatabaseNationalCharacterSet + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/method_listbylocation.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/method_listbylocation.go new file mode 100644 index 00000000000..98ab6421827 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/method_listbylocation.go @@ -0,0 +1,105 @@ +package autonomousdatabasenationalcharactersets + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByLocationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AutonomousDatabaseNationalCharacterSet +} + +type ListByLocationCompleteResult struct { + LatestHttpResponse *http.Response + Items []AutonomousDatabaseNationalCharacterSet +} + +type ListByLocationCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByLocationCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByLocation ... +func (c AutonomousDatabaseNationalCharacterSetsClient) ListByLocation(ctx context.Context, id LocationId) (result ListByLocationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByLocationCustomPager{}, + Path: fmt.Sprintf("%s/autonomousDatabaseNationalCharacterSets", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]AutonomousDatabaseNationalCharacterSet `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByLocationComplete retrieves all the results into a single object +func (c AutonomousDatabaseNationalCharacterSetsClient) ListByLocationComplete(ctx context.Context, id LocationId) (ListByLocationCompleteResult, error) { + return c.ListByLocationCompleteMatchingPredicate(ctx, id, AutonomousDatabaseNationalCharacterSetOperationPredicate{}) +} + +// ListByLocationCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AutonomousDatabaseNationalCharacterSetsClient) ListByLocationCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate AutonomousDatabaseNationalCharacterSetOperationPredicate) (result ListByLocationCompleteResult, err error) { + items := make([]AutonomousDatabaseNationalCharacterSet, 0) + + resp, err := c.ListByLocation(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByLocationCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/model_autonomousdatabasenationalcharacterset.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/model_autonomousdatabasenationalcharacterset.go new file mode 100644 index 00000000000..1bf4f8d2c11 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/model_autonomousdatabasenationalcharacterset.go @@ -0,0 +1,16 @@ +package autonomousdatabasenationalcharactersets + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabaseNationalCharacterSet struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AutonomousDatabaseNationalCharacterSetProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/model_autonomousdatabasenationalcharactersetproperties.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/model_autonomousdatabasenationalcharactersetproperties.go new file mode 100644 index 00000000000..f55ed168e3f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/model_autonomousdatabasenationalcharactersetproperties.go @@ -0,0 +1,8 @@ +package autonomousdatabasenationalcharactersets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabaseNationalCharacterSetProperties struct { + CharacterSet string `json:"characterSet"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/predicates.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/predicates.go new file mode 100644 index 00000000000..6dcbbef5c7b --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/predicates.go @@ -0,0 +1,27 @@ +package autonomousdatabasenationalcharactersets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabaseNationalCharacterSetOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p AutonomousDatabaseNationalCharacterSetOperationPredicate) Matches(input AutonomousDatabaseNationalCharacterSet) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/version.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/version.go new file mode 100644 index 00000000000..83c01205d5f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets/version.go @@ -0,0 +1,10 @@ +package autonomousdatabasenationalcharactersets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-09-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/autonomousdatabasenationalcharactersets/2025-09-01" +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/README.md b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/README.md new file mode 100644 index 00000000000..5c8eb662c9c --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/README.md @@ -0,0 +1,235 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/autonomousdatabases` Documentation + +The `autonomousdatabases` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/autonomousdatabases" +``` + + +### Client Initialization + +```go +client := autonomousdatabases.NewAutonomousDatabasesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AutonomousDatabasesClient.Action` + +```go +ctx := context.TODO() +id := autonomousdatabases.NewAutonomousDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseName") + +payload := autonomousdatabases.AutonomousDatabaseLifecycleAction{ + // ... +} + + +if err := client.ActionThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AutonomousDatabasesClient.ChangeDisasterRecoveryConfiguration` + +```go +ctx := context.TODO() +id := autonomousdatabases.NewAutonomousDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseName") + +payload := autonomousdatabases.DisasterRecoveryConfigurationDetails{ + // ... +} + + +if err := client.ChangeDisasterRecoveryConfigurationThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AutonomousDatabasesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := autonomousdatabases.NewAutonomousDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseName") + +payload := autonomousdatabases.AutonomousDatabase{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AutonomousDatabasesClient.Delete` + +```go +ctx := context.TODO() +id := autonomousdatabases.NewAutonomousDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AutonomousDatabasesClient.Failover` + +```go +ctx := context.TODO() +id := autonomousdatabases.NewAutonomousDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseName") + +payload := autonomousdatabases.PeerDbDetails{ + // ... +} + + +if err := client.FailoverThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AutonomousDatabasesClient.GenerateWallet` + +```go +ctx := context.TODO() +id := autonomousdatabases.NewAutonomousDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseName") + +payload := autonomousdatabases.GenerateAutonomousDatabaseWalletDetails{ + // ... +} + + +read, err := client.GenerateWallet(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AutonomousDatabasesClient.Get` + +```go +ctx := context.TODO() +id := autonomousdatabases.NewAutonomousDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AutonomousDatabasesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AutonomousDatabasesClient.ListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AutonomousDatabasesClient.Restore` + +```go +ctx := context.TODO() +id := autonomousdatabases.NewAutonomousDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseName") + +payload := autonomousdatabases.RestoreAutonomousDatabaseDetails{ + // ... +} + + +if err := client.RestoreThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AutonomousDatabasesClient.Shrink` + +```go +ctx := context.TODO() +id := autonomousdatabases.NewAutonomousDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseName") + +if err := client.ShrinkThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AutonomousDatabasesClient.Switchover` + +```go +ctx := context.TODO() +id := autonomousdatabases.NewAutonomousDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseName") + +payload := autonomousdatabases.PeerDbDetails{ + // ... +} + + +if err := client.SwitchoverThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AutonomousDatabasesClient.Update` + +```go +ctx := context.TODO() +id := autonomousdatabases.NewAutonomousDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseName") + +payload := autonomousdatabases.AutonomousDatabaseUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/client.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/client.go new file mode 100644 index 00000000000..1e8755ba76c --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/client.go @@ -0,0 +1,26 @@ +package autonomousdatabases + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabasesClient struct { + Client *resourcemanager.Client +} + +func NewAutonomousDatabasesClientWithBaseURI(sdkApi sdkEnv.Api) (*AutonomousDatabasesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "autonomousdatabases", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AutonomousDatabasesClient: %+v", err) + } + + return &AutonomousDatabasesClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/constants.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/constants.go new file mode 100644 index 00000000000..0fbfc3dd030 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/constants.go @@ -0,0 +1,1355 @@ +package autonomousdatabases + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabaseLifecycleActionEnum string + +const ( + AutonomousDatabaseLifecycleActionEnumRestart AutonomousDatabaseLifecycleActionEnum = "Restart" + AutonomousDatabaseLifecycleActionEnumStart AutonomousDatabaseLifecycleActionEnum = "Start" + AutonomousDatabaseLifecycleActionEnumStop AutonomousDatabaseLifecycleActionEnum = "Stop" +) + +func PossibleValuesForAutonomousDatabaseLifecycleActionEnum() []string { + return []string{ + string(AutonomousDatabaseLifecycleActionEnumRestart), + string(AutonomousDatabaseLifecycleActionEnumStart), + string(AutonomousDatabaseLifecycleActionEnumStop), + } +} + +func (s *AutonomousDatabaseLifecycleActionEnum) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAutonomousDatabaseLifecycleActionEnum(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAutonomousDatabaseLifecycleActionEnum(input string) (*AutonomousDatabaseLifecycleActionEnum, error) { + vals := map[string]AutonomousDatabaseLifecycleActionEnum{ + "restart": AutonomousDatabaseLifecycleActionEnumRestart, + "start": AutonomousDatabaseLifecycleActionEnumStart, + "stop": AutonomousDatabaseLifecycleActionEnumStop, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AutonomousDatabaseLifecycleActionEnum(input) + return &out, nil +} + +type AutonomousDatabaseLifecycleState string + +const ( + AutonomousDatabaseLifecycleStateAvailable AutonomousDatabaseLifecycleState = "Available" + AutonomousDatabaseLifecycleStateAvailableNeedsAttention AutonomousDatabaseLifecycleState = "AvailableNeedsAttention" + AutonomousDatabaseLifecycleStateBackupInProgress AutonomousDatabaseLifecycleState = "BackupInProgress" + AutonomousDatabaseLifecycleStateInaccessible AutonomousDatabaseLifecycleState = "Inaccessible" + AutonomousDatabaseLifecycleStateMaintenanceInProgress AutonomousDatabaseLifecycleState = "MaintenanceInProgress" + AutonomousDatabaseLifecycleStateProvisioning AutonomousDatabaseLifecycleState = "Provisioning" + AutonomousDatabaseLifecycleStateRecreating AutonomousDatabaseLifecycleState = "Recreating" + AutonomousDatabaseLifecycleStateRestarting AutonomousDatabaseLifecycleState = "Restarting" + AutonomousDatabaseLifecycleStateRestoreFailed AutonomousDatabaseLifecycleState = "RestoreFailed" + AutonomousDatabaseLifecycleStateRestoreInProgress AutonomousDatabaseLifecycleState = "RestoreInProgress" + AutonomousDatabaseLifecycleStateRoleChangeInProgress AutonomousDatabaseLifecycleState = "RoleChangeInProgress" + AutonomousDatabaseLifecycleStateScaleInProgress AutonomousDatabaseLifecycleState = "ScaleInProgress" + AutonomousDatabaseLifecycleStateStandby AutonomousDatabaseLifecycleState = "Standby" + AutonomousDatabaseLifecycleStateStarting AutonomousDatabaseLifecycleState = "Starting" + AutonomousDatabaseLifecycleStateStopped AutonomousDatabaseLifecycleState = "Stopped" + AutonomousDatabaseLifecycleStateStopping AutonomousDatabaseLifecycleState = "Stopping" + AutonomousDatabaseLifecycleStateTerminated AutonomousDatabaseLifecycleState = "Terminated" + AutonomousDatabaseLifecycleStateTerminating AutonomousDatabaseLifecycleState = "Terminating" + AutonomousDatabaseLifecycleStateUnavailable AutonomousDatabaseLifecycleState = "Unavailable" + AutonomousDatabaseLifecycleStateUpdating AutonomousDatabaseLifecycleState = "Updating" + AutonomousDatabaseLifecycleStateUpgrading AutonomousDatabaseLifecycleState = "Upgrading" +) + +func PossibleValuesForAutonomousDatabaseLifecycleState() []string { + return []string{ + string(AutonomousDatabaseLifecycleStateAvailable), + string(AutonomousDatabaseLifecycleStateAvailableNeedsAttention), + string(AutonomousDatabaseLifecycleStateBackupInProgress), + string(AutonomousDatabaseLifecycleStateInaccessible), + string(AutonomousDatabaseLifecycleStateMaintenanceInProgress), + string(AutonomousDatabaseLifecycleStateProvisioning), + string(AutonomousDatabaseLifecycleStateRecreating), + string(AutonomousDatabaseLifecycleStateRestarting), + string(AutonomousDatabaseLifecycleStateRestoreFailed), + string(AutonomousDatabaseLifecycleStateRestoreInProgress), + string(AutonomousDatabaseLifecycleStateRoleChangeInProgress), + string(AutonomousDatabaseLifecycleStateScaleInProgress), + string(AutonomousDatabaseLifecycleStateStandby), + string(AutonomousDatabaseLifecycleStateStarting), + string(AutonomousDatabaseLifecycleStateStopped), + string(AutonomousDatabaseLifecycleStateStopping), + string(AutonomousDatabaseLifecycleStateTerminated), + string(AutonomousDatabaseLifecycleStateTerminating), + string(AutonomousDatabaseLifecycleStateUnavailable), + string(AutonomousDatabaseLifecycleStateUpdating), + string(AutonomousDatabaseLifecycleStateUpgrading), + } +} + +func (s *AutonomousDatabaseLifecycleState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAutonomousDatabaseLifecycleState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAutonomousDatabaseLifecycleState(input string) (*AutonomousDatabaseLifecycleState, error) { + vals := map[string]AutonomousDatabaseLifecycleState{ + "available": AutonomousDatabaseLifecycleStateAvailable, + "availableneedsattention": AutonomousDatabaseLifecycleStateAvailableNeedsAttention, + "backupinprogress": AutonomousDatabaseLifecycleStateBackupInProgress, + "inaccessible": AutonomousDatabaseLifecycleStateInaccessible, + "maintenanceinprogress": AutonomousDatabaseLifecycleStateMaintenanceInProgress, + "provisioning": AutonomousDatabaseLifecycleStateProvisioning, + "recreating": AutonomousDatabaseLifecycleStateRecreating, + "restarting": AutonomousDatabaseLifecycleStateRestarting, + "restorefailed": AutonomousDatabaseLifecycleStateRestoreFailed, + "restoreinprogress": AutonomousDatabaseLifecycleStateRestoreInProgress, + "rolechangeinprogress": AutonomousDatabaseLifecycleStateRoleChangeInProgress, + "scaleinprogress": AutonomousDatabaseLifecycleStateScaleInProgress, + "standby": AutonomousDatabaseLifecycleStateStandby, + "starting": AutonomousDatabaseLifecycleStateStarting, + "stopped": AutonomousDatabaseLifecycleStateStopped, + "stopping": AutonomousDatabaseLifecycleStateStopping, + "terminated": AutonomousDatabaseLifecycleStateTerminated, + "terminating": AutonomousDatabaseLifecycleStateTerminating, + "unavailable": AutonomousDatabaseLifecycleStateUnavailable, + "updating": AutonomousDatabaseLifecycleStateUpdating, + "upgrading": AutonomousDatabaseLifecycleStateUpgrading, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AutonomousDatabaseLifecycleState(input) + return &out, nil +} + +type AutonomousMaintenanceScheduleType string + +const ( + AutonomousMaintenanceScheduleTypeEarly AutonomousMaintenanceScheduleType = "Early" + AutonomousMaintenanceScheduleTypeRegular AutonomousMaintenanceScheduleType = "Regular" +) + +func PossibleValuesForAutonomousMaintenanceScheduleType() []string { + return []string{ + string(AutonomousMaintenanceScheduleTypeEarly), + string(AutonomousMaintenanceScheduleTypeRegular), + } +} + +func (s *AutonomousMaintenanceScheduleType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAutonomousMaintenanceScheduleType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAutonomousMaintenanceScheduleType(input string) (*AutonomousMaintenanceScheduleType, error) { + vals := map[string]AutonomousMaintenanceScheduleType{ + "early": AutonomousMaintenanceScheduleTypeEarly, + "regular": AutonomousMaintenanceScheduleTypeRegular, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AutonomousMaintenanceScheduleType(input) + return &out, nil +} + +type AzureResourceProvisioningState string + +const ( + AzureResourceProvisioningStateCanceled AzureResourceProvisioningState = "Canceled" + AzureResourceProvisioningStateFailed AzureResourceProvisioningState = "Failed" + AzureResourceProvisioningStateProvisioning AzureResourceProvisioningState = "Provisioning" + AzureResourceProvisioningStateSucceeded AzureResourceProvisioningState = "Succeeded" +) + +func PossibleValuesForAzureResourceProvisioningState() []string { + return []string{ + string(AzureResourceProvisioningStateCanceled), + string(AzureResourceProvisioningStateFailed), + string(AzureResourceProvisioningStateProvisioning), + string(AzureResourceProvisioningStateSucceeded), + } +} + +func (s *AzureResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAzureResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAzureResourceProvisioningState(input string) (*AzureResourceProvisioningState, error) { + vals := map[string]AzureResourceProvisioningState{ + "canceled": AzureResourceProvisioningStateCanceled, + "failed": AzureResourceProvisioningStateFailed, + "provisioning": AzureResourceProvisioningStateProvisioning, + "succeeded": AzureResourceProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AzureResourceProvisioningState(input) + return &out, nil +} + +type CloneType string + +const ( + CloneTypeFull CloneType = "Full" + CloneTypeMetadata CloneType = "Metadata" +) + +func PossibleValuesForCloneType() []string { + return []string{ + string(CloneTypeFull), + string(CloneTypeMetadata), + } +} + +func (s *CloneType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCloneType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCloneType(input string) (*CloneType, error) { + vals := map[string]CloneType{ + "full": CloneTypeFull, + "metadata": CloneTypeMetadata, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CloneType(input) + return &out, nil +} + +type ComputeModel string + +const ( + ComputeModelECPU ComputeModel = "ECPU" + ComputeModelOCPU ComputeModel = "OCPU" +) + +func PossibleValuesForComputeModel() []string { + return []string{ + string(ComputeModelECPU), + string(ComputeModelOCPU), + } +} + +func (s *ComputeModel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseComputeModel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseComputeModel(input string) (*ComputeModel, error) { + vals := map[string]ComputeModel{ + "ecpu": ComputeModelECPU, + "ocpu": ComputeModelOCPU, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComputeModel(input) + return &out, nil +} + +type ConsumerGroup string + +const ( + ConsumerGroupHigh ConsumerGroup = "High" + ConsumerGroupLow ConsumerGroup = "Low" + ConsumerGroupMedium ConsumerGroup = "Medium" + ConsumerGroupTp ConsumerGroup = "Tp" + ConsumerGroupTpurgent ConsumerGroup = "Tpurgent" +) + +func PossibleValuesForConsumerGroup() []string { + return []string{ + string(ConsumerGroupHigh), + string(ConsumerGroupLow), + string(ConsumerGroupMedium), + string(ConsumerGroupTp), + string(ConsumerGroupTpurgent), + } +} + +func (s *ConsumerGroup) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConsumerGroup(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseConsumerGroup(input string) (*ConsumerGroup, error) { + vals := map[string]ConsumerGroup{ + "high": ConsumerGroupHigh, + "low": ConsumerGroupLow, + "medium": ConsumerGroupMedium, + "tp": ConsumerGroupTp, + "tpurgent": ConsumerGroupTpurgent, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ConsumerGroup(input) + return &out, nil +} + +type DataBaseType string + +const ( + DataBaseTypeClone DataBaseType = "Clone" + DataBaseTypeCloneFromBackupTimestamp DataBaseType = "CloneFromBackupTimestamp" + DataBaseTypeCrossRegionDisasterRecovery DataBaseType = "CrossRegionDisasterRecovery" + DataBaseTypeRegular DataBaseType = "Regular" +) + +func PossibleValuesForDataBaseType() []string { + return []string{ + string(DataBaseTypeClone), + string(DataBaseTypeCloneFromBackupTimestamp), + string(DataBaseTypeCrossRegionDisasterRecovery), + string(DataBaseTypeRegular), + } +} + +func (s *DataBaseType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDataBaseType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDataBaseType(input string) (*DataBaseType, error) { + vals := map[string]DataBaseType{ + "clone": DataBaseTypeClone, + "clonefrombackuptimestamp": DataBaseTypeCloneFromBackupTimestamp, + "crossregiondisasterrecovery": DataBaseTypeCrossRegionDisasterRecovery, + "regular": DataBaseTypeRegular, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DataBaseType(input) + return &out, nil +} + +type DataSafeStatusType string + +const ( + DataSafeStatusTypeDeregistering DataSafeStatusType = "Deregistering" + DataSafeStatusTypeFailed DataSafeStatusType = "Failed" + DataSafeStatusTypeNotRegistered DataSafeStatusType = "NotRegistered" + DataSafeStatusTypeRegistered DataSafeStatusType = "Registered" + DataSafeStatusTypeRegistering DataSafeStatusType = "Registering" +) + +func PossibleValuesForDataSafeStatusType() []string { + return []string{ + string(DataSafeStatusTypeDeregistering), + string(DataSafeStatusTypeFailed), + string(DataSafeStatusTypeNotRegistered), + string(DataSafeStatusTypeRegistered), + string(DataSafeStatusTypeRegistering), + } +} + +func (s *DataSafeStatusType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDataSafeStatusType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDataSafeStatusType(input string) (*DataSafeStatusType, error) { + vals := map[string]DataSafeStatusType{ + "deregistering": DataSafeStatusTypeDeregistering, + "failed": DataSafeStatusTypeFailed, + "notregistered": DataSafeStatusTypeNotRegistered, + "registered": DataSafeStatusTypeRegistered, + "registering": DataSafeStatusTypeRegistering, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DataSafeStatusType(input) + return &out, nil +} + +type DatabaseEditionType string + +const ( + DatabaseEditionTypeEnterpriseEdition DatabaseEditionType = "EnterpriseEdition" + DatabaseEditionTypeStandardEdition DatabaseEditionType = "StandardEdition" +) + +func PossibleValuesForDatabaseEditionType() []string { + return []string{ + string(DatabaseEditionTypeEnterpriseEdition), + string(DatabaseEditionTypeStandardEdition), + } +} + +func (s *DatabaseEditionType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDatabaseEditionType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDatabaseEditionType(input string) (*DatabaseEditionType, error) { + vals := map[string]DatabaseEditionType{ + "enterpriseedition": DatabaseEditionTypeEnterpriseEdition, + "standardedition": DatabaseEditionTypeStandardEdition, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DatabaseEditionType(input) + return &out, nil +} + +type DayOfWeekName string + +const ( + DayOfWeekNameFriday DayOfWeekName = "Friday" + DayOfWeekNameMonday DayOfWeekName = "Monday" + DayOfWeekNameSaturday DayOfWeekName = "Saturday" + DayOfWeekNameSunday DayOfWeekName = "Sunday" + DayOfWeekNameThursday DayOfWeekName = "Thursday" + DayOfWeekNameTuesday DayOfWeekName = "Tuesday" + DayOfWeekNameWednesday DayOfWeekName = "Wednesday" +) + +func PossibleValuesForDayOfWeekName() []string { + return []string{ + string(DayOfWeekNameFriday), + string(DayOfWeekNameMonday), + string(DayOfWeekNameSaturday), + string(DayOfWeekNameSunday), + string(DayOfWeekNameThursday), + string(DayOfWeekNameTuesday), + string(DayOfWeekNameWednesday), + } +} + +func (s *DayOfWeekName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDayOfWeekName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDayOfWeekName(input string) (*DayOfWeekName, error) { + vals := map[string]DayOfWeekName{ + "friday": DayOfWeekNameFriday, + "monday": DayOfWeekNameMonday, + "saturday": DayOfWeekNameSaturday, + "sunday": DayOfWeekNameSunday, + "thursday": DayOfWeekNameThursday, + "tuesday": DayOfWeekNameTuesday, + "wednesday": DayOfWeekNameWednesday, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DayOfWeekName(input) + return &out, nil +} + +type DisasterRecoveryType string + +const ( + DisasterRecoveryTypeAdg DisasterRecoveryType = "Adg" + DisasterRecoveryTypeBackupBased DisasterRecoveryType = "BackupBased" +) + +func PossibleValuesForDisasterRecoveryType() []string { + return []string{ + string(DisasterRecoveryTypeAdg), + string(DisasterRecoveryTypeBackupBased), + } +} + +func (s *DisasterRecoveryType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDisasterRecoveryType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDisasterRecoveryType(input string) (*DisasterRecoveryType, error) { + vals := map[string]DisasterRecoveryType{ + "adg": DisasterRecoveryTypeAdg, + "backupbased": DisasterRecoveryTypeBackupBased, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DisasterRecoveryType(input) + return &out, nil +} + +type GenerateType string + +const ( + GenerateTypeAll GenerateType = "All" + GenerateTypeSingle GenerateType = "Single" +) + +func PossibleValuesForGenerateType() []string { + return []string{ + string(GenerateTypeAll), + string(GenerateTypeSingle), + } +} + +func (s *GenerateType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGenerateType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseGenerateType(input string) (*GenerateType, error) { + vals := map[string]GenerateType{ + "all": GenerateTypeAll, + "single": GenerateTypeSingle, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GenerateType(input) + return &out, nil +} + +type HostFormatType string + +const ( + HostFormatTypeFqdn HostFormatType = "Fqdn" + HostFormatTypeIP HostFormatType = "Ip" +) + +func PossibleValuesForHostFormatType() []string { + return []string{ + string(HostFormatTypeFqdn), + string(HostFormatTypeIP), + } +} + +func (s *HostFormatType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHostFormatType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHostFormatType(input string) (*HostFormatType, error) { + vals := map[string]HostFormatType{ + "fqdn": HostFormatTypeFqdn, + "ip": HostFormatTypeIP, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HostFormatType(input) + return &out, nil +} + +type LicenseModel string + +const ( + LicenseModelBringYourOwnLicense LicenseModel = "BringYourOwnLicense" + LicenseModelLicenseIncluded LicenseModel = "LicenseIncluded" +) + +func PossibleValuesForLicenseModel() []string { + return []string{ + string(LicenseModelBringYourOwnLicense), + string(LicenseModelLicenseIncluded), + } +} + +func (s *LicenseModel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLicenseModel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLicenseModel(input string) (*LicenseModel, error) { + vals := map[string]LicenseModel{ + "bringyourownlicense": LicenseModelBringYourOwnLicense, + "licenseincluded": LicenseModelLicenseIncluded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LicenseModel(input) + return &out, nil +} + +type OpenModeType string + +const ( + OpenModeTypeReadOnly OpenModeType = "ReadOnly" + OpenModeTypeReadWrite OpenModeType = "ReadWrite" +) + +func PossibleValuesForOpenModeType() []string { + return []string{ + string(OpenModeTypeReadOnly), + string(OpenModeTypeReadWrite), + } +} + +func (s *OpenModeType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOpenModeType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOpenModeType(input string) (*OpenModeType, error) { + vals := map[string]OpenModeType{ + "readonly": OpenModeTypeReadOnly, + "readwrite": OpenModeTypeReadWrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OpenModeType(input) + return &out, nil +} + +type OperationsInsightsStatusType string + +const ( + OperationsInsightsStatusTypeDisabling OperationsInsightsStatusType = "Disabling" + OperationsInsightsStatusTypeEnabled OperationsInsightsStatusType = "Enabled" + OperationsInsightsStatusTypeEnabling OperationsInsightsStatusType = "Enabling" + OperationsInsightsStatusTypeFailedDisabling OperationsInsightsStatusType = "FailedDisabling" + OperationsInsightsStatusTypeFailedEnabling OperationsInsightsStatusType = "FailedEnabling" + OperationsInsightsStatusTypeNotEnabled OperationsInsightsStatusType = "NotEnabled" +) + +func PossibleValuesForOperationsInsightsStatusType() []string { + return []string{ + string(OperationsInsightsStatusTypeDisabling), + string(OperationsInsightsStatusTypeEnabled), + string(OperationsInsightsStatusTypeEnabling), + string(OperationsInsightsStatusTypeFailedDisabling), + string(OperationsInsightsStatusTypeFailedEnabling), + string(OperationsInsightsStatusTypeNotEnabled), + } +} + +func (s *OperationsInsightsStatusType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperationsInsightsStatusType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOperationsInsightsStatusType(input string) (*OperationsInsightsStatusType, error) { + vals := map[string]OperationsInsightsStatusType{ + "disabling": OperationsInsightsStatusTypeDisabling, + "enabled": OperationsInsightsStatusTypeEnabled, + "enabling": OperationsInsightsStatusTypeEnabling, + "faileddisabling": OperationsInsightsStatusTypeFailedDisabling, + "failedenabling": OperationsInsightsStatusTypeFailedEnabling, + "notenabled": OperationsInsightsStatusTypeNotEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperationsInsightsStatusType(input) + return &out, nil +} + +type PermissionLevelType string + +const ( + PermissionLevelTypeRestricted PermissionLevelType = "Restricted" + PermissionLevelTypeUnrestricted PermissionLevelType = "Unrestricted" +) + +func PossibleValuesForPermissionLevelType() []string { + return []string{ + string(PermissionLevelTypeRestricted), + string(PermissionLevelTypeUnrestricted), + } +} + +func (s *PermissionLevelType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePermissionLevelType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePermissionLevelType(input string) (*PermissionLevelType, error) { + vals := map[string]PermissionLevelType{ + "restricted": PermissionLevelTypeRestricted, + "unrestricted": PermissionLevelTypeUnrestricted, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PermissionLevelType(input) + return &out, nil +} + +type ProtocolType string + +const ( + ProtocolTypeTCP ProtocolType = "TCP" + ProtocolTypeTCPS ProtocolType = "TCPS" +) + +func PossibleValuesForProtocolType() []string { + return []string{ + string(ProtocolTypeTCP), + string(ProtocolTypeTCPS), + } +} + +func (s *ProtocolType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocolType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProtocolType(input string) (*ProtocolType, error) { + vals := map[string]ProtocolType{ + "tcp": ProtocolTypeTCP, + "tcps": ProtocolTypeTCPS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProtocolType(input) + return &out, nil +} + +type RefreshableModelType string + +const ( + RefreshableModelTypeAutomatic RefreshableModelType = "Automatic" + RefreshableModelTypeManual RefreshableModelType = "Manual" +) + +func PossibleValuesForRefreshableModelType() []string { + return []string{ + string(RefreshableModelTypeAutomatic), + string(RefreshableModelTypeManual), + } +} + +func (s *RefreshableModelType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRefreshableModelType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRefreshableModelType(input string) (*RefreshableModelType, error) { + vals := map[string]RefreshableModelType{ + "automatic": RefreshableModelTypeAutomatic, + "manual": RefreshableModelTypeManual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RefreshableModelType(input) + return &out, nil +} + +type RefreshableStatusType string + +const ( + RefreshableStatusTypeNotRefreshing RefreshableStatusType = "NotRefreshing" + RefreshableStatusTypeRefreshing RefreshableStatusType = "Refreshing" +) + +func PossibleValuesForRefreshableStatusType() []string { + return []string{ + string(RefreshableStatusTypeNotRefreshing), + string(RefreshableStatusTypeRefreshing), + } +} + +func (s *RefreshableStatusType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRefreshableStatusType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRefreshableStatusType(input string) (*RefreshableStatusType, error) { + vals := map[string]RefreshableStatusType{ + "notrefreshing": RefreshableStatusTypeNotRefreshing, + "refreshing": RefreshableStatusTypeRefreshing, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RefreshableStatusType(input) + return &out, nil +} + +type RepeatCadenceType string + +const ( + RepeatCadenceTypeMonthly RepeatCadenceType = "Monthly" + RepeatCadenceTypeOneTime RepeatCadenceType = "OneTime" + RepeatCadenceTypeWeekly RepeatCadenceType = "Weekly" + RepeatCadenceTypeYearly RepeatCadenceType = "Yearly" +) + +func PossibleValuesForRepeatCadenceType() []string { + return []string{ + string(RepeatCadenceTypeMonthly), + string(RepeatCadenceTypeOneTime), + string(RepeatCadenceTypeWeekly), + string(RepeatCadenceTypeYearly), + } +} + +func (s *RepeatCadenceType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRepeatCadenceType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRepeatCadenceType(input string) (*RepeatCadenceType, error) { + vals := map[string]RepeatCadenceType{ + "monthly": RepeatCadenceTypeMonthly, + "onetime": RepeatCadenceTypeOneTime, + "weekly": RepeatCadenceTypeWeekly, + "yearly": RepeatCadenceTypeYearly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RepeatCadenceType(input) + return &out, nil +} + +type RoleType string + +const ( + RoleTypeBackupCopy RoleType = "BackupCopy" + RoleTypeDisabledStandby RoleType = "DisabledStandby" + RoleTypePrimary RoleType = "Primary" + RoleTypeSnapshotStandby RoleType = "SnapshotStandby" + RoleTypeStandby RoleType = "Standby" +) + +func PossibleValuesForRoleType() []string { + return []string{ + string(RoleTypeBackupCopy), + string(RoleTypeDisabledStandby), + string(RoleTypePrimary), + string(RoleTypeSnapshotStandby), + string(RoleTypeStandby), + } +} + +func (s *RoleType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRoleType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRoleType(input string) (*RoleType, error) { + vals := map[string]RoleType{ + "backupcopy": RoleTypeBackupCopy, + "disabledstandby": RoleTypeDisabledStandby, + "primary": RoleTypePrimary, + "snapshotstandby": RoleTypeSnapshotStandby, + "standby": RoleTypeStandby, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RoleType(input) + return &out, nil +} + +type SessionModeType string + +const ( + SessionModeTypeDirect SessionModeType = "Direct" + SessionModeTypeRedirect SessionModeType = "Redirect" +) + +func PossibleValuesForSessionModeType() []string { + return []string{ + string(SessionModeTypeDirect), + string(SessionModeTypeRedirect), + } +} + +func (s *SessionModeType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSessionModeType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSessionModeType(input string) (*SessionModeType, error) { + vals := map[string]SessionModeType{ + "direct": SessionModeTypeDirect, + "redirect": SessionModeTypeRedirect, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SessionModeType(input) + return &out, nil +} + +type Source string + +const ( + SourceBackupFromTimestamp Source = "BackupFromTimestamp" + SourceCrossRegionDisasterRecovery Source = "CrossRegionDisasterRecovery" +) + +func PossibleValuesForSource() []string { + return []string{ + string(SourceBackupFromTimestamp), + string(SourceCrossRegionDisasterRecovery), + } +} + +func (s *Source) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSource(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSource(input string) (*Source, error) { + vals := map[string]Source{ + "backupfromtimestamp": SourceBackupFromTimestamp, + "crossregiondisasterrecovery": SourceCrossRegionDisasterRecovery, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Source(input) + return &out, nil +} + +type SourceType string + +const ( + SourceTypeBackupFromId SourceType = "BackupFromId" + SourceTypeBackupFromTimestamp SourceType = "BackupFromTimestamp" + SourceTypeCloneToRefreshable SourceType = "CloneToRefreshable" + SourceTypeCrossRegionDataguard SourceType = "CrossRegionDataguard" + SourceTypeCrossRegionDisasterRecovery SourceType = "CrossRegionDisasterRecovery" + SourceTypeDatabase SourceType = "Database" + SourceTypeNone SourceType = "None" +) + +func PossibleValuesForSourceType() []string { + return []string{ + string(SourceTypeBackupFromId), + string(SourceTypeBackupFromTimestamp), + string(SourceTypeCloneToRefreshable), + string(SourceTypeCrossRegionDataguard), + string(SourceTypeCrossRegionDisasterRecovery), + string(SourceTypeDatabase), + string(SourceTypeNone), + } +} + +func (s *SourceType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSourceType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSourceType(input string) (*SourceType, error) { + vals := map[string]SourceType{ + "backupfromid": SourceTypeBackupFromId, + "backupfromtimestamp": SourceTypeBackupFromTimestamp, + "clonetorefreshable": SourceTypeCloneToRefreshable, + "crossregiondataguard": SourceTypeCrossRegionDataguard, + "crossregiondisasterrecovery": SourceTypeCrossRegionDisasterRecovery, + "database": SourceTypeDatabase, + "none": SourceTypeNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SourceType(input) + return &out, nil +} + +type SyntaxFormatType string + +const ( + SyntaxFormatTypeEzconnect SyntaxFormatType = "Ezconnect" + SyntaxFormatTypeEzconnectplus SyntaxFormatType = "Ezconnectplus" + SyntaxFormatTypeLong SyntaxFormatType = "Long" +) + +func PossibleValuesForSyntaxFormatType() []string { + return []string{ + string(SyntaxFormatTypeEzconnect), + string(SyntaxFormatTypeEzconnectplus), + string(SyntaxFormatTypeLong), + } +} + +func (s *SyntaxFormatType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSyntaxFormatType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSyntaxFormatType(input string) (*SyntaxFormatType, error) { + vals := map[string]SyntaxFormatType{ + "ezconnect": SyntaxFormatTypeEzconnect, + "ezconnectplus": SyntaxFormatTypeEzconnectplus, + "long": SyntaxFormatTypeLong, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SyntaxFormatType(input) + return &out, nil +} + +type TlsAuthenticationType string + +const ( + TlsAuthenticationTypeMutual TlsAuthenticationType = "Mutual" + TlsAuthenticationTypeServer TlsAuthenticationType = "Server" +) + +func PossibleValuesForTlsAuthenticationType() []string { + return []string{ + string(TlsAuthenticationTypeMutual), + string(TlsAuthenticationTypeServer), + } +} + +func (s *TlsAuthenticationType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseTlsAuthenticationType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseTlsAuthenticationType(input string) (*TlsAuthenticationType, error) { + vals := map[string]TlsAuthenticationType{ + "mutual": TlsAuthenticationTypeMutual, + "server": TlsAuthenticationTypeServer, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TlsAuthenticationType(input) + return &out, nil +} + +type WorkloadType string + +const ( + WorkloadTypeAJD WorkloadType = "AJD" + WorkloadTypeAPEX WorkloadType = "APEX" + WorkloadTypeDW WorkloadType = "DW" + WorkloadTypeOLTP WorkloadType = "OLTP" +) + +func PossibleValuesForWorkloadType() []string { + return []string{ + string(WorkloadTypeAJD), + string(WorkloadTypeAPEX), + string(WorkloadTypeDW), + string(WorkloadTypeOLTP), + } +} + +func (s *WorkloadType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWorkloadType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWorkloadType(input string) (*WorkloadType, error) { + vals := map[string]WorkloadType{ + "ajd": WorkloadTypeAJD, + "apex": WorkloadTypeAPEX, + "dw": WorkloadTypeDW, + "oltp": WorkloadTypeOLTP, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WorkloadType(input) + return &out, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/id_autonomousdatabase.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/id_autonomousdatabase.go new file mode 100644 index 00000000000..6067f3c0cca --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/id_autonomousdatabase.go @@ -0,0 +1,130 @@ +package autonomousdatabases + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&AutonomousDatabaseId{}) +} + +var _ resourceids.ResourceId = &AutonomousDatabaseId{} + +// AutonomousDatabaseId is a struct representing the Resource ID for a Autonomous Database +type AutonomousDatabaseId struct { + SubscriptionId string + ResourceGroupName string + AutonomousDatabaseName string +} + +// NewAutonomousDatabaseID returns a new AutonomousDatabaseId struct +func NewAutonomousDatabaseID(subscriptionId string, resourceGroupName string, autonomousDatabaseName string) AutonomousDatabaseId { + return AutonomousDatabaseId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AutonomousDatabaseName: autonomousDatabaseName, + } +} + +// ParseAutonomousDatabaseID parses 'input' into a AutonomousDatabaseId +func ParseAutonomousDatabaseID(input string) (*AutonomousDatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(&AutonomousDatabaseId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AutonomousDatabaseId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseAutonomousDatabaseIDInsensitively parses 'input' case-insensitively into a AutonomousDatabaseId +// note: this method should only be used for API response data and not user input +func ParseAutonomousDatabaseIDInsensitively(input string) (*AutonomousDatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(&AutonomousDatabaseId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AutonomousDatabaseId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AutonomousDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.AutonomousDatabaseName, ok = input.Parsed["autonomousDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "autonomousDatabaseName", input) + } + + return nil +} + +// ValidateAutonomousDatabaseID checks that 'input' can be parsed as a Autonomous Database ID +func ValidateAutonomousDatabaseID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAutonomousDatabaseID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Autonomous Database ID +func (id AutonomousDatabaseId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Oracle.Database/autonomousDatabases/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AutonomousDatabaseName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Autonomous Database ID +func (id AutonomousDatabaseId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticAutonomousDatabases", "autonomousDatabases", "autonomousDatabases"), + resourceids.UserSpecifiedSegment("autonomousDatabaseName", "autonomousDatabaseName"), + } +} + +// String returns a human-readable description of this Autonomous Database ID +func (id AutonomousDatabaseId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Autonomous Database Name: %q", id.AutonomousDatabaseName), + } + return fmt.Sprintf("Autonomous Database (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/id_autonomousdatabase_test.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/id_autonomousdatabase_test.go new file mode 100644 index 00000000000..8913a709662 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/id_autonomousdatabase_test.go @@ -0,0 +1,282 @@ +package autonomousdatabases + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &AutonomousDatabaseId{} + +func TestNewAutonomousDatabaseID(t *testing.T) { + id := NewAutonomousDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.AutonomousDatabaseName != "autonomousDatabaseName" { + t.Fatalf("Expected %q but got %q for Segment 'AutonomousDatabaseName'", id.AutonomousDatabaseName, "autonomousDatabaseName") + } +} + +func TestFormatAutonomousDatabaseID(t *testing.T) { + actual := NewAutonomousDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases/autonomousDatabaseName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseAutonomousDatabaseID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AutonomousDatabaseId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases/autonomousDatabaseName", + Expected: &AutonomousDatabaseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + AutonomousDatabaseName: "autonomousDatabaseName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases/autonomousDatabaseName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAutonomousDatabaseID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.AutonomousDatabaseName != v.Expected.AutonomousDatabaseName { + t.Fatalf("Expected %q but got %q for AutonomousDatabaseName", v.Expected.AutonomousDatabaseName, actual.AutonomousDatabaseName) + } + + } +} + +func TestParseAutonomousDatabaseIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AutonomousDatabaseId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/aUtOnOmOuSdAtAbAsEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases/autonomousDatabaseName", + Expected: &AutonomousDatabaseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + AutonomousDatabaseName: "autonomousDatabaseName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/autonomousDatabases/autonomousDatabaseName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/aUtOnOmOuSdAtAbAsEs/aUtOnOmOuSdAtAbAsEnAmE", + Expected: &AutonomousDatabaseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + AutonomousDatabaseName: "aUtOnOmOuSdAtAbAsEnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/aUtOnOmOuSdAtAbAsEs/aUtOnOmOuSdAtAbAsEnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAutonomousDatabaseIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.AutonomousDatabaseName != v.Expected.AutonomousDatabaseName { + t.Fatalf("Expected %q but got %q for AutonomousDatabaseName", v.Expected.AutonomousDatabaseName, actual.AutonomousDatabaseName) + } + + } +} + +func TestSegmentsForAutonomousDatabaseId(t *testing.T) { + segments := AutonomousDatabaseId{}.Segments() + if len(segments) == 0 { + t.Fatalf("AutonomousDatabaseId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_action.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_action.go new file mode 100644 index 00000000000..f79e5347dd4 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_action.go @@ -0,0 +1,75 @@ +package autonomousdatabases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ActionOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AutonomousDatabase +} + +// Action ... +func (c AutonomousDatabasesClient) Action(ctx context.Context, id AutonomousDatabaseId, input AutonomousDatabaseLifecycleAction) (result ActionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/action", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ActionThenPoll performs Action then polls until it's completed +func (c AutonomousDatabasesClient) ActionThenPoll(ctx context.Context, id AutonomousDatabaseId, input AutonomousDatabaseLifecycleAction) error { + result, err := c.Action(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Action: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Action: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_changedisasterrecoveryconfiguration.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_changedisasterrecoveryconfiguration.go new file mode 100644 index 00000000000..072a466a424 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_changedisasterrecoveryconfiguration.go @@ -0,0 +1,75 @@ +package autonomousdatabases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ChangeDisasterRecoveryConfigurationOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AutonomousDatabase +} + +// ChangeDisasterRecoveryConfiguration ... +func (c AutonomousDatabasesClient) ChangeDisasterRecoveryConfiguration(ctx context.Context, id AutonomousDatabaseId, input DisasterRecoveryConfigurationDetails) (result ChangeDisasterRecoveryConfigurationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/changeDisasterRecoveryConfiguration", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ChangeDisasterRecoveryConfigurationThenPoll performs ChangeDisasterRecoveryConfiguration then polls until it's completed +func (c AutonomousDatabasesClient) ChangeDisasterRecoveryConfigurationThenPoll(ctx context.Context, id AutonomousDatabaseId, input DisasterRecoveryConfigurationDetails) error { + result, err := c.ChangeDisasterRecoveryConfiguration(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ChangeDisasterRecoveryConfiguration: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ChangeDisasterRecoveryConfiguration: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_createorupdate.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_createorupdate.go new file mode 100644 index 00000000000..7ed7016c55f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_createorupdate.go @@ -0,0 +1,75 @@ +package autonomousdatabases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AutonomousDatabase +} + +// CreateOrUpdate ... +func (c AutonomousDatabasesClient) CreateOrUpdate(ctx context.Context, id AutonomousDatabaseId, input AutonomousDatabase) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c AutonomousDatabasesClient) CreateOrUpdateThenPoll(ctx context.Context, id AutonomousDatabaseId, input AutonomousDatabase) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_delete.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_delete.go new file mode 100644 index 00000000000..b2629b1ffd3 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_delete.go @@ -0,0 +1,70 @@ +package autonomousdatabases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c AutonomousDatabasesClient) Delete(ctx context.Context, id AutonomousDatabaseId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c AutonomousDatabasesClient) DeleteThenPoll(ctx context.Context, id AutonomousDatabaseId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_failover.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_failover.go new file mode 100644 index 00000000000..ddad3887688 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_failover.go @@ -0,0 +1,75 @@ +package autonomousdatabases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FailoverOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AutonomousDatabase +} + +// Failover ... +func (c AutonomousDatabasesClient) Failover(ctx context.Context, id AutonomousDatabaseId, input PeerDbDetails) (result FailoverOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/failover", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// FailoverThenPoll performs Failover then polls until it's completed +func (c AutonomousDatabasesClient) FailoverThenPoll(ctx context.Context, id AutonomousDatabaseId, input PeerDbDetails) error { + result, err := c.Failover(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Failover: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Failover: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_generatewallet.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_generatewallet.go new file mode 100644 index 00000000000..0c49da12ec8 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_generatewallet.go @@ -0,0 +1,58 @@ +package autonomousdatabases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GenerateWalletOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AutonomousDatabaseWalletFile +} + +// GenerateWallet ... +func (c AutonomousDatabasesClient) GenerateWallet(ctx context.Context, id AutonomousDatabaseId, input GenerateAutonomousDatabaseWalletDetails) (result GenerateWalletOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/generateWallet", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model AutonomousDatabaseWalletFile + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_get.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_get.go new file mode 100644 index 00000000000..048934eeb4e --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_get.go @@ -0,0 +1,53 @@ +package autonomousdatabases + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AutonomousDatabase +} + +// Get ... +func (c AutonomousDatabasesClient) Get(ctx context.Context, id AutonomousDatabaseId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model AutonomousDatabase + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_listbyresourcegroup.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_listbyresourcegroup.go new file mode 100644 index 00000000000..fb66603459b --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package autonomousdatabases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AutonomousDatabase +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []AutonomousDatabase +} + +type ListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByResourceGroup ... +func (c AutonomousDatabasesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Oracle.Database/autonomousDatabases", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]AutonomousDatabase `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c AutonomousDatabasesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, AutonomousDatabaseOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AutonomousDatabasesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate AutonomousDatabaseOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]AutonomousDatabase, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_listbysubscription.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_listbysubscription.go new file mode 100644 index 00000000000..1cfc10b0488 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_listbysubscription.go @@ -0,0 +1,106 @@ +package autonomousdatabases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AutonomousDatabase +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []AutonomousDatabase +} + +type ListBySubscriptionCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListBySubscriptionCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListBySubscription ... +func (c AutonomousDatabasesClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Oracle.Database/autonomousDatabases", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]AutonomousDatabase `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c AutonomousDatabasesClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, AutonomousDatabaseOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AutonomousDatabasesClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate AutonomousDatabaseOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]AutonomousDatabase, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_restore.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_restore.go new file mode 100644 index 00000000000..c6e860c8c2d --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_restore.go @@ -0,0 +1,75 @@ +package autonomousdatabases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestoreOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AutonomousDatabase +} + +// Restore ... +func (c AutonomousDatabasesClient) Restore(ctx context.Context, id AutonomousDatabaseId, input RestoreAutonomousDatabaseDetails) (result RestoreOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/restore", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// RestoreThenPoll performs Restore then polls until it's completed +func (c AutonomousDatabasesClient) RestoreThenPoll(ctx context.Context, id AutonomousDatabaseId, input RestoreAutonomousDatabaseDetails) error { + result, err := c.Restore(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Restore: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Restore: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_shrink.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_shrink.go new file mode 100644 index 00000000000..baed1bbf367 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_shrink.go @@ -0,0 +1,71 @@ +package autonomousdatabases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ShrinkOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AutonomousDatabase +} + +// Shrink ... +func (c AutonomousDatabasesClient) Shrink(ctx context.Context, id AutonomousDatabaseId) (result ShrinkOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/shrink", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ShrinkThenPoll performs Shrink then polls until it's completed +func (c AutonomousDatabasesClient) ShrinkThenPoll(ctx context.Context, id AutonomousDatabaseId) error { + result, err := c.Shrink(ctx, id) + if err != nil { + return fmt.Errorf("performing Shrink: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Shrink: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_switchover.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_switchover.go new file mode 100644 index 00000000000..8b21a43f851 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_switchover.go @@ -0,0 +1,75 @@ +package autonomousdatabases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SwitchoverOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AutonomousDatabase +} + +// Switchover ... +func (c AutonomousDatabasesClient) Switchover(ctx context.Context, id AutonomousDatabaseId, input PeerDbDetails) (result SwitchoverOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/switchover", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// SwitchoverThenPoll performs Switchover then polls until it's completed +func (c AutonomousDatabasesClient) SwitchoverThenPoll(ctx context.Context, id AutonomousDatabaseId, input PeerDbDetails) error { + result, err := c.Switchover(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Switchover: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Switchover: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_update.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_update.go new file mode 100644 index 00000000000..dea97562d89 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/method_update.go @@ -0,0 +1,75 @@ +package autonomousdatabases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AutonomousDatabase +} + +// Update ... +func (c AutonomousDatabasesClient) Update(ctx context.Context, id AutonomousDatabaseId, input AutonomousDatabaseUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c AutonomousDatabasesClient) UpdateThenPoll(ctx context.Context, id AutonomousDatabaseId, input AutonomousDatabaseUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_allconnectionstringtype.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_allconnectionstringtype.go new file mode 100644 index 00000000000..a0c89f0608f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_allconnectionstringtype.go @@ -0,0 +1,10 @@ +package autonomousdatabases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AllConnectionStringType struct { + High *string `json:"high,omitempty"` + Low *string `json:"low,omitempty"` + Medium *string `json:"medium,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_apexdetailstype.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_apexdetailstype.go new file mode 100644 index 00000000000..420d585f5d1 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_apexdetailstype.go @@ -0,0 +1,9 @@ +package autonomousdatabases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApexDetailsType struct { + ApexVersion *string `json:"apexVersion,omitempty"` + OrdsVersion *string `json:"ordsVersion,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabase.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabase.go new file mode 100644 index 00000000000..28287d73f00 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabase.go @@ -0,0 +1,59 @@ +package autonomousdatabases + +import ( + "encoding/json" + "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabase struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties AutonomousDatabaseBaseProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Unmarshaler = &AutonomousDatabase{} + +func (s *AutonomousDatabase) UnmarshalJSON(bytes []byte) error { + var decoded struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + } + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + + s.Id = decoded.Id + s.Location = decoded.Location + s.Name = decoded.Name + s.SystemData = decoded.SystemData + s.Tags = decoded.Tags + s.Type = decoded.Type + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling AutonomousDatabase into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["properties"]; ok { + impl, err := UnmarshalAutonomousDatabaseBasePropertiesImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Properties' for 'AutonomousDatabase': %+v", err) + } + s.Properties = impl + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasebaseproperties.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasebaseproperties.go new file mode 100644 index 00000000000..8dcfd6ed806 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasebaseproperties.go @@ -0,0 +1,175 @@ +package autonomousdatabases + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabaseBaseProperties interface { + AutonomousDatabaseBaseProperties() BaseAutonomousDatabaseBasePropertiesImpl +} + +var _ AutonomousDatabaseBaseProperties = BaseAutonomousDatabaseBasePropertiesImpl{} + +type BaseAutonomousDatabaseBasePropertiesImpl struct { + ActualUsedDataStorageSizeInTbs *float64 `json:"actualUsedDataStorageSizeInTbs,omitempty"` + AdminPassword *string `json:"adminPassword,omitempty"` + AllocatedStorageSizeInTbs *float64 `json:"allocatedStorageSizeInTbs,omitempty"` + ApexDetails *ApexDetailsType `json:"apexDetails,omitempty"` + AutonomousDatabaseId *string `json:"autonomousDatabaseId,omitempty"` + AutonomousMaintenanceScheduleType *AutonomousMaintenanceScheduleType `json:"autonomousMaintenanceScheduleType,omitempty"` + AvailableUpgradeVersions *[]string `json:"availableUpgradeVersions,omitempty"` + BackupRetentionPeriodInDays *int64 `json:"backupRetentionPeriodInDays,omitempty"` + CharacterSet *string `json:"characterSet,omitempty"` + ComputeCount *float64 `json:"computeCount,omitempty"` + ComputeModel *ComputeModel `json:"computeModel,omitempty"` + ConnectionStrings *ConnectionStringType `json:"connectionStrings,omitempty"` + ConnectionURLs *ConnectionURLType `json:"connectionUrls,omitempty"` + CpuCoreCount *int64 `json:"cpuCoreCount,omitempty"` + CustomerContacts *[]CustomerContact `json:"customerContacts,omitempty"` + DataBaseType DataBaseType `json:"dataBaseType"` + DataSafeStatus *DataSafeStatusType `json:"dataSafeStatus,omitempty"` + DataStorageSizeInGbs *int64 `json:"dataStorageSizeInGbs,omitempty"` + DataStorageSizeInTbs *int64 `json:"dataStorageSizeInTbs,omitempty"` + DatabaseEdition *DatabaseEditionType `json:"databaseEdition,omitempty"` + DbVersion *string `json:"dbVersion,omitempty"` + DbWorkload *WorkloadType `json:"dbWorkload,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + FailedDataRecoveryInSeconds *int64 `json:"failedDataRecoveryInSeconds,omitempty"` + InMemoryAreaInGbs *int64 `json:"inMemoryAreaInGbs,omitempty"` + IsAutoScalingEnabled *bool `json:"isAutoScalingEnabled,omitempty"` + IsAutoScalingForStorageEnabled *bool `json:"isAutoScalingForStorageEnabled,omitempty"` + IsLocalDataGuardEnabled *bool `json:"isLocalDataGuardEnabled,omitempty"` + IsMtlsConnectionRequired *bool `json:"isMtlsConnectionRequired,omitempty"` + IsPreview *bool `json:"isPreview,omitempty"` + IsPreviewVersionWithServiceTermsAccepted *bool `json:"isPreviewVersionWithServiceTermsAccepted,omitempty"` + IsRemoteDataGuardEnabled *bool `json:"isRemoteDataGuardEnabled,omitempty"` + LicenseModel *LicenseModel `json:"licenseModel,omitempty"` + LifecycleDetails *string `json:"lifecycleDetails,omitempty"` + LifecycleState *AutonomousDatabaseLifecycleState `json:"lifecycleState,omitempty"` + LocalAdgAutoFailoverMaxDataLossLimit *int64 `json:"localAdgAutoFailoverMaxDataLossLimit,omitempty"` + LocalDisasterRecoveryType *DisasterRecoveryType `json:"localDisasterRecoveryType,omitempty"` + LocalStandbyDb *AutonomousDatabaseStandbySummary `json:"localStandbyDb,omitempty"` + LongTermBackupSchedule *LongTermBackUpScheduleDetails `json:"longTermBackupSchedule,omitempty"` + MemoryPerOracleComputeUnitInGbs *int64 `json:"memoryPerOracleComputeUnitInGbs,omitempty"` + NcharacterSet *string `json:"ncharacterSet,omitempty"` + NextLongTermBackupTimeStamp *string `json:"nextLongTermBackupTimeStamp,omitempty"` + OciURL *string `json:"ociUrl,omitempty"` + Ocid *string `json:"ocid,omitempty"` + OpenMode *OpenModeType `json:"openMode,omitempty"` + OperationsInsightsStatus *OperationsInsightsStatusType `json:"operationsInsightsStatus,omitempty"` + PeerDbId *string `json:"peerDbId,omitempty"` + PeerDbIds *[]string `json:"peerDbIds,omitempty"` + PermissionLevel *PermissionLevelType `json:"permissionLevel,omitempty"` + PrivateEndpoint *string `json:"privateEndpoint,omitempty"` + PrivateEndpointIP *string `json:"privateEndpointIp,omitempty"` + PrivateEndpointLabel *string `json:"privateEndpointLabel,omitempty"` + ProvisionableCPUs *[]int64 `json:"provisionableCpus,omitempty"` + ProvisioningState *AzureResourceProvisioningState `json:"provisioningState,omitempty"` + RemoteDisasterRecoveryConfiguration *DisasterRecoveryConfigurationDetails `json:"remoteDisasterRecoveryConfiguration,omitempty"` + Role *RoleType `json:"role,omitempty"` + ScheduledOperationsList *[]ScheduledOperationsType `json:"scheduledOperationsList,omitempty"` + ServiceConsoleURL *string `json:"serviceConsoleUrl,omitempty"` + SqlWebDeveloperURL *string `json:"sqlWebDeveloperUrl,omitempty"` + SubnetId *string `json:"subnetId,omitempty"` + SupportedRegionsToCloneTo *[]string `json:"supportedRegionsToCloneTo,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + TimeDataGuardRoleChanged *string `json:"timeDataGuardRoleChanged,omitempty"` + TimeDeletionOfFreeAutonomousDatabase *string `json:"timeDeletionOfFreeAutonomousDatabase,omitempty"` + TimeDisasterRecoveryRoleChanged *string `json:"timeDisasterRecoveryRoleChanged,omitempty"` + TimeLocalDataGuardEnabled *string `json:"timeLocalDataGuardEnabled,omitempty"` + TimeMaintenanceBegin *string `json:"timeMaintenanceBegin,omitempty"` + TimeMaintenanceEnd *string `json:"timeMaintenanceEnd,omitempty"` + TimeOfLastFailover *string `json:"timeOfLastFailover,omitempty"` + TimeOfLastRefresh *string `json:"timeOfLastRefresh,omitempty"` + TimeOfLastRefreshPoint *string `json:"timeOfLastRefreshPoint,omitempty"` + TimeOfLastSwitchover *string `json:"timeOfLastSwitchover,omitempty"` + TimeReclamationOfFreeAutonomousDatabase *string `json:"timeReclamationOfFreeAutonomousDatabase,omitempty"` + UsedDataStorageSizeInGbs *int64 `json:"usedDataStorageSizeInGbs,omitempty"` + UsedDataStorageSizeInTbs *int64 `json:"usedDataStorageSizeInTbs,omitempty"` + VnetId *string `json:"vnetId,omitempty"` + WhitelistedIPs *[]string `json:"whitelistedIps,omitempty"` +} + +func (s BaseAutonomousDatabaseBasePropertiesImpl) AutonomousDatabaseBaseProperties() BaseAutonomousDatabaseBasePropertiesImpl { + return s +} + +var _ AutonomousDatabaseBaseProperties = RawAutonomousDatabaseBasePropertiesImpl{} + +// RawAutonomousDatabaseBasePropertiesImpl is returned when the Discriminated Value doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawAutonomousDatabaseBasePropertiesImpl struct { + autonomousDatabaseBaseProperties BaseAutonomousDatabaseBasePropertiesImpl + Type string + Values map[string]interface{} +} + +func (s RawAutonomousDatabaseBasePropertiesImpl) AutonomousDatabaseBaseProperties() BaseAutonomousDatabaseBasePropertiesImpl { + return s.autonomousDatabaseBaseProperties +} + +func UnmarshalAutonomousDatabaseBasePropertiesImplementation(input []byte) (AutonomousDatabaseBaseProperties, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling AutonomousDatabaseBaseProperties into map[string]interface: %+v", err) + } + + var value string + if v, ok := temp["dataBaseType"]; ok { + value = fmt.Sprintf("%v", v) + } + + if strings.EqualFold(value, "Clone") { + var out AutonomousDatabaseCloneProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AutonomousDatabaseCloneProperties: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "CrossRegionDisasterRecovery") { + var out AutonomousDatabaseCrossRegionDisasterRecoveryProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AutonomousDatabaseCrossRegionDisasterRecoveryProperties: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "CloneFromBackupTimestamp") { + var out AutonomousDatabaseFromBackupTimestampProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AutonomousDatabaseFromBackupTimestampProperties: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "Regular") { + var out AutonomousDatabaseProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AutonomousDatabaseProperties: %+v", err) + } + return out, nil + } + + var parent BaseAutonomousDatabaseBasePropertiesImpl + if err := json.Unmarshal(input, &parent); err != nil { + return nil, fmt.Errorf("unmarshaling into BaseAutonomousDatabaseBasePropertiesImpl: %+v", err) + } + + return RawAutonomousDatabaseBasePropertiesImpl{ + autonomousDatabaseBaseProperties: parent, + Type: value, + Values: temp, + }, nil + +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasecloneproperties.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasecloneproperties.go new file mode 100644 index 00000000000..515f3bcaa42 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasecloneproperties.go @@ -0,0 +1,272 @@ +package autonomousdatabases + +import ( + "encoding/json" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AutonomousDatabaseBaseProperties = AutonomousDatabaseCloneProperties{} + +type AutonomousDatabaseCloneProperties struct { + CloneType CloneType `json:"cloneType"` + IsReconnectCloneEnabled *bool `json:"isReconnectCloneEnabled,omitempty"` + IsRefreshableClone *bool `json:"isRefreshableClone,omitempty"` + RefreshableModel *RefreshableModelType `json:"refreshableModel,omitempty"` + RefreshableStatus *RefreshableStatusType `json:"refreshableStatus,omitempty"` + Source *SourceType `json:"source,omitempty"` + SourceId string `json:"sourceId"` + TimeUntilReconnectCloneEnabled *string `json:"timeUntilReconnectCloneEnabled,omitempty"` + + // Fields inherited from AutonomousDatabaseBaseProperties + + ActualUsedDataStorageSizeInTbs *float64 `json:"actualUsedDataStorageSizeInTbs,omitempty"` + AdminPassword *string `json:"adminPassword,omitempty"` + AllocatedStorageSizeInTbs *float64 `json:"allocatedStorageSizeInTbs,omitempty"` + ApexDetails *ApexDetailsType `json:"apexDetails,omitempty"` + AutonomousDatabaseId *string `json:"autonomousDatabaseId,omitempty"` + AutonomousMaintenanceScheduleType *AutonomousMaintenanceScheduleType `json:"autonomousMaintenanceScheduleType,omitempty"` + AvailableUpgradeVersions *[]string `json:"availableUpgradeVersions,omitempty"` + BackupRetentionPeriodInDays *int64 `json:"backupRetentionPeriodInDays,omitempty"` + CharacterSet *string `json:"characterSet,omitempty"` + ComputeCount *float64 `json:"computeCount,omitempty"` + ComputeModel *ComputeModel `json:"computeModel,omitempty"` + ConnectionStrings *ConnectionStringType `json:"connectionStrings,omitempty"` + ConnectionURLs *ConnectionURLType `json:"connectionUrls,omitempty"` + CpuCoreCount *int64 `json:"cpuCoreCount,omitempty"` + CustomerContacts *[]CustomerContact `json:"customerContacts,omitempty"` + DataBaseType DataBaseType `json:"dataBaseType"` + DataSafeStatus *DataSafeStatusType `json:"dataSafeStatus,omitempty"` + DataStorageSizeInGbs *int64 `json:"dataStorageSizeInGbs,omitempty"` + DataStorageSizeInTbs *int64 `json:"dataStorageSizeInTbs,omitempty"` + DatabaseEdition *DatabaseEditionType `json:"databaseEdition,omitempty"` + DbVersion *string `json:"dbVersion,omitempty"` + DbWorkload *WorkloadType `json:"dbWorkload,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + FailedDataRecoveryInSeconds *int64 `json:"failedDataRecoveryInSeconds,omitempty"` + InMemoryAreaInGbs *int64 `json:"inMemoryAreaInGbs,omitempty"` + IsAutoScalingEnabled *bool `json:"isAutoScalingEnabled,omitempty"` + IsAutoScalingForStorageEnabled *bool `json:"isAutoScalingForStorageEnabled,omitempty"` + IsLocalDataGuardEnabled *bool `json:"isLocalDataGuardEnabled,omitempty"` + IsMtlsConnectionRequired *bool `json:"isMtlsConnectionRequired,omitempty"` + IsPreview *bool `json:"isPreview,omitempty"` + IsPreviewVersionWithServiceTermsAccepted *bool `json:"isPreviewVersionWithServiceTermsAccepted,omitempty"` + IsRemoteDataGuardEnabled *bool `json:"isRemoteDataGuardEnabled,omitempty"` + LicenseModel *LicenseModel `json:"licenseModel,omitempty"` + LifecycleDetails *string `json:"lifecycleDetails,omitempty"` + LifecycleState *AutonomousDatabaseLifecycleState `json:"lifecycleState,omitempty"` + LocalAdgAutoFailoverMaxDataLossLimit *int64 `json:"localAdgAutoFailoverMaxDataLossLimit,omitempty"` + LocalDisasterRecoveryType *DisasterRecoveryType `json:"localDisasterRecoveryType,omitempty"` + LocalStandbyDb *AutonomousDatabaseStandbySummary `json:"localStandbyDb,omitempty"` + LongTermBackupSchedule *LongTermBackUpScheduleDetails `json:"longTermBackupSchedule,omitempty"` + MemoryPerOracleComputeUnitInGbs *int64 `json:"memoryPerOracleComputeUnitInGbs,omitempty"` + NcharacterSet *string `json:"ncharacterSet,omitempty"` + NextLongTermBackupTimeStamp *string `json:"nextLongTermBackupTimeStamp,omitempty"` + OciURL *string `json:"ociUrl,omitempty"` + Ocid *string `json:"ocid,omitempty"` + OpenMode *OpenModeType `json:"openMode,omitempty"` + OperationsInsightsStatus *OperationsInsightsStatusType `json:"operationsInsightsStatus,omitempty"` + PeerDbId *string `json:"peerDbId,omitempty"` + PeerDbIds *[]string `json:"peerDbIds,omitempty"` + PermissionLevel *PermissionLevelType `json:"permissionLevel,omitempty"` + PrivateEndpoint *string `json:"privateEndpoint,omitempty"` + PrivateEndpointIP *string `json:"privateEndpointIp,omitempty"` + PrivateEndpointLabel *string `json:"privateEndpointLabel,omitempty"` + ProvisionableCPUs *[]int64 `json:"provisionableCpus,omitempty"` + ProvisioningState *AzureResourceProvisioningState `json:"provisioningState,omitempty"` + RemoteDisasterRecoveryConfiguration *DisasterRecoveryConfigurationDetails `json:"remoteDisasterRecoveryConfiguration,omitempty"` + Role *RoleType `json:"role,omitempty"` + ScheduledOperationsList *[]ScheduledOperationsType `json:"scheduledOperationsList,omitempty"` + ServiceConsoleURL *string `json:"serviceConsoleUrl,omitempty"` + SqlWebDeveloperURL *string `json:"sqlWebDeveloperUrl,omitempty"` + SubnetId *string `json:"subnetId,omitempty"` + SupportedRegionsToCloneTo *[]string `json:"supportedRegionsToCloneTo,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + TimeDataGuardRoleChanged *string `json:"timeDataGuardRoleChanged,omitempty"` + TimeDeletionOfFreeAutonomousDatabase *string `json:"timeDeletionOfFreeAutonomousDatabase,omitempty"` + TimeDisasterRecoveryRoleChanged *string `json:"timeDisasterRecoveryRoleChanged,omitempty"` + TimeLocalDataGuardEnabled *string `json:"timeLocalDataGuardEnabled,omitempty"` + TimeMaintenanceBegin *string `json:"timeMaintenanceBegin,omitempty"` + TimeMaintenanceEnd *string `json:"timeMaintenanceEnd,omitempty"` + TimeOfLastFailover *string `json:"timeOfLastFailover,omitempty"` + TimeOfLastRefresh *string `json:"timeOfLastRefresh,omitempty"` + TimeOfLastRefreshPoint *string `json:"timeOfLastRefreshPoint,omitempty"` + TimeOfLastSwitchover *string `json:"timeOfLastSwitchover,omitempty"` + TimeReclamationOfFreeAutonomousDatabase *string `json:"timeReclamationOfFreeAutonomousDatabase,omitempty"` + UsedDataStorageSizeInGbs *int64 `json:"usedDataStorageSizeInGbs,omitempty"` + UsedDataStorageSizeInTbs *int64 `json:"usedDataStorageSizeInTbs,omitempty"` + VnetId *string `json:"vnetId,omitempty"` + WhitelistedIPs *[]string `json:"whitelistedIps,omitempty"` +} + +func (s AutonomousDatabaseCloneProperties) AutonomousDatabaseBaseProperties() BaseAutonomousDatabaseBasePropertiesImpl { + return BaseAutonomousDatabaseBasePropertiesImpl{ + ActualUsedDataStorageSizeInTbs: s.ActualUsedDataStorageSizeInTbs, + AdminPassword: s.AdminPassword, + AllocatedStorageSizeInTbs: s.AllocatedStorageSizeInTbs, + ApexDetails: s.ApexDetails, + AutonomousDatabaseId: s.AutonomousDatabaseId, + AutonomousMaintenanceScheduleType: s.AutonomousMaintenanceScheduleType, + AvailableUpgradeVersions: s.AvailableUpgradeVersions, + BackupRetentionPeriodInDays: s.BackupRetentionPeriodInDays, + CharacterSet: s.CharacterSet, + ComputeCount: s.ComputeCount, + ComputeModel: s.ComputeModel, + ConnectionStrings: s.ConnectionStrings, + ConnectionURLs: s.ConnectionURLs, + CpuCoreCount: s.CpuCoreCount, + CustomerContacts: s.CustomerContacts, + DataBaseType: s.DataBaseType, + DataSafeStatus: s.DataSafeStatus, + DataStorageSizeInGbs: s.DataStorageSizeInGbs, + DataStorageSizeInTbs: s.DataStorageSizeInTbs, + DatabaseEdition: s.DatabaseEdition, + DbVersion: s.DbVersion, + DbWorkload: s.DbWorkload, + DisplayName: s.DisplayName, + FailedDataRecoveryInSeconds: s.FailedDataRecoveryInSeconds, + InMemoryAreaInGbs: s.InMemoryAreaInGbs, + IsAutoScalingEnabled: s.IsAutoScalingEnabled, + IsAutoScalingForStorageEnabled: s.IsAutoScalingForStorageEnabled, + IsLocalDataGuardEnabled: s.IsLocalDataGuardEnabled, + IsMtlsConnectionRequired: s.IsMtlsConnectionRequired, + IsPreview: s.IsPreview, + IsPreviewVersionWithServiceTermsAccepted: s.IsPreviewVersionWithServiceTermsAccepted, + IsRemoteDataGuardEnabled: s.IsRemoteDataGuardEnabled, + LicenseModel: s.LicenseModel, + LifecycleDetails: s.LifecycleDetails, + LifecycleState: s.LifecycleState, + LocalAdgAutoFailoverMaxDataLossLimit: s.LocalAdgAutoFailoverMaxDataLossLimit, + LocalDisasterRecoveryType: s.LocalDisasterRecoveryType, + LocalStandbyDb: s.LocalStandbyDb, + LongTermBackupSchedule: s.LongTermBackupSchedule, + MemoryPerOracleComputeUnitInGbs: s.MemoryPerOracleComputeUnitInGbs, + NcharacterSet: s.NcharacterSet, + NextLongTermBackupTimeStamp: s.NextLongTermBackupTimeStamp, + OciURL: s.OciURL, + Ocid: s.Ocid, + OpenMode: s.OpenMode, + OperationsInsightsStatus: s.OperationsInsightsStatus, + PeerDbId: s.PeerDbId, + PeerDbIds: s.PeerDbIds, + PermissionLevel: s.PermissionLevel, + PrivateEndpoint: s.PrivateEndpoint, + PrivateEndpointIP: s.PrivateEndpointIP, + PrivateEndpointLabel: s.PrivateEndpointLabel, + ProvisionableCPUs: s.ProvisionableCPUs, + ProvisioningState: s.ProvisioningState, + RemoteDisasterRecoveryConfiguration: s.RemoteDisasterRecoveryConfiguration, + Role: s.Role, + ScheduledOperationsList: s.ScheduledOperationsList, + ServiceConsoleURL: s.ServiceConsoleURL, + SqlWebDeveloperURL: s.SqlWebDeveloperURL, + SubnetId: s.SubnetId, + SupportedRegionsToCloneTo: s.SupportedRegionsToCloneTo, + TimeCreated: s.TimeCreated, + TimeDataGuardRoleChanged: s.TimeDataGuardRoleChanged, + TimeDeletionOfFreeAutonomousDatabase: s.TimeDeletionOfFreeAutonomousDatabase, + TimeDisasterRecoveryRoleChanged: s.TimeDisasterRecoveryRoleChanged, + TimeLocalDataGuardEnabled: s.TimeLocalDataGuardEnabled, + TimeMaintenanceBegin: s.TimeMaintenanceBegin, + TimeMaintenanceEnd: s.TimeMaintenanceEnd, + TimeOfLastFailover: s.TimeOfLastFailover, + TimeOfLastRefresh: s.TimeOfLastRefresh, + TimeOfLastRefreshPoint: s.TimeOfLastRefreshPoint, + TimeOfLastSwitchover: s.TimeOfLastSwitchover, + TimeReclamationOfFreeAutonomousDatabase: s.TimeReclamationOfFreeAutonomousDatabase, + UsedDataStorageSizeInGbs: s.UsedDataStorageSizeInGbs, + UsedDataStorageSizeInTbs: s.UsedDataStorageSizeInTbs, + VnetId: s.VnetId, + WhitelistedIPs: s.WhitelistedIPs, + } +} + +func (o *AutonomousDatabaseCloneProperties) GetNextLongTermBackupTimeStampAsTime() (*time.Time, error) { + if o.NextLongTermBackupTimeStamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.NextLongTermBackupTimeStamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutonomousDatabaseCloneProperties) SetNextLongTermBackupTimeStampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.NextLongTermBackupTimeStamp = &formatted +} + +func (o *AutonomousDatabaseCloneProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutonomousDatabaseCloneProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} + +func (o *AutonomousDatabaseCloneProperties) GetTimeDisasterRecoveryRoleChangedAsTime() (*time.Time, error) { + if o.TimeDisasterRecoveryRoleChanged == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeDisasterRecoveryRoleChanged, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutonomousDatabaseCloneProperties) SetTimeDisasterRecoveryRoleChangedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeDisasterRecoveryRoleChanged = &formatted +} + +func (o *AutonomousDatabaseCloneProperties) GetTimeMaintenanceBeginAsTime() (*time.Time, error) { + if o.TimeMaintenanceBegin == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeMaintenanceBegin, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutonomousDatabaseCloneProperties) SetTimeMaintenanceBeginAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeMaintenanceBegin = &formatted +} + +func (o *AutonomousDatabaseCloneProperties) GetTimeMaintenanceEndAsTime() (*time.Time, error) { + if o.TimeMaintenanceEnd == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeMaintenanceEnd, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutonomousDatabaseCloneProperties) SetTimeMaintenanceEndAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeMaintenanceEnd = &formatted +} + +var _ json.Marshaler = AutonomousDatabaseCloneProperties{} + +func (s AutonomousDatabaseCloneProperties) MarshalJSON() ([]byte, error) { + type wrapper AutonomousDatabaseCloneProperties + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AutonomousDatabaseCloneProperties: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AutonomousDatabaseCloneProperties: %+v", err) + } + + decoded["dataBaseType"] = "Clone" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AutonomousDatabaseCloneProperties: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasecrossregiondisasterrecoveryproperties.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasecrossregiondisasterrecoveryproperties.go new file mode 100644 index 00000000000..f02933d5cbb --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasecrossregiondisasterrecoveryproperties.go @@ -0,0 +1,270 @@ +package autonomousdatabases + +import ( + "encoding/json" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AutonomousDatabaseBaseProperties = AutonomousDatabaseCrossRegionDisasterRecoveryProperties{} + +type AutonomousDatabaseCrossRegionDisasterRecoveryProperties struct { + IsReplicateAutomaticBackups *bool `json:"isReplicateAutomaticBackups,omitempty"` + RemoteDisasterRecoveryType DisasterRecoveryType `json:"remoteDisasterRecoveryType"` + Source Source `json:"source"` + SourceId string `json:"sourceId"` + SourceLocation *string `json:"sourceLocation,omitempty"` + SourceOcid *string `json:"sourceOcid,omitempty"` + + // Fields inherited from AutonomousDatabaseBaseProperties + + ActualUsedDataStorageSizeInTbs *float64 `json:"actualUsedDataStorageSizeInTbs,omitempty"` + AdminPassword *string `json:"adminPassword,omitempty"` + AllocatedStorageSizeInTbs *float64 `json:"allocatedStorageSizeInTbs,omitempty"` + ApexDetails *ApexDetailsType `json:"apexDetails,omitempty"` + AutonomousDatabaseId *string `json:"autonomousDatabaseId,omitempty"` + AutonomousMaintenanceScheduleType *AutonomousMaintenanceScheduleType `json:"autonomousMaintenanceScheduleType,omitempty"` + AvailableUpgradeVersions *[]string `json:"availableUpgradeVersions,omitempty"` + BackupRetentionPeriodInDays *int64 `json:"backupRetentionPeriodInDays,omitempty"` + CharacterSet *string `json:"characterSet,omitempty"` + ComputeCount *float64 `json:"computeCount,omitempty"` + ComputeModel *ComputeModel `json:"computeModel,omitempty"` + ConnectionStrings *ConnectionStringType `json:"connectionStrings,omitempty"` + ConnectionURLs *ConnectionURLType `json:"connectionUrls,omitempty"` + CpuCoreCount *int64 `json:"cpuCoreCount,omitempty"` + CustomerContacts *[]CustomerContact `json:"customerContacts,omitempty"` + DataBaseType DataBaseType `json:"dataBaseType"` + DataSafeStatus *DataSafeStatusType `json:"dataSafeStatus,omitempty"` + DataStorageSizeInGbs *int64 `json:"dataStorageSizeInGbs,omitempty"` + DataStorageSizeInTbs *int64 `json:"dataStorageSizeInTbs,omitempty"` + DatabaseEdition *DatabaseEditionType `json:"databaseEdition,omitempty"` + DbVersion *string `json:"dbVersion,omitempty"` + DbWorkload *WorkloadType `json:"dbWorkload,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + FailedDataRecoveryInSeconds *int64 `json:"failedDataRecoveryInSeconds,omitempty"` + InMemoryAreaInGbs *int64 `json:"inMemoryAreaInGbs,omitempty"` + IsAutoScalingEnabled *bool `json:"isAutoScalingEnabled,omitempty"` + IsAutoScalingForStorageEnabled *bool `json:"isAutoScalingForStorageEnabled,omitempty"` + IsLocalDataGuardEnabled *bool `json:"isLocalDataGuardEnabled,omitempty"` + IsMtlsConnectionRequired *bool `json:"isMtlsConnectionRequired,omitempty"` + IsPreview *bool `json:"isPreview,omitempty"` + IsPreviewVersionWithServiceTermsAccepted *bool `json:"isPreviewVersionWithServiceTermsAccepted,omitempty"` + IsRemoteDataGuardEnabled *bool `json:"isRemoteDataGuardEnabled,omitempty"` + LicenseModel *LicenseModel `json:"licenseModel,omitempty"` + LifecycleDetails *string `json:"lifecycleDetails,omitempty"` + LifecycleState *AutonomousDatabaseLifecycleState `json:"lifecycleState,omitempty"` + LocalAdgAutoFailoverMaxDataLossLimit *int64 `json:"localAdgAutoFailoverMaxDataLossLimit,omitempty"` + LocalDisasterRecoveryType *DisasterRecoveryType `json:"localDisasterRecoveryType,omitempty"` + LocalStandbyDb *AutonomousDatabaseStandbySummary `json:"localStandbyDb,omitempty"` + LongTermBackupSchedule *LongTermBackUpScheduleDetails `json:"longTermBackupSchedule,omitempty"` + MemoryPerOracleComputeUnitInGbs *int64 `json:"memoryPerOracleComputeUnitInGbs,omitempty"` + NcharacterSet *string `json:"ncharacterSet,omitempty"` + NextLongTermBackupTimeStamp *string `json:"nextLongTermBackupTimeStamp,omitempty"` + OciURL *string `json:"ociUrl,omitempty"` + Ocid *string `json:"ocid,omitempty"` + OpenMode *OpenModeType `json:"openMode,omitempty"` + OperationsInsightsStatus *OperationsInsightsStatusType `json:"operationsInsightsStatus,omitempty"` + PeerDbId *string `json:"peerDbId,omitempty"` + PeerDbIds *[]string `json:"peerDbIds,omitempty"` + PermissionLevel *PermissionLevelType `json:"permissionLevel,omitempty"` + PrivateEndpoint *string `json:"privateEndpoint,omitempty"` + PrivateEndpointIP *string `json:"privateEndpointIp,omitempty"` + PrivateEndpointLabel *string `json:"privateEndpointLabel,omitempty"` + ProvisionableCPUs *[]int64 `json:"provisionableCpus,omitempty"` + ProvisioningState *AzureResourceProvisioningState `json:"provisioningState,omitempty"` + RemoteDisasterRecoveryConfiguration *DisasterRecoveryConfigurationDetails `json:"remoteDisasterRecoveryConfiguration,omitempty"` + Role *RoleType `json:"role,omitempty"` + ScheduledOperationsList *[]ScheduledOperationsType `json:"scheduledOperationsList,omitempty"` + ServiceConsoleURL *string `json:"serviceConsoleUrl,omitempty"` + SqlWebDeveloperURL *string `json:"sqlWebDeveloperUrl,omitempty"` + SubnetId *string `json:"subnetId,omitempty"` + SupportedRegionsToCloneTo *[]string `json:"supportedRegionsToCloneTo,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + TimeDataGuardRoleChanged *string `json:"timeDataGuardRoleChanged,omitempty"` + TimeDeletionOfFreeAutonomousDatabase *string `json:"timeDeletionOfFreeAutonomousDatabase,omitempty"` + TimeDisasterRecoveryRoleChanged *string `json:"timeDisasterRecoveryRoleChanged,omitempty"` + TimeLocalDataGuardEnabled *string `json:"timeLocalDataGuardEnabled,omitempty"` + TimeMaintenanceBegin *string `json:"timeMaintenanceBegin,omitempty"` + TimeMaintenanceEnd *string `json:"timeMaintenanceEnd,omitempty"` + TimeOfLastFailover *string `json:"timeOfLastFailover,omitempty"` + TimeOfLastRefresh *string `json:"timeOfLastRefresh,omitempty"` + TimeOfLastRefreshPoint *string `json:"timeOfLastRefreshPoint,omitempty"` + TimeOfLastSwitchover *string `json:"timeOfLastSwitchover,omitempty"` + TimeReclamationOfFreeAutonomousDatabase *string `json:"timeReclamationOfFreeAutonomousDatabase,omitempty"` + UsedDataStorageSizeInGbs *int64 `json:"usedDataStorageSizeInGbs,omitempty"` + UsedDataStorageSizeInTbs *int64 `json:"usedDataStorageSizeInTbs,omitempty"` + VnetId *string `json:"vnetId,omitempty"` + WhitelistedIPs *[]string `json:"whitelistedIps,omitempty"` +} + +func (s AutonomousDatabaseCrossRegionDisasterRecoveryProperties) AutonomousDatabaseBaseProperties() BaseAutonomousDatabaseBasePropertiesImpl { + return BaseAutonomousDatabaseBasePropertiesImpl{ + ActualUsedDataStorageSizeInTbs: s.ActualUsedDataStorageSizeInTbs, + AdminPassword: s.AdminPassword, + AllocatedStorageSizeInTbs: s.AllocatedStorageSizeInTbs, + ApexDetails: s.ApexDetails, + AutonomousDatabaseId: s.AutonomousDatabaseId, + AutonomousMaintenanceScheduleType: s.AutonomousMaintenanceScheduleType, + AvailableUpgradeVersions: s.AvailableUpgradeVersions, + BackupRetentionPeriodInDays: s.BackupRetentionPeriodInDays, + CharacterSet: s.CharacterSet, + ComputeCount: s.ComputeCount, + ComputeModel: s.ComputeModel, + ConnectionStrings: s.ConnectionStrings, + ConnectionURLs: s.ConnectionURLs, + CpuCoreCount: s.CpuCoreCount, + CustomerContacts: s.CustomerContacts, + DataBaseType: s.DataBaseType, + DataSafeStatus: s.DataSafeStatus, + DataStorageSizeInGbs: s.DataStorageSizeInGbs, + DataStorageSizeInTbs: s.DataStorageSizeInTbs, + DatabaseEdition: s.DatabaseEdition, + DbVersion: s.DbVersion, + DbWorkload: s.DbWorkload, + DisplayName: s.DisplayName, + FailedDataRecoveryInSeconds: s.FailedDataRecoveryInSeconds, + InMemoryAreaInGbs: s.InMemoryAreaInGbs, + IsAutoScalingEnabled: s.IsAutoScalingEnabled, + IsAutoScalingForStorageEnabled: s.IsAutoScalingForStorageEnabled, + IsLocalDataGuardEnabled: s.IsLocalDataGuardEnabled, + IsMtlsConnectionRequired: s.IsMtlsConnectionRequired, + IsPreview: s.IsPreview, + IsPreviewVersionWithServiceTermsAccepted: s.IsPreviewVersionWithServiceTermsAccepted, + IsRemoteDataGuardEnabled: s.IsRemoteDataGuardEnabled, + LicenseModel: s.LicenseModel, + LifecycleDetails: s.LifecycleDetails, + LifecycleState: s.LifecycleState, + LocalAdgAutoFailoverMaxDataLossLimit: s.LocalAdgAutoFailoverMaxDataLossLimit, + LocalDisasterRecoveryType: s.LocalDisasterRecoveryType, + LocalStandbyDb: s.LocalStandbyDb, + LongTermBackupSchedule: s.LongTermBackupSchedule, + MemoryPerOracleComputeUnitInGbs: s.MemoryPerOracleComputeUnitInGbs, + NcharacterSet: s.NcharacterSet, + NextLongTermBackupTimeStamp: s.NextLongTermBackupTimeStamp, + OciURL: s.OciURL, + Ocid: s.Ocid, + OpenMode: s.OpenMode, + OperationsInsightsStatus: s.OperationsInsightsStatus, + PeerDbId: s.PeerDbId, + PeerDbIds: s.PeerDbIds, + PermissionLevel: s.PermissionLevel, + PrivateEndpoint: s.PrivateEndpoint, + PrivateEndpointIP: s.PrivateEndpointIP, + PrivateEndpointLabel: s.PrivateEndpointLabel, + ProvisionableCPUs: s.ProvisionableCPUs, + ProvisioningState: s.ProvisioningState, + RemoteDisasterRecoveryConfiguration: s.RemoteDisasterRecoveryConfiguration, + Role: s.Role, + ScheduledOperationsList: s.ScheduledOperationsList, + ServiceConsoleURL: s.ServiceConsoleURL, + SqlWebDeveloperURL: s.SqlWebDeveloperURL, + SubnetId: s.SubnetId, + SupportedRegionsToCloneTo: s.SupportedRegionsToCloneTo, + TimeCreated: s.TimeCreated, + TimeDataGuardRoleChanged: s.TimeDataGuardRoleChanged, + TimeDeletionOfFreeAutonomousDatabase: s.TimeDeletionOfFreeAutonomousDatabase, + TimeDisasterRecoveryRoleChanged: s.TimeDisasterRecoveryRoleChanged, + TimeLocalDataGuardEnabled: s.TimeLocalDataGuardEnabled, + TimeMaintenanceBegin: s.TimeMaintenanceBegin, + TimeMaintenanceEnd: s.TimeMaintenanceEnd, + TimeOfLastFailover: s.TimeOfLastFailover, + TimeOfLastRefresh: s.TimeOfLastRefresh, + TimeOfLastRefreshPoint: s.TimeOfLastRefreshPoint, + TimeOfLastSwitchover: s.TimeOfLastSwitchover, + TimeReclamationOfFreeAutonomousDatabase: s.TimeReclamationOfFreeAutonomousDatabase, + UsedDataStorageSizeInGbs: s.UsedDataStorageSizeInGbs, + UsedDataStorageSizeInTbs: s.UsedDataStorageSizeInTbs, + VnetId: s.VnetId, + WhitelistedIPs: s.WhitelistedIPs, + } +} + +func (o *AutonomousDatabaseCrossRegionDisasterRecoveryProperties) GetNextLongTermBackupTimeStampAsTime() (*time.Time, error) { + if o.NextLongTermBackupTimeStamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.NextLongTermBackupTimeStamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutonomousDatabaseCrossRegionDisasterRecoveryProperties) SetNextLongTermBackupTimeStampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.NextLongTermBackupTimeStamp = &formatted +} + +func (o *AutonomousDatabaseCrossRegionDisasterRecoveryProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutonomousDatabaseCrossRegionDisasterRecoveryProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} + +func (o *AutonomousDatabaseCrossRegionDisasterRecoveryProperties) GetTimeDisasterRecoveryRoleChangedAsTime() (*time.Time, error) { + if o.TimeDisasterRecoveryRoleChanged == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeDisasterRecoveryRoleChanged, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutonomousDatabaseCrossRegionDisasterRecoveryProperties) SetTimeDisasterRecoveryRoleChangedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeDisasterRecoveryRoleChanged = &formatted +} + +func (o *AutonomousDatabaseCrossRegionDisasterRecoveryProperties) GetTimeMaintenanceBeginAsTime() (*time.Time, error) { + if o.TimeMaintenanceBegin == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeMaintenanceBegin, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutonomousDatabaseCrossRegionDisasterRecoveryProperties) SetTimeMaintenanceBeginAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeMaintenanceBegin = &formatted +} + +func (o *AutonomousDatabaseCrossRegionDisasterRecoveryProperties) GetTimeMaintenanceEndAsTime() (*time.Time, error) { + if o.TimeMaintenanceEnd == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeMaintenanceEnd, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutonomousDatabaseCrossRegionDisasterRecoveryProperties) SetTimeMaintenanceEndAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeMaintenanceEnd = &formatted +} + +var _ json.Marshaler = AutonomousDatabaseCrossRegionDisasterRecoveryProperties{} + +func (s AutonomousDatabaseCrossRegionDisasterRecoveryProperties) MarshalJSON() ([]byte, error) { + type wrapper AutonomousDatabaseCrossRegionDisasterRecoveryProperties + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AutonomousDatabaseCrossRegionDisasterRecoveryProperties: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AutonomousDatabaseCrossRegionDisasterRecoveryProperties: %+v", err) + } + + decoded["dataBaseType"] = "CrossRegionDisasterRecovery" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AutonomousDatabaseCrossRegionDisasterRecoveryProperties: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasefrombackuptimestampproperties.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasefrombackuptimestampproperties.go new file mode 100644 index 00000000000..62fb88c192a --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasefrombackuptimestampproperties.go @@ -0,0 +1,269 @@ +package autonomousdatabases + +import ( + "encoding/json" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AutonomousDatabaseBaseProperties = AutonomousDatabaseFromBackupTimestampProperties{} + +type AutonomousDatabaseFromBackupTimestampProperties struct { + CloneType CloneType `json:"cloneType"` + Source Source `json:"source"` + SourceId string `json:"sourceId"` + Timestamp *string `json:"timestamp,omitempty"` + UseLatestAvailableBackupTimeStamp *bool `json:"useLatestAvailableBackupTimeStamp,omitempty"` + + // Fields inherited from AutonomousDatabaseBaseProperties + + ActualUsedDataStorageSizeInTbs *float64 `json:"actualUsedDataStorageSizeInTbs,omitempty"` + AdminPassword *string `json:"adminPassword,omitempty"` + AllocatedStorageSizeInTbs *float64 `json:"allocatedStorageSizeInTbs,omitempty"` + ApexDetails *ApexDetailsType `json:"apexDetails,omitempty"` + AutonomousDatabaseId *string `json:"autonomousDatabaseId,omitempty"` + AutonomousMaintenanceScheduleType *AutonomousMaintenanceScheduleType `json:"autonomousMaintenanceScheduleType,omitempty"` + AvailableUpgradeVersions *[]string `json:"availableUpgradeVersions,omitempty"` + BackupRetentionPeriodInDays *int64 `json:"backupRetentionPeriodInDays,omitempty"` + CharacterSet *string `json:"characterSet,omitempty"` + ComputeCount *float64 `json:"computeCount,omitempty"` + ComputeModel *ComputeModel `json:"computeModel,omitempty"` + ConnectionStrings *ConnectionStringType `json:"connectionStrings,omitempty"` + ConnectionURLs *ConnectionURLType `json:"connectionUrls,omitempty"` + CpuCoreCount *int64 `json:"cpuCoreCount,omitempty"` + CustomerContacts *[]CustomerContact `json:"customerContacts,omitempty"` + DataBaseType DataBaseType `json:"dataBaseType"` + DataSafeStatus *DataSafeStatusType `json:"dataSafeStatus,omitempty"` + DataStorageSizeInGbs *int64 `json:"dataStorageSizeInGbs,omitempty"` + DataStorageSizeInTbs *int64 `json:"dataStorageSizeInTbs,omitempty"` + DatabaseEdition *DatabaseEditionType `json:"databaseEdition,omitempty"` + DbVersion *string `json:"dbVersion,omitempty"` + DbWorkload *WorkloadType `json:"dbWorkload,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + FailedDataRecoveryInSeconds *int64 `json:"failedDataRecoveryInSeconds,omitempty"` + InMemoryAreaInGbs *int64 `json:"inMemoryAreaInGbs,omitempty"` + IsAutoScalingEnabled *bool `json:"isAutoScalingEnabled,omitempty"` + IsAutoScalingForStorageEnabled *bool `json:"isAutoScalingForStorageEnabled,omitempty"` + IsLocalDataGuardEnabled *bool `json:"isLocalDataGuardEnabled,omitempty"` + IsMtlsConnectionRequired *bool `json:"isMtlsConnectionRequired,omitempty"` + IsPreview *bool `json:"isPreview,omitempty"` + IsPreviewVersionWithServiceTermsAccepted *bool `json:"isPreviewVersionWithServiceTermsAccepted,omitempty"` + IsRemoteDataGuardEnabled *bool `json:"isRemoteDataGuardEnabled,omitempty"` + LicenseModel *LicenseModel `json:"licenseModel,omitempty"` + LifecycleDetails *string `json:"lifecycleDetails,omitempty"` + LifecycleState *AutonomousDatabaseLifecycleState `json:"lifecycleState,omitempty"` + LocalAdgAutoFailoverMaxDataLossLimit *int64 `json:"localAdgAutoFailoverMaxDataLossLimit,omitempty"` + LocalDisasterRecoveryType *DisasterRecoveryType `json:"localDisasterRecoveryType,omitempty"` + LocalStandbyDb *AutonomousDatabaseStandbySummary `json:"localStandbyDb,omitempty"` + LongTermBackupSchedule *LongTermBackUpScheduleDetails `json:"longTermBackupSchedule,omitempty"` + MemoryPerOracleComputeUnitInGbs *int64 `json:"memoryPerOracleComputeUnitInGbs,omitempty"` + NcharacterSet *string `json:"ncharacterSet,omitempty"` + NextLongTermBackupTimeStamp *string `json:"nextLongTermBackupTimeStamp,omitempty"` + OciURL *string `json:"ociUrl,omitempty"` + Ocid *string `json:"ocid,omitempty"` + OpenMode *OpenModeType `json:"openMode,omitempty"` + OperationsInsightsStatus *OperationsInsightsStatusType `json:"operationsInsightsStatus,omitempty"` + PeerDbId *string `json:"peerDbId,omitempty"` + PeerDbIds *[]string `json:"peerDbIds,omitempty"` + PermissionLevel *PermissionLevelType `json:"permissionLevel,omitempty"` + PrivateEndpoint *string `json:"privateEndpoint,omitempty"` + PrivateEndpointIP *string `json:"privateEndpointIp,omitempty"` + PrivateEndpointLabel *string `json:"privateEndpointLabel,omitempty"` + ProvisionableCPUs *[]int64 `json:"provisionableCpus,omitempty"` + ProvisioningState *AzureResourceProvisioningState `json:"provisioningState,omitempty"` + RemoteDisasterRecoveryConfiguration *DisasterRecoveryConfigurationDetails `json:"remoteDisasterRecoveryConfiguration,omitempty"` + Role *RoleType `json:"role,omitempty"` + ScheduledOperationsList *[]ScheduledOperationsType `json:"scheduledOperationsList,omitempty"` + ServiceConsoleURL *string `json:"serviceConsoleUrl,omitempty"` + SqlWebDeveloperURL *string `json:"sqlWebDeveloperUrl,omitempty"` + SubnetId *string `json:"subnetId,omitempty"` + SupportedRegionsToCloneTo *[]string `json:"supportedRegionsToCloneTo,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + TimeDataGuardRoleChanged *string `json:"timeDataGuardRoleChanged,omitempty"` + TimeDeletionOfFreeAutonomousDatabase *string `json:"timeDeletionOfFreeAutonomousDatabase,omitempty"` + TimeDisasterRecoveryRoleChanged *string `json:"timeDisasterRecoveryRoleChanged,omitempty"` + TimeLocalDataGuardEnabled *string `json:"timeLocalDataGuardEnabled,omitempty"` + TimeMaintenanceBegin *string `json:"timeMaintenanceBegin,omitempty"` + TimeMaintenanceEnd *string `json:"timeMaintenanceEnd,omitempty"` + TimeOfLastFailover *string `json:"timeOfLastFailover,omitempty"` + TimeOfLastRefresh *string `json:"timeOfLastRefresh,omitempty"` + TimeOfLastRefreshPoint *string `json:"timeOfLastRefreshPoint,omitempty"` + TimeOfLastSwitchover *string `json:"timeOfLastSwitchover,omitempty"` + TimeReclamationOfFreeAutonomousDatabase *string `json:"timeReclamationOfFreeAutonomousDatabase,omitempty"` + UsedDataStorageSizeInGbs *int64 `json:"usedDataStorageSizeInGbs,omitempty"` + UsedDataStorageSizeInTbs *int64 `json:"usedDataStorageSizeInTbs,omitempty"` + VnetId *string `json:"vnetId,omitempty"` + WhitelistedIPs *[]string `json:"whitelistedIps,omitempty"` +} + +func (s AutonomousDatabaseFromBackupTimestampProperties) AutonomousDatabaseBaseProperties() BaseAutonomousDatabaseBasePropertiesImpl { + return BaseAutonomousDatabaseBasePropertiesImpl{ + ActualUsedDataStorageSizeInTbs: s.ActualUsedDataStorageSizeInTbs, + AdminPassword: s.AdminPassword, + AllocatedStorageSizeInTbs: s.AllocatedStorageSizeInTbs, + ApexDetails: s.ApexDetails, + AutonomousDatabaseId: s.AutonomousDatabaseId, + AutonomousMaintenanceScheduleType: s.AutonomousMaintenanceScheduleType, + AvailableUpgradeVersions: s.AvailableUpgradeVersions, + BackupRetentionPeriodInDays: s.BackupRetentionPeriodInDays, + CharacterSet: s.CharacterSet, + ComputeCount: s.ComputeCount, + ComputeModel: s.ComputeModel, + ConnectionStrings: s.ConnectionStrings, + ConnectionURLs: s.ConnectionURLs, + CpuCoreCount: s.CpuCoreCount, + CustomerContacts: s.CustomerContacts, + DataBaseType: s.DataBaseType, + DataSafeStatus: s.DataSafeStatus, + DataStorageSizeInGbs: s.DataStorageSizeInGbs, + DataStorageSizeInTbs: s.DataStorageSizeInTbs, + DatabaseEdition: s.DatabaseEdition, + DbVersion: s.DbVersion, + DbWorkload: s.DbWorkload, + DisplayName: s.DisplayName, + FailedDataRecoveryInSeconds: s.FailedDataRecoveryInSeconds, + InMemoryAreaInGbs: s.InMemoryAreaInGbs, + IsAutoScalingEnabled: s.IsAutoScalingEnabled, + IsAutoScalingForStorageEnabled: s.IsAutoScalingForStorageEnabled, + IsLocalDataGuardEnabled: s.IsLocalDataGuardEnabled, + IsMtlsConnectionRequired: s.IsMtlsConnectionRequired, + IsPreview: s.IsPreview, + IsPreviewVersionWithServiceTermsAccepted: s.IsPreviewVersionWithServiceTermsAccepted, + IsRemoteDataGuardEnabled: s.IsRemoteDataGuardEnabled, + LicenseModel: s.LicenseModel, + LifecycleDetails: s.LifecycleDetails, + LifecycleState: s.LifecycleState, + LocalAdgAutoFailoverMaxDataLossLimit: s.LocalAdgAutoFailoverMaxDataLossLimit, + LocalDisasterRecoveryType: s.LocalDisasterRecoveryType, + LocalStandbyDb: s.LocalStandbyDb, + LongTermBackupSchedule: s.LongTermBackupSchedule, + MemoryPerOracleComputeUnitInGbs: s.MemoryPerOracleComputeUnitInGbs, + NcharacterSet: s.NcharacterSet, + NextLongTermBackupTimeStamp: s.NextLongTermBackupTimeStamp, + OciURL: s.OciURL, + Ocid: s.Ocid, + OpenMode: s.OpenMode, + OperationsInsightsStatus: s.OperationsInsightsStatus, + PeerDbId: s.PeerDbId, + PeerDbIds: s.PeerDbIds, + PermissionLevel: s.PermissionLevel, + PrivateEndpoint: s.PrivateEndpoint, + PrivateEndpointIP: s.PrivateEndpointIP, + PrivateEndpointLabel: s.PrivateEndpointLabel, + ProvisionableCPUs: s.ProvisionableCPUs, + ProvisioningState: s.ProvisioningState, + RemoteDisasterRecoveryConfiguration: s.RemoteDisasterRecoveryConfiguration, + Role: s.Role, + ScheduledOperationsList: s.ScheduledOperationsList, + ServiceConsoleURL: s.ServiceConsoleURL, + SqlWebDeveloperURL: s.SqlWebDeveloperURL, + SubnetId: s.SubnetId, + SupportedRegionsToCloneTo: s.SupportedRegionsToCloneTo, + TimeCreated: s.TimeCreated, + TimeDataGuardRoleChanged: s.TimeDataGuardRoleChanged, + TimeDeletionOfFreeAutonomousDatabase: s.TimeDeletionOfFreeAutonomousDatabase, + TimeDisasterRecoveryRoleChanged: s.TimeDisasterRecoveryRoleChanged, + TimeLocalDataGuardEnabled: s.TimeLocalDataGuardEnabled, + TimeMaintenanceBegin: s.TimeMaintenanceBegin, + TimeMaintenanceEnd: s.TimeMaintenanceEnd, + TimeOfLastFailover: s.TimeOfLastFailover, + TimeOfLastRefresh: s.TimeOfLastRefresh, + TimeOfLastRefreshPoint: s.TimeOfLastRefreshPoint, + TimeOfLastSwitchover: s.TimeOfLastSwitchover, + TimeReclamationOfFreeAutonomousDatabase: s.TimeReclamationOfFreeAutonomousDatabase, + UsedDataStorageSizeInGbs: s.UsedDataStorageSizeInGbs, + UsedDataStorageSizeInTbs: s.UsedDataStorageSizeInTbs, + VnetId: s.VnetId, + WhitelistedIPs: s.WhitelistedIPs, + } +} + +func (o *AutonomousDatabaseFromBackupTimestampProperties) GetNextLongTermBackupTimeStampAsTime() (*time.Time, error) { + if o.NextLongTermBackupTimeStamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.NextLongTermBackupTimeStamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutonomousDatabaseFromBackupTimestampProperties) SetNextLongTermBackupTimeStampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.NextLongTermBackupTimeStamp = &formatted +} + +func (o *AutonomousDatabaseFromBackupTimestampProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutonomousDatabaseFromBackupTimestampProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} + +func (o *AutonomousDatabaseFromBackupTimestampProperties) GetTimeDisasterRecoveryRoleChangedAsTime() (*time.Time, error) { + if o.TimeDisasterRecoveryRoleChanged == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeDisasterRecoveryRoleChanged, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutonomousDatabaseFromBackupTimestampProperties) SetTimeDisasterRecoveryRoleChangedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeDisasterRecoveryRoleChanged = &formatted +} + +func (o *AutonomousDatabaseFromBackupTimestampProperties) GetTimeMaintenanceBeginAsTime() (*time.Time, error) { + if o.TimeMaintenanceBegin == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeMaintenanceBegin, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutonomousDatabaseFromBackupTimestampProperties) SetTimeMaintenanceBeginAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeMaintenanceBegin = &formatted +} + +func (o *AutonomousDatabaseFromBackupTimestampProperties) GetTimeMaintenanceEndAsTime() (*time.Time, error) { + if o.TimeMaintenanceEnd == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeMaintenanceEnd, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutonomousDatabaseFromBackupTimestampProperties) SetTimeMaintenanceEndAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeMaintenanceEnd = &formatted +} + +var _ json.Marshaler = AutonomousDatabaseFromBackupTimestampProperties{} + +func (s AutonomousDatabaseFromBackupTimestampProperties) MarshalJSON() ([]byte, error) { + type wrapper AutonomousDatabaseFromBackupTimestampProperties + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AutonomousDatabaseFromBackupTimestampProperties: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AutonomousDatabaseFromBackupTimestampProperties: %+v", err) + } + + decoded["dataBaseType"] = "CloneFromBackupTimestamp" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AutonomousDatabaseFromBackupTimestampProperties: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabaselifecycleaction.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabaselifecycleaction.go new file mode 100644 index 00000000000..2deab0162fa --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabaselifecycleaction.go @@ -0,0 +1,8 @@ +package autonomousdatabases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabaseLifecycleAction struct { + Action AutonomousDatabaseLifecycleActionEnum `json:"action"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabaseproperties.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabaseproperties.go new file mode 100644 index 00000000000..88002cf94cf --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabaseproperties.go @@ -0,0 +1,264 @@ +package autonomousdatabases + +import ( + "encoding/json" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AutonomousDatabaseBaseProperties = AutonomousDatabaseProperties{} + +type AutonomousDatabaseProperties struct { + + // Fields inherited from AutonomousDatabaseBaseProperties + + ActualUsedDataStorageSizeInTbs *float64 `json:"actualUsedDataStorageSizeInTbs,omitempty"` + AdminPassword *string `json:"adminPassword,omitempty"` + AllocatedStorageSizeInTbs *float64 `json:"allocatedStorageSizeInTbs,omitempty"` + ApexDetails *ApexDetailsType `json:"apexDetails,omitempty"` + AutonomousDatabaseId *string `json:"autonomousDatabaseId,omitempty"` + AutonomousMaintenanceScheduleType *AutonomousMaintenanceScheduleType `json:"autonomousMaintenanceScheduleType,omitempty"` + AvailableUpgradeVersions *[]string `json:"availableUpgradeVersions,omitempty"` + BackupRetentionPeriodInDays *int64 `json:"backupRetentionPeriodInDays,omitempty"` + CharacterSet *string `json:"characterSet,omitempty"` + ComputeCount *float64 `json:"computeCount,omitempty"` + ComputeModel *ComputeModel `json:"computeModel,omitempty"` + ConnectionStrings *ConnectionStringType `json:"connectionStrings,omitempty"` + ConnectionURLs *ConnectionURLType `json:"connectionUrls,omitempty"` + CpuCoreCount *int64 `json:"cpuCoreCount,omitempty"` + CustomerContacts *[]CustomerContact `json:"customerContacts,omitempty"` + DataBaseType DataBaseType `json:"dataBaseType"` + DataSafeStatus *DataSafeStatusType `json:"dataSafeStatus,omitempty"` + DataStorageSizeInGbs *int64 `json:"dataStorageSizeInGbs,omitempty"` + DataStorageSizeInTbs *int64 `json:"dataStorageSizeInTbs,omitempty"` + DatabaseEdition *DatabaseEditionType `json:"databaseEdition,omitempty"` + DbVersion *string `json:"dbVersion,omitempty"` + DbWorkload *WorkloadType `json:"dbWorkload,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + FailedDataRecoveryInSeconds *int64 `json:"failedDataRecoveryInSeconds,omitempty"` + InMemoryAreaInGbs *int64 `json:"inMemoryAreaInGbs,omitempty"` + IsAutoScalingEnabled *bool `json:"isAutoScalingEnabled,omitempty"` + IsAutoScalingForStorageEnabled *bool `json:"isAutoScalingForStorageEnabled,omitempty"` + IsLocalDataGuardEnabled *bool `json:"isLocalDataGuardEnabled,omitempty"` + IsMtlsConnectionRequired *bool `json:"isMtlsConnectionRequired,omitempty"` + IsPreview *bool `json:"isPreview,omitempty"` + IsPreviewVersionWithServiceTermsAccepted *bool `json:"isPreviewVersionWithServiceTermsAccepted,omitempty"` + IsRemoteDataGuardEnabled *bool `json:"isRemoteDataGuardEnabled,omitempty"` + LicenseModel *LicenseModel `json:"licenseModel,omitempty"` + LifecycleDetails *string `json:"lifecycleDetails,omitempty"` + LifecycleState *AutonomousDatabaseLifecycleState `json:"lifecycleState,omitempty"` + LocalAdgAutoFailoverMaxDataLossLimit *int64 `json:"localAdgAutoFailoverMaxDataLossLimit,omitempty"` + LocalDisasterRecoveryType *DisasterRecoveryType `json:"localDisasterRecoveryType,omitempty"` + LocalStandbyDb *AutonomousDatabaseStandbySummary `json:"localStandbyDb,omitempty"` + LongTermBackupSchedule *LongTermBackUpScheduleDetails `json:"longTermBackupSchedule,omitempty"` + MemoryPerOracleComputeUnitInGbs *int64 `json:"memoryPerOracleComputeUnitInGbs,omitempty"` + NcharacterSet *string `json:"ncharacterSet,omitempty"` + NextLongTermBackupTimeStamp *string `json:"nextLongTermBackupTimeStamp,omitempty"` + OciURL *string `json:"ociUrl,omitempty"` + Ocid *string `json:"ocid,omitempty"` + OpenMode *OpenModeType `json:"openMode,omitempty"` + OperationsInsightsStatus *OperationsInsightsStatusType `json:"operationsInsightsStatus,omitempty"` + PeerDbId *string `json:"peerDbId,omitempty"` + PeerDbIds *[]string `json:"peerDbIds,omitempty"` + PermissionLevel *PermissionLevelType `json:"permissionLevel,omitempty"` + PrivateEndpoint *string `json:"privateEndpoint,omitempty"` + PrivateEndpointIP *string `json:"privateEndpointIp,omitempty"` + PrivateEndpointLabel *string `json:"privateEndpointLabel,omitempty"` + ProvisionableCPUs *[]int64 `json:"provisionableCpus,omitempty"` + ProvisioningState *AzureResourceProvisioningState `json:"provisioningState,omitempty"` + RemoteDisasterRecoveryConfiguration *DisasterRecoveryConfigurationDetails `json:"remoteDisasterRecoveryConfiguration,omitempty"` + Role *RoleType `json:"role,omitempty"` + ScheduledOperationsList *[]ScheduledOperationsType `json:"scheduledOperationsList,omitempty"` + ServiceConsoleURL *string `json:"serviceConsoleUrl,omitempty"` + SqlWebDeveloperURL *string `json:"sqlWebDeveloperUrl,omitempty"` + SubnetId *string `json:"subnetId,omitempty"` + SupportedRegionsToCloneTo *[]string `json:"supportedRegionsToCloneTo,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + TimeDataGuardRoleChanged *string `json:"timeDataGuardRoleChanged,omitempty"` + TimeDeletionOfFreeAutonomousDatabase *string `json:"timeDeletionOfFreeAutonomousDatabase,omitempty"` + TimeDisasterRecoveryRoleChanged *string `json:"timeDisasterRecoveryRoleChanged,omitempty"` + TimeLocalDataGuardEnabled *string `json:"timeLocalDataGuardEnabled,omitempty"` + TimeMaintenanceBegin *string `json:"timeMaintenanceBegin,omitempty"` + TimeMaintenanceEnd *string `json:"timeMaintenanceEnd,omitempty"` + TimeOfLastFailover *string `json:"timeOfLastFailover,omitempty"` + TimeOfLastRefresh *string `json:"timeOfLastRefresh,omitempty"` + TimeOfLastRefreshPoint *string `json:"timeOfLastRefreshPoint,omitempty"` + TimeOfLastSwitchover *string `json:"timeOfLastSwitchover,omitempty"` + TimeReclamationOfFreeAutonomousDatabase *string `json:"timeReclamationOfFreeAutonomousDatabase,omitempty"` + UsedDataStorageSizeInGbs *int64 `json:"usedDataStorageSizeInGbs,omitempty"` + UsedDataStorageSizeInTbs *int64 `json:"usedDataStorageSizeInTbs,omitempty"` + VnetId *string `json:"vnetId,omitempty"` + WhitelistedIPs *[]string `json:"whitelistedIps,omitempty"` +} + +func (s AutonomousDatabaseProperties) AutonomousDatabaseBaseProperties() BaseAutonomousDatabaseBasePropertiesImpl { + return BaseAutonomousDatabaseBasePropertiesImpl{ + ActualUsedDataStorageSizeInTbs: s.ActualUsedDataStorageSizeInTbs, + AdminPassword: s.AdminPassword, + AllocatedStorageSizeInTbs: s.AllocatedStorageSizeInTbs, + ApexDetails: s.ApexDetails, + AutonomousDatabaseId: s.AutonomousDatabaseId, + AutonomousMaintenanceScheduleType: s.AutonomousMaintenanceScheduleType, + AvailableUpgradeVersions: s.AvailableUpgradeVersions, + BackupRetentionPeriodInDays: s.BackupRetentionPeriodInDays, + CharacterSet: s.CharacterSet, + ComputeCount: s.ComputeCount, + ComputeModel: s.ComputeModel, + ConnectionStrings: s.ConnectionStrings, + ConnectionURLs: s.ConnectionURLs, + CpuCoreCount: s.CpuCoreCount, + CustomerContacts: s.CustomerContacts, + DataBaseType: s.DataBaseType, + DataSafeStatus: s.DataSafeStatus, + DataStorageSizeInGbs: s.DataStorageSizeInGbs, + DataStorageSizeInTbs: s.DataStorageSizeInTbs, + DatabaseEdition: s.DatabaseEdition, + DbVersion: s.DbVersion, + DbWorkload: s.DbWorkload, + DisplayName: s.DisplayName, + FailedDataRecoveryInSeconds: s.FailedDataRecoveryInSeconds, + InMemoryAreaInGbs: s.InMemoryAreaInGbs, + IsAutoScalingEnabled: s.IsAutoScalingEnabled, + IsAutoScalingForStorageEnabled: s.IsAutoScalingForStorageEnabled, + IsLocalDataGuardEnabled: s.IsLocalDataGuardEnabled, + IsMtlsConnectionRequired: s.IsMtlsConnectionRequired, + IsPreview: s.IsPreview, + IsPreviewVersionWithServiceTermsAccepted: s.IsPreviewVersionWithServiceTermsAccepted, + IsRemoteDataGuardEnabled: s.IsRemoteDataGuardEnabled, + LicenseModel: s.LicenseModel, + LifecycleDetails: s.LifecycleDetails, + LifecycleState: s.LifecycleState, + LocalAdgAutoFailoverMaxDataLossLimit: s.LocalAdgAutoFailoverMaxDataLossLimit, + LocalDisasterRecoveryType: s.LocalDisasterRecoveryType, + LocalStandbyDb: s.LocalStandbyDb, + LongTermBackupSchedule: s.LongTermBackupSchedule, + MemoryPerOracleComputeUnitInGbs: s.MemoryPerOracleComputeUnitInGbs, + NcharacterSet: s.NcharacterSet, + NextLongTermBackupTimeStamp: s.NextLongTermBackupTimeStamp, + OciURL: s.OciURL, + Ocid: s.Ocid, + OpenMode: s.OpenMode, + OperationsInsightsStatus: s.OperationsInsightsStatus, + PeerDbId: s.PeerDbId, + PeerDbIds: s.PeerDbIds, + PermissionLevel: s.PermissionLevel, + PrivateEndpoint: s.PrivateEndpoint, + PrivateEndpointIP: s.PrivateEndpointIP, + PrivateEndpointLabel: s.PrivateEndpointLabel, + ProvisionableCPUs: s.ProvisionableCPUs, + ProvisioningState: s.ProvisioningState, + RemoteDisasterRecoveryConfiguration: s.RemoteDisasterRecoveryConfiguration, + Role: s.Role, + ScheduledOperationsList: s.ScheduledOperationsList, + ServiceConsoleURL: s.ServiceConsoleURL, + SqlWebDeveloperURL: s.SqlWebDeveloperURL, + SubnetId: s.SubnetId, + SupportedRegionsToCloneTo: s.SupportedRegionsToCloneTo, + TimeCreated: s.TimeCreated, + TimeDataGuardRoleChanged: s.TimeDataGuardRoleChanged, + TimeDeletionOfFreeAutonomousDatabase: s.TimeDeletionOfFreeAutonomousDatabase, + TimeDisasterRecoveryRoleChanged: s.TimeDisasterRecoveryRoleChanged, + TimeLocalDataGuardEnabled: s.TimeLocalDataGuardEnabled, + TimeMaintenanceBegin: s.TimeMaintenanceBegin, + TimeMaintenanceEnd: s.TimeMaintenanceEnd, + TimeOfLastFailover: s.TimeOfLastFailover, + TimeOfLastRefresh: s.TimeOfLastRefresh, + TimeOfLastRefreshPoint: s.TimeOfLastRefreshPoint, + TimeOfLastSwitchover: s.TimeOfLastSwitchover, + TimeReclamationOfFreeAutonomousDatabase: s.TimeReclamationOfFreeAutonomousDatabase, + UsedDataStorageSizeInGbs: s.UsedDataStorageSizeInGbs, + UsedDataStorageSizeInTbs: s.UsedDataStorageSizeInTbs, + VnetId: s.VnetId, + WhitelistedIPs: s.WhitelistedIPs, + } +} + +func (o *AutonomousDatabaseProperties) GetNextLongTermBackupTimeStampAsTime() (*time.Time, error) { + if o.NextLongTermBackupTimeStamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.NextLongTermBackupTimeStamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutonomousDatabaseProperties) SetNextLongTermBackupTimeStampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.NextLongTermBackupTimeStamp = &formatted +} + +func (o *AutonomousDatabaseProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutonomousDatabaseProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} + +func (o *AutonomousDatabaseProperties) GetTimeDisasterRecoveryRoleChangedAsTime() (*time.Time, error) { + if o.TimeDisasterRecoveryRoleChanged == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeDisasterRecoveryRoleChanged, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutonomousDatabaseProperties) SetTimeDisasterRecoveryRoleChangedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeDisasterRecoveryRoleChanged = &formatted +} + +func (o *AutonomousDatabaseProperties) GetTimeMaintenanceBeginAsTime() (*time.Time, error) { + if o.TimeMaintenanceBegin == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeMaintenanceBegin, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutonomousDatabaseProperties) SetTimeMaintenanceBeginAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeMaintenanceBegin = &formatted +} + +func (o *AutonomousDatabaseProperties) GetTimeMaintenanceEndAsTime() (*time.Time, error) { + if o.TimeMaintenanceEnd == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeMaintenanceEnd, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutonomousDatabaseProperties) SetTimeMaintenanceEndAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeMaintenanceEnd = &formatted +} + +var _ json.Marshaler = AutonomousDatabaseProperties{} + +func (s AutonomousDatabaseProperties) MarshalJSON() ([]byte, error) { + type wrapper AutonomousDatabaseProperties + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AutonomousDatabaseProperties: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AutonomousDatabaseProperties: %+v", err) + } + + decoded["dataBaseType"] = "Regular" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AutonomousDatabaseProperties: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasestandbysummary.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasestandbysummary.go new file mode 100644 index 00000000000..484d3578c68 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasestandbysummary.go @@ -0,0 +1,12 @@ +package autonomousdatabases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabaseStandbySummary struct { + LagTimeInSeconds *int64 `json:"lagTimeInSeconds,omitempty"` + LifecycleDetails *string `json:"lifecycleDetails,omitempty"` + LifecycleState *AutonomousDatabaseLifecycleState `json:"lifecycleState,omitempty"` + TimeDataGuardRoleChanged *string `json:"timeDataGuardRoleChanged,omitempty"` + TimeDisasterRecoveryRoleChanged *string `json:"timeDisasterRecoveryRoleChanged,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabaseupdate.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabaseupdate.go new file mode 100644 index 00000000000..d4087756731 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabaseupdate.go @@ -0,0 +1,9 @@ +package autonomousdatabases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabaseUpdate struct { + Properties *AutonomousDatabaseUpdateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabaseupdateproperties.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabaseupdateproperties.go new file mode 100644 index 00000000000..a558dea8410 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabaseupdateproperties.go @@ -0,0 +1,30 @@ +package autonomousdatabases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabaseUpdateProperties struct { + AdminPassword *string `json:"adminPassword,omitempty"` + AutonomousMaintenanceScheduleType *AutonomousMaintenanceScheduleType `json:"autonomousMaintenanceScheduleType,omitempty"` + BackupRetentionPeriodInDays *int64 `json:"backupRetentionPeriodInDays,omitempty"` + ComputeCount *float64 `json:"computeCount,omitempty"` + CpuCoreCount *int64 `json:"cpuCoreCount,omitempty"` + CustomerContacts *[]CustomerContact `json:"customerContacts,omitempty"` + DataStorageSizeInGbs *int64 `json:"dataStorageSizeInGbs,omitempty"` + DataStorageSizeInTbs *int64 `json:"dataStorageSizeInTbs,omitempty"` + DatabaseEdition *DatabaseEditionType `json:"databaseEdition,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + IsAutoScalingEnabled *bool `json:"isAutoScalingEnabled,omitempty"` + IsAutoScalingForStorageEnabled *bool `json:"isAutoScalingForStorageEnabled,omitempty"` + IsLocalDataGuardEnabled *bool `json:"isLocalDataGuardEnabled,omitempty"` + IsMtlsConnectionRequired *bool `json:"isMtlsConnectionRequired,omitempty"` + LicenseModel *LicenseModel `json:"licenseModel,omitempty"` + LocalAdgAutoFailoverMaxDataLossLimit *int64 `json:"localAdgAutoFailoverMaxDataLossLimit,omitempty"` + LongTermBackupSchedule *LongTermBackUpScheduleDetails `json:"longTermBackupSchedule,omitempty"` + OpenMode *OpenModeType `json:"openMode,omitempty"` + PeerDbId *string `json:"peerDbId,omitempty"` + PermissionLevel *PermissionLevelType `json:"permissionLevel,omitempty"` + Role *RoleType `json:"role,omitempty"` + ScheduledOperationsList *[]ScheduledOperationsTypeUpdate `json:"scheduledOperationsList,omitempty"` + WhitelistedIPs *[]string `json:"whitelistedIps,omitempty"` +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/model_backupmanagementusagelist.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasewalletfile.go similarity index 55% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/model_backupmanagementusagelist.go rename to resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasewalletfile.go index e2014e84694..3db16ef5d70 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/model_backupmanagementusagelist.go +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_autonomousdatabasewalletfile.go @@ -1,8 +1,8 @@ -package backupusagesummaries +package autonomousdatabases // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type BackupManagementUsageList struct { - Value *[]BackupManagementUsage `json:"value,omitempty"` +type AutonomousDatabaseWalletFile struct { + WalletFiles string `json:"walletFiles"` } diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_connectionstringtype.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_connectionstringtype.go new file mode 100644 index 00000000000..044b93601aa --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_connectionstringtype.go @@ -0,0 +1,13 @@ +package autonomousdatabases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConnectionStringType struct { + AllConnectionStrings *AllConnectionStringType `json:"allConnectionStrings,omitempty"` + Dedicated *string `json:"dedicated,omitempty"` + High *string `json:"high,omitempty"` + Low *string `json:"low,omitempty"` + Medium *string `json:"medium,omitempty"` + Profiles *[]ProfileType `json:"profiles,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_connectionurltype.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_connectionurltype.go new file mode 100644 index 00000000000..6e866fc0a09 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_connectionurltype.go @@ -0,0 +1,14 @@ +package autonomousdatabases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConnectionURLType struct { + ApexURL *string `json:"apexUrl,omitempty"` + DatabaseTransformsURL *string `json:"databaseTransformsUrl,omitempty"` + GraphStudioURL *string `json:"graphStudioUrl,omitempty"` + MachineLearningNotebookURL *string `json:"machineLearningNotebookUrl,omitempty"` + MongoDbURL *string `json:"mongoDbUrl,omitempty"` + OrdsURL *string `json:"ordsUrl,omitempty"` + SqlDevWebURL *string `json:"sqlDevWebUrl,omitempty"` +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_extendedlocation.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_customercontact.go similarity index 54% rename from resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_extendedlocation.go rename to resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_customercontact.go index 608d19191a4..f0cb840d637 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_extendedlocation.go +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_customercontact.go @@ -1,9 +1,8 @@ -package validateoperation +package autonomousdatabases // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type ExtendedLocation struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` +type CustomerContact struct { + Email string `json:"email"` } diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_dayofweek.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_dayofweek.go new file mode 100644 index 00000000000..f3a881a70d0 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_dayofweek.go @@ -0,0 +1,8 @@ +package autonomousdatabases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DayOfWeek struct { + Name DayOfWeekName `json:"name"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_dayofweekupdate.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_dayofweekupdate.go new file mode 100644 index 00000000000..3a2293955d2 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_dayofweekupdate.go @@ -0,0 +1,8 @@ +package autonomousdatabases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DayOfWeekUpdate struct { + Name *DayOfWeekName `json:"name,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_disasterrecoveryconfigurationdetails.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_disasterrecoveryconfigurationdetails.go new file mode 100644 index 00000000000..2c2b5dfe575 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_disasterrecoveryconfigurationdetails.go @@ -0,0 +1,29 @@ +package autonomousdatabases + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DisasterRecoveryConfigurationDetails struct { + DisasterRecoveryType *DisasterRecoveryType `json:"disasterRecoveryType,omitempty"` + IsReplicateAutomaticBackups *bool `json:"isReplicateAutomaticBackups,omitempty"` + IsSnapshotStandby *bool `json:"isSnapshotStandby,omitempty"` + TimeSnapshotStandbyEnabledTill *string `json:"timeSnapshotStandbyEnabledTill,omitempty"` +} + +func (o *DisasterRecoveryConfigurationDetails) GetTimeSnapshotStandbyEnabledTillAsTime() (*time.Time, error) { + if o.TimeSnapshotStandbyEnabledTill == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeSnapshotStandbyEnabledTill, "2006-01-02T15:04:05Z07:00") +} + +func (o *DisasterRecoveryConfigurationDetails) SetTimeSnapshotStandbyEnabledTillAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeSnapshotStandbyEnabledTill = &formatted +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_generateautonomousdatabasewalletdetails.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_generateautonomousdatabasewalletdetails.go new file mode 100644 index 00000000000..1ac191ea68d --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_generateautonomousdatabasewalletdetails.go @@ -0,0 +1,10 @@ +package autonomousdatabases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GenerateAutonomousDatabaseWalletDetails struct { + GenerateType *GenerateType `json:"generateType,omitempty"` + IsRegional *bool `json:"isRegional,omitempty"` + Password string `json:"password"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_longtermbackupscheduledetails.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_longtermbackupscheduledetails.go new file mode 100644 index 00000000000..3219641f573 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_longtermbackupscheduledetails.go @@ -0,0 +1,29 @@ +package autonomousdatabases + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LongTermBackUpScheduleDetails struct { + IsDisabled *bool `json:"isDisabled,omitempty"` + RepeatCadence *RepeatCadenceType `json:"repeatCadence,omitempty"` + RetentionPeriodInDays *int64 `json:"retentionPeriodInDays,omitempty"` + TimeOfBackup *string `json:"timeOfBackup,omitempty"` +} + +func (o *LongTermBackUpScheduleDetails) GetTimeOfBackupAsTime() (*time.Time, error) { + if o.TimeOfBackup == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeOfBackup, "2006-01-02T15:04:05Z07:00") +} + +func (o *LongTermBackUpScheduleDetails) SetTimeOfBackupAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeOfBackup = &formatted +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_peerdbdetails.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_peerdbdetails.go new file mode 100644 index 00000000000..e68d053dc6c --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_peerdbdetails.go @@ -0,0 +1,10 @@ +package autonomousdatabases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PeerDbDetails struct { + PeerDbId *string `json:"peerDbId,omitempty"` + PeerDbLocation *string `json:"peerDbLocation,omitempty"` + PeerDbOcid *string `json:"peerDbOcid,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_profiletype.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_profiletype.go new file mode 100644 index 00000000000..23033b333c9 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_profiletype.go @@ -0,0 +1,16 @@ +package autonomousdatabases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProfileType struct { + ConsumerGroup *ConsumerGroup `json:"consumerGroup,omitempty"` + DisplayName string `json:"displayName"` + HostFormat HostFormatType `json:"hostFormat"` + IsRegional *bool `json:"isRegional,omitempty"` + Protocol ProtocolType `json:"protocol"` + SessionMode SessionModeType `json:"sessionMode"` + SyntaxFormat SyntaxFormatType `json:"syntaxFormat"` + TlsAuthentication *TlsAuthenticationType `json:"tlsAuthentication,omitempty"` + Value string `json:"value"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_restoreautonomousdatabasedetails.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_restoreautonomousdatabasedetails.go new file mode 100644 index 00000000000..62563f3bd97 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_restoreautonomousdatabasedetails.go @@ -0,0 +1,23 @@ +package autonomousdatabases + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestoreAutonomousDatabaseDetails struct { + Timestamp string `json:"timestamp"` +} + +func (o *RestoreAutonomousDatabaseDetails) GetTimestampAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.Timestamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *RestoreAutonomousDatabaseDetails) SetTimestampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Timestamp = formatted +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_scheduledoperationstype.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_scheduledoperationstype.go new file mode 100644 index 00000000000..c8ddec8547e --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_scheduledoperationstype.go @@ -0,0 +1,10 @@ +package autonomousdatabases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduledOperationsType struct { + DayOfWeek DayOfWeek `json:"dayOfWeek"` + ScheduledStartTime *string `json:"scheduledStartTime,omitempty"` + ScheduledStopTime *string `json:"scheduledStopTime,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_scheduledoperationstypeupdate.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_scheduledoperationstypeupdate.go new file mode 100644 index 00000000000..d0ce963fa63 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/model_scheduledoperationstypeupdate.go @@ -0,0 +1,10 @@ +package autonomousdatabases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduledOperationsTypeUpdate struct { + DayOfWeek *DayOfWeekUpdate `json:"dayOfWeek,omitempty"` + ScheduledStartTime *string `json:"scheduledStartTime,omitempty"` + ScheduledStopTime *string `json:"scheduledStopTime,omitempty"` +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/predicates.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/predicates.go similarity index 58% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/predicates.go rename to resource-manager/oracledatabase/2025-09-01/autonomousdatabases/predicates.go index 92b0067d35e..30749532d68 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/predicates.go +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/predicates.go @@ -1,27 +1,22 @@ -package backupprotecteditems +package autonomousdatabases // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type ProtectedItemResourceOperationPredicate struct { - ETag *string +type AutonomousDatabaseOperationPredicate struct { Id *string Location *string Name *string Type *string } -func (p ProtectedItemResourceOperationPredicate) Matches(input ProtectedItemResource) bool { - - if p.ETag != nil && (input.ETag == nil || *p.ETag != *input.ETag) { - return false - } +func (p AutonomousDatabaseOperationPredicate) Matches(input AutonomousDatabase) bool { if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { return false } - if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + if p.Location != nil && *p.Location != input.Location { return false } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/version.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/version.go similarity index 58% rename from resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/version.go rename to resource-manager/oracledatabase/2025-09-01/autonomousdatabases/version.go index 39364305077..60eae08f78d 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/version.go +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabases/version.go @@ -1,10 +1,10 @@ -package fetchtieringcost +package autonomousdatabases // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2025-02-01" +const defaultApiVersion = "2025-09-01" func userAgent() string { - return "hashicorp/go-azure-sdk/fetchtieringcost/2025-02-01" + return "hashicorp/go-azure-sdk/autonomousdatabases/2025-09-01" } diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/README.md b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/README.md new file mode 100644 index 00000000000..9776954e586 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions` Documentation + +The `autonomousdatabaseversions` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions" +``` + + +### Client Initialization + +```go +client := autonomousdatabaseversions.NewAutonomousDatabaseVersionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AutonomousDatabaseVersionsClient.Get` + +```go +ctx := context.TODO() +id := autonomousdatabaseversions.NewAutonomousDbVersionID("12345678-1234-9876-4563-123456789012", "locationName", "autonomousDbVersionName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AutonomousDatabaseVersionsClient.ListByLocation` + +```go +ctx := context.TODO() +id := autonomousdatabaseversions.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +// alternatively `client.ListByLocation(ctx, id)` can be used to do batched pagination +items, err := client.ListByLocationComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/client.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/client.go new file mode 100644 index 00000000000..3325a3c3154 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/client.go @@ -0,0 +1,26 @@ +package autonomousdatabaseversions + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDatabaseVersionsClient struct { + Client *resourcemanager.Client +} + +func NewAutonomousDatabaseVersionsClientWithBaseURI(sdkApi sdkEnv.Api) (*AutonomousDatabaseVersionsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "autonomousdatabaseversions", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AutonomousDatabaseVersionsClient: %+v", err) + } + + return &AutonomousDatabaseVersionsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/constants.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/constants.go new file mode 100644 index 00000000000..f4d7200f6ed --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/constants.go @@ -0,0 +1,57 @@ +package autonomousdatabaseversions + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkloadType string + +const ( + WorkloadTypeAJD WorkloadType = "AJD" + WorkloadTypeAPEX WorkloadType = "APEX" + WorkloadTypeDW WorkloadType = "DW" + WorkloadTypeOLTP WorkloadType = "OLTP" +) + +func PossibleValuesForWorkloadType() []string { + return []string{ + string(WorkloadTypeAJD), + string(WorkloadTypeAPEX), + string(WorkloadTypeDW), + string(WorkloadTypeOLTP), + } +} + +func (s *WorkloadType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWorkloadType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWorkloadType(input string) (*WorkloadType, error) { + vals := map[string]WorkloadType{ + "ajd": WorkloadTypeAJD, + "apex": WorkloadTypeAPEX, + "dw": WorkloadTypeDW, + "oltp": WorkloadTypeOLTP, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WorkloadType(input) + return &out, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/id_autonomousdbversion.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/id_autonomousdbversion.go new file mode 100644 index 00000000000..ffb6dbab6db --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/id_autonomousdbversion.go @@ -0,0 +1,130 @@ +package autonomousdatabaseversions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&AutonomousDbVersionId{}) +} + +var _ resourceids.ResourceId = &AutonomousDbVersionId{} + +// AutonomousDbVersionId is a struct representing the Resource ID for a Autonomous Db Version +type AutonomousDbVersionId struct { + SubscriptionId string + LocationName string + AutonomousDbVersionName string +} + +// NewAutonomousDbVersionID returns a new AutonomousDbVersionId struct +func NewAutonomousDbVersionID(subscriptionId string, locationName string, autonomousDbVersionName string) AutonomousDbVersionId { + return AutonomousDbVersionId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + AutonomousDbVersionName: autonomousDbVersionName, + } +} + +// ParseAutonomousDbVersionID parses 'input' into a AutonomousDbVersionId +func ParseAutonomousDbVersionID(input string) (*AutonomousDbVersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&AutonomousDbVersionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AutonomousDbVersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseAutonomousDbVersionIDInsensitively parses 'input' case-insensitively into a AutonomousDbVersionId +// note: this method should only be used for API response data and not user input +func ParseAutonomousDbVersionIDInsensitively(input string) (*AutonomousDbVersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&AutonomousDbVersionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AutonomousDbVersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AutonomousDbVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.AutonomousDbVersionName, ok = input.Parsed["autonomousDbVersionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "autonomousDbVersionName", input) + } + + return nil +} + +// ValidateAutonomousDbVersionID checks that 'input' can be parsed as a Autonomous Db Version ID +func ValidateAutonomousDbVersionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAutonomousDbVersionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Autonomous Db Version ID +func (id AutonomousDbVersionId) ID() string { + fmtString := "/subscriptions/%s/providers/Oracle.Database/locations/%s/autonomousDbVersions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.AutonomousDbVersionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Autonomous Db Version ID +func (id AutonomousDbVersionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticAutonomousDbVersions", "autonomousDbVersions", "autonomousDbVersions"), + resourceids.UserSpecifiedSegment("autonomousDbVersionName", "autonomousDbVersionName"), + } +} + +// String returns a human-readable description of this Autonomous Db Version ID +func (id AutonomousDbVersionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Autonomous Db Version Name: %q", id.AutonomousDbVersionName), + } + return fmt.Sprintf("Autonomous Db Version (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/id_autonomousdbversion_test.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/id_autonomousdbversion_test.go new file mode 100644 index 00000000000..a7b8b99ea35 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/id_autonomousdbversion_test.go @@ -0,0 +1,282 @@ +package autonomousdatabaseversions + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &AutonomousDbVersionId{} + +func TestNewAutonomousDbVersionID(t *testing.T) { + id := NewAutonomousDbVersionID("12345678-1234-9876-4563-123456789012", "locationName", "autonomousDbVersionName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.AutonomousDbVersionName != "autonomousDbVersionName" { + t.Fatalf("Expected %q but got %q for Segment 'AutonomousDbVersionName'", id.AutonomousDbVersionName, "autonomousDbVersionName") + } +} + +func TestFormatAutonomousDbVersionID(t *testing.T) { + actual := NewAutonomousDbVersionID("12345678-1234-9876-4563-123456789012", "locationName", "autonomousDbVersionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/autonomousDbVersions/autonomousDbVersionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseAutonomousDbVersionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AutonomousDbVersionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/autonomousDbVersions", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/autonomousDbVersions/autonomousDbVersionName", + Expected: &AutonomousDbVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + AutonomousDbVersionName: "autonomousDbVersionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/autonomousDbVersions/autonomousDbVersionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAutonomousDbVersionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.AutonomousDbVersionName != v.Expected.AutonomousDbVersionName { + t.Fatalf("Expected %q but got %q for AutonomousDbVersionName", v.Expected.AutonomousDbVersionName, actual.AutonomousDbVersionName) + } + + } +} + +func TestParseAutonomousDbVersionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AutonomousDbVersionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/autonomousDbVersions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/aUtOnOmOuSdBvErSiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/autonomousDbVersions/autonomousDbVersionName", + Expected: &AutonomousDbVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + AutonomousDbVersionName: "autonomousDbVersionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/autonomousDbVersions/autonomousDbVersionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/aUtOnOmOuSdBvErSiOnS/aUtOnOmOuSdBvErSiOnNaMe", + Expected: &AutonomousDbVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + AutonomousDbVersionName: "aUtOnOmOuSdBvErSiOnNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/aUtOnOmOuSdBvErSiOnS/aUtOnOmOuSdBvErSiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAutonomousDbVersionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.AutonomousDbVersionName != v.Expected.AutonomousDbVersionName { + t.Fatalf("Expected %q but got %q for AutonomousDbVersionName", v.Expected.AutonomousDbVersionName, actual.AutonomousDbVersionName) + } + + } +} + +func TestSegmentsForAutonomousDbVersionId(t *testing.T) { + segments := AutonomousDbVersionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("AutonomousDbVersionId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/id_location.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/id_location.go new file mode 100644 index 00000000000..c084011e456 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/id_location.go @@ -0,0 +1,121 @@ +package autonomousdatabaseversions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&LocationId{}) +} + +var _ resourceids.ResourceId = &LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + LocationName string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, locationName string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Oracle.Database/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/id_location_test.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/id_location_test.go new file mode 100644 index 00000000000..de8e1f63da7 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/id_location_test.go @@ -0,0 +1,237 @@ +package autonomousdatabaseversions + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &LocationId{} + +func TestNewLocationID(t *testing.T) { + id := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } +} + +func TestFormatLocationID(t *testing.T) { + actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseLocationID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LocationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseLocationID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestParseLocationIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LocationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseLocationIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestSegmentsForLocationId(t *testing.T) { + segments := LocationId{}.Segments() + if len(segments) == 0 { + t.Fatalf("LocationId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/method_get.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/method_get.go new file mode 100644 index 00000000000..33a2e2933ed --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/method_get.go @@ -0,0 +1,53 @@ +package autonomousdatabaseversions + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AutonomousDbVersion +} + +// Get ... +func (c AutonomousDatabaseVersionsClient) Get(ctx context.Context, id AutonomousDbVersionId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model AutonomousDbVersion + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/method_listbylocation.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/method_listbylocation.go new file mode 100644 index 00000000000..3568f7d2e00 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/method_listbylocation.go @@ -0,0 +1,105 @@ +package autonomousdatabaseversions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByLocationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AutonomousDbVersion +} + +type ListByLocationCompleteResult struct { + LatestHttpResponse *http.Response + Items []AutonomousDbVersion +} + +type ListByLocationCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByLocationCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByLocation ... +func (c AutonomousDatabaseVersionsClient) ListByLocation(ctx context.Context, id LocationId) (result ListByLocationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByLocationCustomPager{}, + Path: fmt.Sprintf("%s/autonomousDbVersions", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]AutonomousDbVersion `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByLocationComplete retrieves all the results into a single object +func (c AutonomousDatabaseVersionsClient) ListByLocationComplete(ctx context.Context, id LocationId) (ListByLocationCompleteResult, error) { + return c.ListByLocationCompleteMatchingPredicate(ctx, id, AutonomousDbVersionOperationPredicate{}) +} + +// ListByLocationCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AutonomousDatabaseVersionsClient) ListByLocationCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate AutonomousDbVersionOperationPredicate) (result ListByLocationCompleteResult, err error) { + items := make([]AutonomousDbVersion, 0) + + resp, err := c.ListByLocation(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByLocationCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/model_autonomousdbversion.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/model_autonomousdbversion.go new file mode 100644 index 00000000000..d637e754ddf --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/model_autonomousdbversion.go @@ -0,0 +1,16 @@ +package autonomousdatabaseversions + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDbVersion struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AutonomousDbVersionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/model_autonomousdbversionproperties.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/model_autonomousdbversionproperties.go new file mode 100644 index 00000000000..a3d0639949b --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/model_autonomousdbversionproperties.go @@ -0,0 +1,13 @@ +package autonomousdatabaseversions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDbVersionProperties struct { + DbWorkload *WorkloadType `json:"dbWorkload,omitempty"` + IsDefaultForFree *bool `json:"isDefaultForFree,omitempty"` + IsDefaultForPaid *bool `json:"isDefaultForPaid,omitempty"` + IsFreeTierEnabled *bool `json:"isFreeTierEnabled,omitempty"` + IsPaidEnabled *bool `json:"isPaidEnabled,omitempty"` + Version string `json:"version"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/predicates.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/predicates.go new file mode 100644 index 00000000000..87d67558b5f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/predicates.go @@ -0,0 +1,27 @@ +package autonomousdatabaseversions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutonomousDbVersionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p AutonomousDbVersionOperationPredicate) Matches(input AutonomousDbVersion) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/version.go b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/version.go similarity index 56% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/version.go rename to resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/version.go index 1bd1d0d2e23..05b978325d0 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/version.go +++ b/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions/version.go @@ -1,10 +1,10 @@ -package backupprotectioncontainers +package autonomousdatabaseversions // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2025-02-01" +const defaultApiVersion = "2025-09-01" func userAgent() string { - return "hashicorp/go-azure-sdk/backupprotectioncontainers/2025-02-01" + return "hashicorp/go-azure-sdk/autonomousdatabaseversions/2025-09-01" } diff --git a/resource-manager/oracledatabase/2025-09-01/client.go b/resource-manager/oracledatabase/2025-09-01/client.go new file mode 100644 index 00000000000..a2672d1701f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/client.go @@ -0,0 +1,244 @@ +package v2025_09_01 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/autonomousdatabasebackups" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/autonomousdatabasecharactersets" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/autonomousdatabasenationalcharactersets" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/autonomousdatabases" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/autonomousdatabaseversions" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/cloudvmclusters" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/dbnodes" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/dbservers" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/dbsystems" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/dbsystemshapes" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/dbversions" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/dnsprivateviews" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/dnsprivatezones" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/exadbvmclusters" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/exascaledbnodes" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/flexcomponents" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/giminorversions" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/giversions" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/networkanchors" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/resourceanchors" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/systemversions" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +type Client struct { + AutonomousDatabaseBackups *autonomousdatabasebackups.AutonomousDatabaseBackupsClient + AutonomousDatabaseCharacterSets *autonomousdatabasecharactersets.AutonomousDatabaseCharacterSetsClient + AutonomousDatabaseNationalCharacterSets *autonomousdatabasenationalcharactersets.AutonomousDatabaseNationalCharacterSetsClient + AutonomousDatabaseVersions *autonomousdatabaseversions.AutonomousDatabaseVersionsClient + AutonomousDatabases *autonomousdatabases.AutonomousDatabasesClient + CloudExadataInfrastructures *cloudexadatainfrastructures.CloudExadataInfrastructuresClient + CloudVMClusters *cloudvmclusters.CloudVMClustersClient + DbNodes *dbnodes.DbNodesClient + DbServers *dbservers.DbServersClient + DbSystemShapes *dbsystemshapes.DbSystemShapesClient + DbSystems *dbsystems.DbSystemsClient + DbVersions *dbversions.DbVersionsClient + DnsPrivateViews *dnsprivateviews.DnsPrivateViewsClient + DnsPrivateZones *dnsprivatezones.DnsPrivateZonesClient + ExadbVMClusters *exadbvmclusters.ExadbVMClustersClient + ExascaleDbNodes *exascaledbnodes.ExascaleDbNodesClient + ExascaleDbStorageVaults *exascaledbstoragevaults.ExascaleDbStorageVaultsClient + FlexComponents *flexcomponents.FlexComponentsClient + GiMinorVersions *giminorversions.GiMinorVersionsClient + GiVersions *giversions.GiVersionsClient + NetworkAnchors *networkanchors.NetworkAnchorsClient + OracleSubscriptions *oraclesubscriptions.OracleSubscriptionsClient + ResourceAnchors *resourceanchors.ResourceAnchorsClient + SystemVersions *systemversions.SystemVersionsClient + VirtualNetworkAddresses *virtualnetworkaddresses.VirtualNetworkAddressesClient +} + +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + autonomousDatabaseBackupsClient, err := autonomousdatabasebackups.NewAutonomousDatabaseBackupsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building AutonomousDatabaseBackups client: %+v", err) + } + configureFunc(autonomousDatabaseBackupsClient.Client) + + autonomousDatabaseCharacterSetsClient, err := autonomousdatabasecharactersets.NewAutonomousDatabaseCharacterSetsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building AutonomousDatabaseCharacterSets client: %+v", err) + } + configureFunc(autonomousDatabaseCharacterSetsClient.Client) + + autonomousDatabaseNationalCharacterSetsClient, err := autonomousdatabasenationalcharactersets.NewAutonomousDatabaseNationalCharacterSetsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building AutonomousDatabaseNationalCharacterSets client: %+v", err) + } + configureFunc(autonomousDatabaseNationalCharacterSetsClient.Client) + + autonomousDatabaseVersionsClient, err := autonomousdatabaseversions.NewAutonomousDatabaseVersionsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building AutonomousDatabaseVersions client: %+v", err) + } + configureFunc(autonomousDatabaseVersionsClient.Client) + + autonomousDatabasesClient, err := autonomousdatabases.NewAutonomousDatabasesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building AutonomousDatabases client: %+v", err) + } + configureFunc(autonomousDatabasesClient.Client) + + cloudExadataInfrastructuresClient, err := cloudexadatainfrastructures.NewCloudExadataInfrastructuresClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building CloudExadataInfrastructures client: %+v", err) + } + configureFunc(cloudExadataInfrastructuresClient.Client) + + cloudVMClustersClient, err := cloudvmclusters.NewCloudVMClustersClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building CloudVMClusters client: %+v", err) + } + configureFunc(cloudVMClustersClient.Client) + + dbNodesClient, err := dbnodes.NewDbNodesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building DbNodes client: %+v", err) + } + configureFunc(dbNodesClient.Client) + + dbServersClient, err := dbservers.NewDbServersClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building DbServers client: %+v", err) + } + configureFunc(dbServersClient.Client) + + dbSystemShapesClient, err := dbsystemshapes.NewDbSystemShapesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building DbSystemShapes client: %+v", err) + } + configureFunc(dbSystemShapesClient.Client) + + dbSystemsClient, err := dbsystems.NewDbSystemsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building DbSystems client: %+v", err) + } + configureFunc(dbSystemsClient.Client) + + dbVersionsClient, err := dbversions.NewDbVersionsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building DbVersions client: %+v", err) + } + configureFunc(dbVersionsClient.Client) + + dnsPrivateViewsClient, err := dnsprivateviews.NewDnsPrivateViewsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building DnsPrivateViews client: %+v", err) + } + configureFunc(dnsPrivateViewsClient.Client) + + dnsPrivateZonesClient, err := dnsprivatezones.NewDnsPrivateZonesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building DnsPrivateZones client: %+v", err) + } + configureFunc(dnsPrivateZonesClient.Client) + + exadbVMClustersClient, err := exadbvmclusters.NewExadbVMClustersClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ExadbVMClusters client: %+v", err) + } + configureFunc(exadbVMClustersClient.Client) + + exascaleDbNodesClient, err := exascaledbnodes.NewExascaleDbNodesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ExascaleDbNodes client: %+v", err) + } + configureFunc(exascaleDbNodesClient.Client) + + exascaleDbStorageVaultsClient, err := exascaledbstoragevaults.NewExascaleDbStorageVaultsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ExascaleDbStorageVaults client: %+v", err) + } + configureFunc(exascaleDbStorageVaultsClient.Client) + + flexComponentsClient, err := flexcomponents.NewFlexComponentsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building FlexComponents client: %+v", err) + } + configureFunc(flexComponentsClient.Client) + + giMinorVersionsClient, err := giminorversions.NewGiMinorVersionsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building GiMinorVersions client: %+v", err) + } + configureFunc(giMinorVersionsClient.Client) + + giVersionsClient, err := giversions.NewGiVersionsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building GiVersions client: %+v", err) + } + configureFunc(giVersionsClient.Client) + + networkAnchorsClient, err := networkanchors.NewNetworkAnchorsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building NetworkAnchors client: %+v", err) + } + configureFunc(networkAnchorsClient.Client) + + oracleSubscriptionsClient, err := oraclesubscriptions.NewOracleSubscriptionsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building OracleSubscriptions client: %+v", err) + } + configureFunc(oracleSubscriptionsClient.Client) + + resourceAnchorsClient, err := resourceanchors.NewResourceAnchorsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ResourceAnchors client: %+v", err) + } + configureFunc(resourceAnchorsClient.Client) + + systemVersionsClient, err := systemversions.NewSystemVersionsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building SystemVersions client: %+v", err) + } + configureFunc(systemVersionsClient.Client) + + virtualNetworkAddressesClient, err := virtualnetworkaddresses.NewVirtualNetworkAddressesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualNetworkAddresses client: %+v", err) + } + configureFunc(virtualNetworkAddressesClient.Client) + + return &Client{ + AutonomousDatabaseBackups: autonomousDatabaseBackupsClient, + AutonomousDatabaseCharacterSets: autonomousDatabaseCharacterSetsClient, + AutonomousDatabaseNationalCharacterSets: autonomousDatabaseNationalCharacterSetsClient, + AutonomousDatabaseVersions: autonomousDatabaseVersionsClient, + AutonomousDatabases: autonomousDatabasesClient, + CloudExadataInfrastructures: cloudExadataInfrastructuresClient, + CloudVMClusters: cloudVMClustersClient, + DbNodes: dbNodesClient, + DbServers: dbServersClient, + DbSystemShapes: dbSystemShapesClient, + DbSystems: dbSystemsClient, + DbVersions: dbVersionsClient, + DnsPrivateViews: dnsPrivateViewsClient, + DnsPrivateZones: dnsPrivateZonesClient, + ExadbVMClusters: exadbVMClustersClient, + ExascaleDbNodes: exascaleDbNodesClient, + ExascaleDbStorageVaults: exascaleDbStorageVaultsClient, + FlexComponents: flexComponentsClient, + GiMinorVersions: giMinorVersionsClient, + GiVersions: giVersionsClient, + NetworkAnchors: networkAnchorsClient, + OracleSubscriptions: oracleSubscriptionsClient, + ResourceAnchors: resourceAnchorsClient, + SystemVersions: systemVersionsClient, + VirtualNetworkAddresses: virtualNetworkAddressesClient, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/README.md b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/README.md new file mode 100644 index 00000000000..91deaaf5692 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/README.md @@ -0,0 +1,146 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures` Documentation + +The `cloudexadatainfrastructures` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures" +``` + + +### Client Initialization + +```go +client := cloudexadatainfrastructures.NewCloudExadataInfrastructuresClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CloudExadataInfrastructuresClient.AddStorageCapacity` + +```go +ctx := context.TODO() +id := cloudexadatainfrastructures.NewCloudExadataInfrastructureID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudExadataInfrastructureName") + +if err := client.AddStorageCapacityThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `CloudExadataInfrastructuresClient.ConfigureExascale` + +```go +ctx := context.TODO() +id := cloudexadatainfrastructures.NewCloudExadataInfrastructureID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudExadataInfrastructureName") + +payload := cloudexadatainfrastructures.ConfigureExascaleCloudExadataInfrastructureDetails{ + // ... +} + + +if err := client.ConfigureExascaleThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `CloudExadataInfrastructuresClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := cloudexadatainfrastructures.NewCloudExadataInfrastructureID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudExadataInfrastructureName") + +payload := cloudexadatainfrastructures.CloudExadataInfrastructure{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `CloudExadataInfrastructuresClient.Delete` + +```go +ctx := context.TODO() +id := cloudexadatainfrastructures.NewCloudExadataInfrastructureID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudExadataInfrastructureName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `CloudExadataInfrastructuresClient.Get` + +```go +ctx := context.TODO() +id := cloudexadatainfrastructures.NewCloudExadataInfrastructureID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudExadataInfrastructureName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CloudExadataInfrastructuresClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CloudExadataInfrastructuresClient.ListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CloudExadataInfrastructuresClient.Update` + +```go +ctx := context.TODO() +id := cloudexadatainfrastructures.NewCloudExadataInfrastructureID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudExadataInfrastructureName") + +payload := cloudexadatainfrastructures.CloudExadataInfrastructureUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/client.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/client.go new file mode 100644 index 00000000000..b730c46ae8b --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/client.go @@ -0,0 +1,26 @@ +package cloudexadatainfrastructures + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudExadataInfrastructuresClient struct { + Client *resourcemanager.Client +} + +func NewCloudExadataInfrastructuresClientWithBaseURI(sdkApi sdkEnv.Api) (*CloudExadataInfrastructuresClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "cloudexadatainfrastructures", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CloudExadataInfrastructuresClient: %+v", err) + } + + return &CloudExadataInfrastructuresClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/constants.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/constants.go new file mode 100644 index 00000000000..2fed3652ed8 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/constants.go @@ -0,0 +1,363 @@ +package cloudexadatainfrastructures + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureResourceProvisioningState string + +const ( + AzureResourceProvisioningStateCanceled AzureResourceProvisioningState = "Canceled" + AzureResourceProvisioningStateFailed AzureResourceProvisioningState = "Failed" + AzureResourceProvisioningStateProvisioning AzureResourceProvisioningState = "Provisioning" + AzureResourceProvisioningStateSucceeded AzureResourceProvisioningState = "Succeeded" +) + +func PossibleValuesForAzureResourceProvisioningState() []string { + return []string{ + string(AzureResourceProvisioningStateCanceled), + string(AzureResourceProvisioningStateFailed), + string(AzureResourceProvisioningStateProvisioning), + string(AzureResourceProvisioningStateSucceeded), + } +} + +func (s *AzureResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAzureResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAzureResourceProvisioningState(input string) (*AzureResourceProvisioningState, error) { + vals := map[string]AzureResourceProvisioningState{ + "canceled": AzureResourceProvisioningStateCanceled, + "failed": AzureResourceProvisioningStateFailed, + "provisioning": AzureResourceProvisioningStateProvisioning, + "succeeded": AzureResourceProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AzureResourceProvisioningState(input) + return &out, nil +} + +type CloudExadataInfrastructureLifecycleState string + +const ( + CloudExadataInfrastructureLifecycleStateAvailable CloudExadataInfrastructureLifecycleState = "Available" + CloudExadataInfrastructureLifecycleStateFailed CloudExadataInfrastructureLifecycleState = "Failed" + CloudExadataInfrastructureLifecycleStateMaintenanceInProgress CloudExadataInfrastructureLifecycleState = "MaintenanceInProgress" + CloudExadataInfrastructureLifecycleStateProvisioning CloudExadataInfrastructureLifecycleState = "Provisioning" + CloudExadataInfrastructureLifecycleStateTerminated CloudExadataInfrastructureLifecycleState = "Terminated" + CloudExadataInfrastructureLifecycleStateTerminating CloudExadataInfrastructureLifecycleState = "Terminating" + CloudExadataInfrastructureLifecycleStateUpdating CloudExadataInfrastructureLifecycleState = "Updating" +) + +func PossibleValuesForCloudExadataInfrastructureLifecycleState() []string { + return []string{ + string(CloudExadataInfrastructureLifecycleStateAvailable), + string(CloudExadataInfrastructureLifecycleStateFailed), + string(CloudExadataInfrastructureLifecycleStateMaintenanceInProgress), + string(CloudExadataInfrastructureLifecycleStateProvisioning), + string(CloudExadataInfrastructureLifecycleStateTerminated), + string(CloudExadataInfrastructureLifecycleStateTerminating), + string(CloudExadataInfrastructureLifecycleStateUpdating), + } +} + +func (s *CloudExadataInfrastructureLifecycleState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCloudExadataInfrastructureLifecycleState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCloudExadataInfrastructureLifecycleState(input string) (*CloudExadataInfrastructureLifecycleState, error) { + vals := map[string]CloudExadataInfrastructureLifecycleState{ + "available": CloudExadataInfrastructureLifecycleStateAvailable, + "failed": CloudExadataInfrastructureLifecycleStateFailed, + "maintenanceinprogress": CloudExadataInfrastructureLifecycleStateMaintenanceInProgress, + "provisioning": CloudExadataInfrastructureLifecycleStateProvisioning, + "terminated": CloudExadataInfrastructureLifecycleStateTerminated, + "terminating": CloudExadataInfrastructureLifecycleStateTerminating, + "updating": CloudExadataInfrastructureLifecycleStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CloudExadataInfrastructureLifecycleState(input) + return &out, nil +} + +type ComputeModel string + +const ( + ComputeModelECPU ComputeModel = "ECPU" + ComputeModelOCPU ComputeModel = "OCPU" +) + +func PossibleValuesForComputeModel() []string { + return []string{ + string(ComputeModelECPU), + string(ComputeModelOCPU), + } +} + +func (s *ComputeModel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseComputeModel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseComputeModel(input string) (*ComputeModel, error) { + vals := map[string]ComputeModel{ + "ecpu": ComputeModelECPU, + "ocpu": ComputeModelOCPU, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComputeModel(input) + return &out, nil +} + +type DayOfWeekName string + +const ( + DayOfWeekNameFriday DayOfWeekName = "Friday" + DayOfWeekNameMonday DayOfWeekName = "Monday" + DayOfWeekNameSaturday DayOfWeekName = "Saturday" + DayOfWeekNameSunday DayOfWeekName = "Sunday" + DayOfWeekNameThursday DayOfWeekName = "Thursday" + DayOfWeekNameTuesday DayOfWeekName = "Tuesday" + DayOfWeekNameWednesday DayOfWeekName = "Wednesday" +) + +func PossibleValuesForDayOfWeekName() []string { + return []string{ + string(DayOfWeekNameFriday), + string(DayOfWeekNameMonday), + string(DayOfWeekNameSaturday), + string(DayOfWeekNameSunday), + string(DayOfWeekNameThursday), + string(DayOfWeekNameTuesday), + string(DayOfWeekNameWednesday), + } +} + +func (s *DayOfWeekName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDayOfWeekName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDayOfWeekName(input string) (*DayOfWeekName, error) { + vals := map[string]DayOfWeekName{ + "friday": DayOfWeekNameFriday, + "monday": DayOfWeekNameMonday, + "saturday": DayOfWeekNameSaturday, + "sunday": DayOfWeekNameSunday, + "thursday": DayOfWeekNameThursday, + "tuesday": DayOfWeekNameTuesday, + "wednesday": DayOfWeekNameWednesday, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DayOfWeekName(input) + return &out, nil +} + +type MonthName string + +const ( + MonthNameApril MonthName = "April" + MonthNameAugust MonthName = "August" + MonthNameDecember MonthName = "December" + MonthNameFebruary MonthName = "February" + MonthNameJanuary MonthName = "January" + MonthNameJuly MonthName = "July" + MonthNameJune MonthName = "June" + MonthNameMarch MonthName = "March" + MonthNameMay MonthName = "May" + MonthNameNovember MonthName = "November" + MonthNameOctober MonthName = "October" + MonthNameSeptember MonthName = "September" +) + +func PossibleValuesForMonthName() []string { + return []string{ + string(MonthNameApril), + string(MonthNameAugust), + string(MonthNameDecember), + string(MonthNameFebruary), + string(MonthNameJanuary), + string(MonthNameJuly), + string(MonthNameJune), + string(MonthNameMarch), + string(MonthNameMay), + string(MonthNameNovember), + string(MonthNameOctober), + string(MonthNameSeptember), + } +} + +func (s *MonthName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMonthName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMonthName(input string) (*MonthName, error) { + vals := map[string]MonthName{ + "april": MonthNameApril, + "august": MonthNameAugust, + "december": MonthNameDecember, + "february": MonthNameFebruary, + "january": MonthNameJanuary, + "july": MonthNameJuly, + "june": MonthNameJune, + "march": MonthNameMarch, + "may": MonthNameMay, + "november": MonthNameNovember, + "october": MonthNameOctober, + "september": MonthNameSeptember, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MonthName(input) + return &out, nil +} + +type PatchingMode string + +const ( + PatchingModeNonRolling PatchingMode = "NonRolling" + PatchingModeRolling PatchingMode = "Rolling" +) + +func PossibleValuesForPatchingMode() []string { + return []string{ + string(PatchingModeNonRolling), + string(PatchingModeRolling), + } +} + +func (s *PatchingMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePatchingMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePatchingMode(input string) (*PatchingMode, error) { + vals := map[string]PatchingMode{ + "nonrolling": PatchingModeNonRolling, + "rolling": PatchingModeRolling, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PatchingMode(input) + return &out, nil +} + +type Preference string + +const ( + PreferenceCustomPreference Preference = "CustomPreference" + PreferenceNoPreference Preference = "NoPreference" +) + +func PossibleValuesForPreference() []string { + return []string{ + string(PreferenceCustomPreference), + string(PreferenceNoPreference), + } +} + +func (s *Preference) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePreference(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePreference(input string) (*Preference, error) { + vals := map[string]Preference{ + "custompreference": PreferenceCustomPreference, + "nopreference": PreferenceNoPreference, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Preference(input) + return &out, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/id_cloudexadatainfrastructure.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/id_cloudexadatainfrastructure.go new file mode 100644 index 00000000000..df189438489 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/id_cloudexadatainfrastructure.go @@ -0,0 +1,130 @@ +package cloudexadatainfrastructures + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&CloudExadataInfrastructureId{}) +} + +var _ resourceids.ResourceId = &CloudExadataInfrastructureId{} + +// CloudExadataInfrastructureId is a struct representing the Resource ID for a Cloud Exadata Infrastructure +type CloudExadataInfrastructureId struct { + SubscriptionId string + ResourceGroupName string + CloudExadataInfrastructureName string +} + +// NewCloudExadataInfrastructureID returns a new CloudExadataInfrastructureId struct +func NewCloudExadataInfrastructureID(subscriptionId string, resourceGroupName string, cloudExadataInfrastructureName string) CloudExadataInfrastructureId { + return CloudExadataInfrastructureId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CloudExadataInfrastructureName: cloudExadataInfrastructureName, + } +} + +// ParseCloudExadataInfrastructureID parses 'input' into a CloudExadataInfrastructureId +func ParseCloudExadataInfrastructureID(input string) (*CloudExadataInfrastructureId, error) { + parser := resourceids.NewParserFromResourceIdType(&CloudExadataInfrastructureId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CloudExadataInfrastructureId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCloudExadataInfrastructureIDInsensitively parses 'input' case-insensitively into a CloudExadataInfrastructureId +// note: this method should only be used for API response data and not user input +func ParseCloudExadataInfrastructureIDInsensitively(input string) (*CloudExadataInfrastructureId, error) { + parser := resourceids.NewParserFromResourceIdType(&CloudExadataInfrastructureId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CloudExadataInfrastructureId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CloudExadataInfrastructureId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.CloudExadataInfrastructureName, ok = input.Parsed["cloudExadataInfrastructureName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudExadataInfrastructureName", input) + } + + return nil +} + +// ValidateCloudExadataInfrastructureID checks that 'input' can be parsed as a Cloud Exadata Infrastructure ID +func ValidateCloudExadataInfrastructureID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseCloudExadataInfrastructureID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cloud Exadata Infrastructure ID +func (id CloudExadataInfrastructureId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Oracle.Database/cloudExadataInfrastructures/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CloudExadataInfrastructureName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cloud Exadata Infrastructure ID +func (id CloudExadataInfrastructureId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticCloudExadataInfrastructures", "cloudExadataInfrastructures", "cloudExadataInfrastructures"), + resourceids.UserSpecifiedSegment("cloudExadataInfrastructureName", "cloudExadataInfrastructureName"), + } +} + +// String returns a human-readable description of this Cloud Exadata Infrastructure ID +func (id CloudExadataInfrastructureId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cloud Exadata Infrastructure Name: %q", id.CloudExadataInfrastructureName), + } + return fmt.Sprintf("Cloud Exadata Infrastructure (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/id_cloudexadatainfrastructure_test.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/id_cloudexadatainfrastructure_test.go new file mode 100644 index 00000000000..b08cf137c5a --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/id_cloudexadatainfrastructure_test.go @@ -0,0 +1,282 @@ +package cloudexadatainfrastructures + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &CloudExadataInfrastructureId{} + +func TestNewCloudExadataInfrastructureID(t *testing.T) { + id := NewCloudExadataInfrastructureID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudExadataInfrastructureName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.CloudExadataInfrastructureName != "cloudExadataInfrastructureName" { + t.Fatalf("Expected %q but got %q for Segment 'CloudExadataInfrastructureName'", id.CloudExadataInfrastructureName, "cloudExadataInfrastructureName") + } +} + +func TestFormatCloudExadataInfrastructureID(t *testing.T) { + actual := NewCloudExadataInfrastructureID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudExadataInfrastructureName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures/cloudExadataInfrastructureName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseCloudExadataInfrastructureID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CloudExadataInfrastructureId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures/cloudExadataInfrastructureName", + Expected: &CloudExadataInfrastructureId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CloudExadataInfrastructureName: "cloudExadataInfrastructureName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures/cloudExadataInfrastructureName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCloudExadataInfrastructureID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.CloudExadataInfrastructureName != v.Expected.CloudExadataInfrastructureName { + t.Fatalf("Expected %q but got %q for CloudExadataInfrastructureName", v.Expected.CloudExadataInfrastructureName, actual.CloudExadataInfrastructureName) + } + + } +} + +func TestParseCloudExadataInfrastructureIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CloudExadataInfrastructureId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdExAdAtAiNfRaStRuCtUrEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures/cloudExadataInfrastructureName", + Expected: &CloudExadataInfrastructureId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CloudExadataInfrastructureName: "cloudExadataInfrastructureName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures/cloudExadataInfrastructureName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdExAdAtAiNfRaStRuCtUrEs/cLoUdExAdAtAiNfRaStRuCtUrEnAmE", + Expected: &CloudExadataInfrastructureId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + CloudExadataInfrastructureName: "cLoUdExAdAtAiNfRaStRuCtUrEnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdExAdAtAiNfRaStRuCtUrEs/cLoUdExAdAtAiNfRaStRuCtUrEnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCloudExadataInfrastructureIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.CloudExadataInfrastructureName != v.Expected.CloudExadataInfrastructureName { + t.Fatalf("Expected %q but got %q for CloudExadataInfrastructureName", v.Expected.CloudExadataInfrastructureName, actual.CloudExadataInfrastructureName) + } + + } +} + +func TestSegmentsForCloudExadataInfrastructureId(t *testing.T) { + segments := CloudExadataInfrastructureId{}.Segments() + if len(segments) == 0 { + t.Fatalf("CloudExadataInfrastructureId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_addstoragecapacity.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_addstoragecapacity.go new file mode 100644 index 00000000000..7b5bda2d476 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_addstoragecapacity.go @@ -0,0 +1,71 @@ +package cloudexadatainfrastructures + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AddStorageCapacityOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *CloudExadataInfrastructure +} + +// AddStorageCapacity ... +func (c CloudExadataInfrastructuresClient) AddStorageCapacity(ctx context.Context, id CloudExadataInfrastructureId) (result AddStorageCapacityOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/addStorageCapacity", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// AddStorageCapacityThenPoll performs AddStorageCapacity then polls until it's completed +func (c CloudExadataInfrastructuresClient) AddStorageCapacityThenPoll(ctx context.Context, id CloudExadataInfrastructureId) error { + result, err := c.AddStorageCapacity(ctx, id) + if err != nil { + return fmt.Errorf("performing AddStorageCapacity: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AddStorageCapacity: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_configureexascale.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_configureexascale.go new file mode 100644 index 00000000000..f466582819a --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_configureexascale.go @@ -0,0 +1,75 @@ +package cloudexadatainfrastructures + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigureExascaleOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *CloudExadataInfrastructure +} + +// ConfigureExascale ... +func (c CloudExadataInfrastructuresClient) ConfigureExascale(ctx context.Context, id CloudExadataInfrastructureId, input ConfigureExascaleCloudExadataInfrastructureDetails) (result ConfigureExascaleOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/configureExascale", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ConfigureExascaleThenPoll performs ConfigureExascale then polls until it's completed +func (c CloudExadataInfrastructuresClient) ConfigureExascaleThenPoll(ctx context.Context, id CloudExadataInfrastructureId, input ConfigureExascaleCloudExadataInfrastructureDetails) error { + result, err := c.ConfigureExascale(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ConfigureExascale: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ConfigureExascale: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_createorupdate.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_createorupdate.go new file mode 100644 index 00000000000..75af32ddc64 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_createorupdate.go @@ -0,0 +1,75 @@ +package cloudexadatainfrastructures + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *CloudExadataInfrastructure +} + +// CreateOrUpdate ... +func (c CloudExadataInfrastructuresClient) CreateOrUpdate(ctx context.Context, id CloudExadataInfrastructureId, input CloudExadataInfrastructure) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c CloudExadataInfrastructuresClient) CreateOrUpdateThenPoll(ctx context.Context, id CloudExadataInfrastructureId, input CloudExadataInfrastructure) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_delete.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_delete.go new file mode 100644 index 00000000000..f8032ba6b03 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_delete.go @@ -0,0 +1,70 @@ +package cloudexadatainfrastructures + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c CloudExadataInfrastructuresClient) Delete(ctx context.Context, id CloudExadataInfrastructureId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c CloudExadataInfrastructuresClient) DeleteThenPoll(ctx context.Context, id CloudExadataInfrastructureId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_get.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_get.go new file mode 100644 index 00000000000..fc119da3dd9 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_get.go @@ -0,0 +1,53 @@ +package cloudexadatainfrastructures + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CloudExadataInfrastructure +} + +// Get ... +func (c CloudExadataInfrastructuresClient) Get(ctx context.Context, id CloudExadataInfrastructureId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model CloudExadataInfrastructure + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_listbyresourcegroup.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_listbyresourcegroup.go new file mode 100644 index 00000000000..2143b110959 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package cloudexadatainfrastructures + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]CloudExadataInfrastructure +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []CloudExadataInfrastructure +} + +type ListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByResourceGroup ... +func (c CloudExadataInfrastructuresClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Oracle.Database/cloudExadataInfrastructures", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]CloudExadataInfrastructure `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c CloudExadataInfrastructuresClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, CloudExadataInfrastructureOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CloudExadataInfrastructuresClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate CloudExadataInfrastructureOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]CloudExadataInfrastructure, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_listbysubscription.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_listbysubscription.go new file mode 100644 index 00000000000..a6d4a182303 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_listbysubscription.go @@ -0,0 +1,106 @@ +package cloudexadatainfrastructures + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]CloudExadataInfrastructure +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []CloudExadataInfrastructure +} + +type ListBySubscriptionCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListBySubscriptionCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListBySubscription ... +func (c CloudExadataInfrastructuresClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Oracle.Database/cloudExadataInfrastructures", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]CloudExadataInfrastructure `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c CloudExadataInfrastructuresClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, CloudExadataInfrastructureOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CloudExadataInfrastructuresClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate CloudExadataInfrastructureOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]CloudExadataInfrastructure, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_update.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_update.go new file mode 100644 index 00000000000..54e2aa254c5 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/method_update.go @@ -0,0 +1,75 @@ +package cloudexadatainfrastructures + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *CloudExadataInfrastructure +} + +// Update ... +func (c CloudExadataInfrastructuresClient) Update(ctx context.Context, id CloudExadataInfrastructureId, input CloudExadataInfrastructureUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c CloudExadataInfrastructuresClient) UpdateThenPoll(ctx context.Context, id CloudExadataInfrastructureId, input CloudExadataInfrastructureUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_cloudexadatainfrastructure.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_cloudexadatainfrastructure.go new file mode 100644 index 00000000000..93f4463e84f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_cloudexadatainfrastructure.go @@ -0,0 +1,20 @@ +package cloudexadatainfrastructures + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudExadataInfrastructure struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *CloudExadataInfrastructureProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones zones.Schema `json:"zones"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_cloudexadatainfrastructureproperties.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_cloudexadatainfrastructureproperties.go new file mode 100644 index 00000000000..04f447b2c4f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_cloudexadatainfrastructureproperties.go @@ -0,0 +1,43 @@ +package cloudexadatainfrastructures + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudExadataInfrastructureProperties struct { + ActivatedStorageCount *int64 `json:"activatedStorageCount,omitempty"` + AdditionalStorageCount *int64 `json:"additionalStorageCount,omitempty"` + AvailableStorageSizeInGbs *int64 `json:"availableStorageSizeInGbs,omitempty"` + ComputeCount *int64 `json:"computeCount,omitempty"` + ComputeModel *ComputeModel `json:"computeModel,omitempty"` + CpuCount *int64 `json:"cpuCount,omitempty"` + CustomerContacts *[]CustomerContact `json:"customerContacts,omitempty"` + DataStorageSizeInTbs *float64 `json:"dataStorageSizeInTbs,omitempty"` + DatabaseServerType *string `json:"databaseServerType,omitempty"` + DbNodeStorageSizeInGbs *int64 `json:"dbNodeStorageSizeInGbs,omitempty"` + DbServerVersion *string `json:"dbServerVersion,omitempty"` + DefinedFileSystemConfiguration *[]DefinedFileSystemConfiguration `json:"definedFileSystemConfiguration,omitempty"` + DisplayName string `json:"displayName"` + EstimatedPatchingTime *EstimatedPatchingTime `json:"estimatedPatchingTime,omitempty"` + ExascaleConfig *ExascaleConfigDetails `json:"exascaleConfig,omitempty"` + LastMaintenanceRunId *string `json:"lastMaintenanceRunId,omitempty"` + LifecycleDetails *string `json:"lifecycleDetails,omitempty"` + LifecycleState *CloudExadataInfrastructureLifecycleState `json:"lifecycleState,omitempty"` + MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"` + MaxCPUCount *int64 `json:"maxCpuCount,omitempty"` + MaxDataStorageInTbs *float64 `json:"maxDataStorageInTbs,omitempty"` + MaxDbNodeStorageSizeInGbs *int64 `json:"maxDbNodeStorageSizeInGbs,omitempty"` + MaxMemoryInGbs *int64 `json:"maxMemoryInGbs,omitempty"` + MemorySizeInGbs *int64 `json:"memorySizeInGbs,omitempty"` + MonthlyDbServerVersion *string `json:"monthlyDbServerVersion,omitempty"` + MonthlyStorageServerVersion *string `json:"monthlyStorageServerVersion,omitempty"` + NextMaintenanceRunId *string `json:"nextMaintenanceRunId,omitempty"` + OciURL *string `json:"ociUrl,omitempty"` + Ocid *string `json:"ocid,omitempty"` + ProvisioningState *AzureResourceProvisioningState `json:"provisioningState,omitempty"` + Shape string `json:"shape"` + StorageCount *int64 `json:"storageCount,omitempty"` + StorageServerType *string `json:"storageServerType,omitempty"` + StorageServerVersion *string `json:"storageServerVersion,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + TotalStorageSizeInGbs *int64 `json:"totalStorageSizeInGbs,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_cloudexadatainfrastructureupdate.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_cloudexadatainfrastructureupdate.go new file mode 100644 index 00000000000..606eb24be43 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_cloudexadatainfrastructureupdate.go @@ -0,0 +1,14 @@ +package cloudexadatainfrastructures + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudExadataInfrastructureUpdate struct { + Properties *CloudExadataInfrastructureUpdateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_cloudexadatainfrastructureupdateproperties.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_cloudexadatainfrastructureupdateproperties.go new file mode 100644 index 00000000000..d18c7da0d01 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_cloudexadatainfrastructureupdateproperties.go @@ -0,0 +1,12 @@ +package cloudexadatainfrastructures + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudExadataInfrastructureUpdateProperties struct { + ComputeCount *int64 `json:"computeCount,omitempty"` + CustomerContacts *[]CustomerContact `json:"customerContacts,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"` + StorageCount *int64 `json:"storageCount,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_configureexascalecloudexadatainfrastructuredetails.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_configureexascalecloudexadatainfrastructuredetails.go new file mode 100644 index 00000000000..edcf71fbe4f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_configureexascalecloudexadatainfrastructuredetails.go @@ -0,0 +1,8 @@ +package cloudexadatainfrastructures + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigureExascaleCloudExadataInfrastructureDetails struct { + TotalStorageInGbs int64 `json:"totalStorageInGbs"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_customercontact.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_customercontact.go new file mode 100644 index 00000000000..ab32a4c955d --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_customercontact.go @@ -0,0 +1,8 @@ +package cloudexadatainfrastructures + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomerContact struct { + Email string `json:"email"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_dayofweek.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_dayofweek.go new file mode 100644 index 00000000000..0df53b97a8f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_dayofweek.go @@ -0,0 +1,8 @@ +package cloudexadatainfrastructures + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DayOfWeek struct { + Name DayOfWeekName `json:"name"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_definedfilesystemconfiguration.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_definedfilesystemconfiguration.go new file mode 100644 index 00000000000..cf09b7a6405 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_definedfilesystemconfiguration.go @@ -0,0 +1,11 @@ +package cloudexadatainfrastructures + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DefinedFileSystemConfiguration struct { + IsBackupPartition *bool `json:"isBackupPartition,omitempty"` + IsResizable *bool `json:"isResizable,omitempty"` + MinSizeGb *int64 `json:"minSizeGb,omitempty"` + MountPoint *string `json:"mountPoint,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_estimatedpatchingtime.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_estimatedpatchingtime.go new file mode 100644 index 00000000000..52cd0d6fa9e --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_estimatedpatchingtime.go @@ -0,0 +1,11 @@ +package cloudexadatainfrastructures + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EstimatedPatchingTime struct { + EstimatedDbServerPatchingTime *int64 `json:"estimatedDbServerPatchingTime,omitempty"` + EstimatedNetworkSwitchesPatchingTime *int64 `json:"estimatedNetworkSwitchesPatchingTime,omitempty"` + EstimatedStorageServerPatchingTime *int64 `json:"estimatedStorageServerPatchingTime,omitempty"` + TotalEstimatedPatchingTime *int64 `json:"totalEstimatedPatchingTime,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_exascaleconfigdetails.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_exascaleconfigdetails.go new file mode 100644 index 00000000000..465cc78c1ae --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_exascaleconfigdetails.go @@ -0,0 +1,9 @@ +package cloudexadatainfrastructures + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExascaleConfigDetails struct { + AvailableStorageInGbs *int64 `json:"availableStorageInGbs,omitempty"` + TotalStorageInGbs int64 `json:"totalStorageInGbs"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_maintenancewindow.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_maintenancewindow.go new file mode 100644 index 00000000000..b9d485dcf62 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_maintenancewindow.go @@ -0,0 +1,17 @@ +package cloudexadatainfrastructures + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MaintenanceWindow struct { + CustomActionTimeoutInMins *int64 `json:"customActionTimeoutInMins,omitempty"` + DaysOfWeek *[]DayOfWeek `json:"daysOfWeek,omitempty"` + HoursOfDay *[]int64 `json:"hoursOfDay,omitempty"` + IsCustomActionTimeoutEnabled *bool `json:"isCustomActionTimeoutEnabled,omitempty"` + IsMonthlyPatchingEnabled *bool `json:"isMonthlyPatchingEnabled,omitempty"` + LeadTimeInWeeks *int64 `json:"leadTimeInWeeks,omitempty"` + Months *[]Month `json:"months,omitempty"` + PatchingMode *PatchingMode `json:"patchingMode,omitempty"` + Preference *Preference `json:"preference,omitempty"` + WeeksOfMonth *[]int64 `json:"weeksOfMonth,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_month.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_month.go new file mode 100644 index 00000000000..9c0b630b8af --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/model_month.go @@ -0,0 +1,8 @@ +package cloudexadatainfrastructures + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Month struct { + Name MonthName `json:"name"` +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/predicates.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/predicates.go similarity index 58% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/predicates.go rename to resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/predicates.go index 26161b72fe6..f34f9935407 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/predicates.go +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/predicates.go @@ -1,27 +1,22 @@ -package backupprotectionintent +package cloudexadatainfrastructures // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type ProtectionIntentResourceOperationPredicate struct { - ETag *string +type CloudExadataInfrastructureOperationPredicate struct { Id *string Location *string Name *string Type *string } -func (p ProtectionIntentResourceOperationPredicate) Matches(input ProtectionIntentResource) bool { - - if p.ETag != nil && (input.ETag == nil || *p.ETag != *input.ETag) { - return false - } +func (p CloudExadataInfrastructureOperationPredicate) Matches(input CloudExadataInfrastructure) bool { if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { return false } - if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + if p.Location != nil && *p.Location != input.Location { return false } diff --git a/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/version.go b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/version.go new file mode 100644 index 00000000000..016fb789be2 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudexadatainfrastructures/version.go @@ -0,0 +1,10 @@ +package cloudexadatainfrastructures + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-09-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/cloudexadatainfrastructures/2025-09-01" +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/README.md b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/README.md new file mode 100644 index 00000000000..1caff75871d --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/README.md @@ -0,0 +1,172 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/cloudvmclusters` Documentation + +The `cloudvmclusters` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/cloudvmclusters" +``` + + +### Client Initialization + +```go +client := cloudvmclusters.NewCloudVMClustersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CloudVMClustersClient.AddVMs` + +```go +ctx := context.TODO() +id := cloudvmclusters.NewCloudVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName") + +payload := cloudvmclusters.AddRemoveDbNode{ + // ... +} + + +if err := client.AddVMsThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `CloudVMClustersClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := cloudvmclusters.NewCloudVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName") + +payload := cloudvmclusters.CloudVMCluster{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `CloudVMClustersClient.Delete` + +```go +ctx := context.TODO() +id := cloudvmclusters.NewCloudVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `CloudVMClustersClient.Get` + +```go +ctx := context.TODO() +id := cloudvmclusters.NewCloudVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CloudVMClustersClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CloudVMClustersClient.ListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CloudVMClustersClient.ListPrivateIPAddresses` + +```go +ctx := context.TODO() +id := cloudvmclusters.NewCloudVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName") + +payload := cloudvmclusters.PrivateIPAddressesFilter{ + // ... +} + + +read, err := client.ListPrivateIPAddresses(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CloudVMClustersClient.RemoveVMs` + +```go +ctx := context.TODO() +id := cloudvmclusters.NewCloudVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName") + +payload := cloudvmclusters.AddRemoveDbNode{ + // ... +} + + +if err := client.RemoveVMsThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `CloudVMClustersClient.Update` + +```go +ctx := context.TODO() +id := cloudvmclusters.NewCloudVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName") + +payload := cloudvmclusters.CloudVMClusterUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/client.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/client.go new file mode 100644 index 00000000000..8686d91ee78 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/client.go @@ -0,0 +1,26 @@ +package cloudvmclusters + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudVMClustersClient struct { + Client *resourcemanager.Client +} + +func NewCloudVMClustersClientWithBaseURI(sdkApi sdkEnv.Api) (*CloudVMClustersClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "cloudvmclusters", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CloudVMClustersClient: %+v", err) + } + + return &CloudVMClustersClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/constants.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/constants.go new file mode 100644 index 00000000000..8d36ef9f5f7 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/constants.go @@ -0,0 +1,377 @@ +package cloudvmclusters + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureResourceProvisioningState string + +const ( + AzureResourceProvisioningStateCanceled AzureResourceProvisioningState = "Canceled" + AzureResourceProvisioningStateFailed AzureResourceProvisioningState = "Failed" + AzureResourceProvisioningStateProvisioning AzureResourceProvisioningState = "Provisioning" + AzureResourceProvisioningStateSucceeded AzureResourceProvisioningState = "Succeeded" +) + +func PossibleValuesForAzureResourceProvisioningState() []string { + return []string{ + string(AzureResourceProvisioningStateCanceled), + string(AzureResourceProvisioningStateFailed), + string(AzureResourceProvisioningStateProvisioning), + string(AzureResourceProvisioningStateSucceeded), + } +} + +func (s *AzureResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAzureResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAzureResourceProvisioningState(input string) (*AzureResourceProvisioningState, error) { + vals := map[string]AzureResourceProvisioningState{ + "canceled": AzureResourceProvisioningStateCanceled, + "failed": AzureResourceProvisioningStateFailed, + "provisioning": AzureResourceProvisioningStateProvisioning, + "succeeded": AzureResourceProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AzureResourceProvisioningState(input) + return &out, nil +} + +type CloudVMClusterLifecycleState string + +const ( + CloudVMClusterLifecycleStateAvailable CloudVMClusterLifecycleState = "Available" + CloudVMClusterLifecycleStateFailed CloudVMClusterLifecycleState = "Failed" + CloudVMClusterLifecycleStateMaintenanceInProgress CloudVMClusterLifecycleState = "MaintenanceInProgress" + CloudVMClusterLifecycleStateProvisioning CloudVMClusterLifecycleState = "Provisioning" + CloudVMClusterLifecycleStateTerminated CloudVMClusterLifecycleState = "Terminated" + CloudVMClusterLifecycleStateTerminating CloudVMClusterLifecycleState = "Terminating" + CloudVMClusterLifecycleStateUpdating CloudVMClusterLifecycleState = "Updating" +) + +func PossibleValuesForCloudVMClusterLifecycleState() []string { + return []string{ + string(CloudVMClusterLifecycleStateAvailable), + string(CloudVMClusterLifecycleStateFailed), + string(CloudVMClusterLifecycleStateMaintenanceInProgress), + string(CloudVMClusterLifecycleStateProvisioning), + string(CloudVMClusterLifecycleStateTerminated), + string(CloudVMClusterLifecycleStateTerminating), + string(CloudVMClusterLifecycleStateUpdating), + } +} + +func (s *CloudVMClusterLifecycleState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCloudVMClusterLifecycleState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCloudVMClusterLifecycleState(input string) (*CloudVMClusterLifecycleState, error) { + vals := map[string]CloudVMClusterLifecycleState{ + "available": CloudVMClusterLifecycleStateAvailable, + "failed": CloudVMClusterLifecycleStateFailed, + "maintenanceinprogress": CloudVMClusterLifecycleStateMaintenanceInProgress, + "provisioning": CloudVMClusterLifecycleStateProvisioning, + "terminated": CloudVMClusterLifecycleStateTerminated, + "terminating": CloudVMClusterLifecycleStateTerminating, + "updating": CloudVMClusterLifecycleStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CloudVMClusterLifecycleState(input) + return &out, nil +} + +type ComputeModel string + +const ( + ComputeModelECPU ComputeModel = "ECPU" + ComputeModelOCPU ComputeModel = "OCPU" +) + +func PossibleValuesForComputeModel() []string { + return []string{ + string(ComputeModelECPU), + string(ComputeModelOCPU), + } +} + +func (s *ComputeModel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseComputeModel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseComputeModel(input string) (*ComputeModel, error) { + vals := map[string]ComputeModel{ + "ecpu": ComputeModelECPU, + "ocpu": ComputeModelOCPU, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComputeModel(input) + return &out, nil +} + +type DiskRedundancy string + +const ( + DiskRedundancyHigh DiskRedundancy = "High" + DiskRedundancyNormal DiskRedundancy = "Normal" +) + +func PossibleValuesForDiskRedundancy() []string { + return []string{ + string(DiskRedundancyHigh), + string(DiskRedundancyNormal), + } +} + +func (s *DiskRedundancy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskRedundancy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskRedundancy(input string) (*DiskRedundancy, error) { + vals := map[string]DiskRedundancy{ + "high": DiskRedundancyHigh, + "normal": DiskRedundancyNormal, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskRedundancy(input) + return &out, nil +} + +type ExadataVMClusterStorageManagementType string + +const ( + ExadataVMClusterStorageManagementTypeASM ExadataVMClusterStorageManagementType = "ASM" + ExadataVMClusterStorageManagementTypeExascale ExadataVMClusterStorageManagementType = "Exascale" +) + +func PossibleValuesForExadataVMClusterStorageManagementType() []string { + return []string{ + string(ExadataVMClusterStorageManagementTypeASM), + string(ExadataVMClusterStorageManagementTypeExascale), + } +} + +func (s *ExadataVMClusterStorageManagementType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseExadataVMClusterStorageManagementType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseExadataVMClusterStorageManagementType(input string) (*ExadataVMClusterStorageManagementType, error) { + vals := map[string]ExadataVMClusterStorageManagementType{ + "asm": ExadataVMClusterStorageManagementTypeASM, + "exascale": ExadataVMClusterStorageManagementTypeExascale, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExadataVMClusterStorageManagementType(input) + return &out, nil +} + +type IormLifecycleState string + +const ( + IormLifecycleStateBootStrapping IormLifecycleState = "BootStrapping" + IormLifecycleStateDisabled IormLifecycleState = "Disabled" + IormLifecycleStateEnabled IormLifecycleState = "Enabled" + IormLifecycleStateFailed IormLifecycleState = "Failed" + IormLifecycleStateUpdating IormLifecycleState = "Updating" +) + +func PossibleValuesForIormLifecycleState() []string { + return []string{ + string(IormLifecycleStateBootStrapping), + string(IormLifecycleStateDisabled), + string(IormLifecycleStateEnabled), + string(IormLifecycleStateFailed), + string(IormLifecycleStateUpdating), + } +} + +func (s *IormLifecycleState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIormLifecycleState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIormLifecycleState(input string) (*IormLifecycleState, error) { + vals := map[string]IormLifecycleState{ + "bootstrapping": IormLifecycleStateBootStrapping, + "disabled": IormLifecycleStateDisabled, + "enabled": IormLifecycleStateEnabled, + "failed": IormLifecycleStateFailed, + "updating": IormLifecycleStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IormLifecycleState(input) + return &out, nil +} + +type LicenseModel string + +const ( + LicenseModelBringYourOwnLicense LicenseModel = "BringYourOwnLicense" + LicenseModelLicenseIncluded LicenseModel = "LicenseIncluded" +) + +func PossibleValuesForLicenseModel() []string { + return []string{ + string(LicenseModelBringYourOwnLicense), + string(LicenseModelLicenseIncluded), + } +} + +func (s *LicenseModel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLicenseModel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLicenseModel(input string) (*LicenseModel, error) { + vals := map[string]LicenseModel{ + "bringyourownlicense": LicenseModelBringYourOwnLicense, + "licenseincluded": LicenseModelLicenseIncluded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LicenseModel(input) + return &out, nil +} + +type Objective string + +const ( + ObjectiveAuto Objective = "Auto" + ObjectiveBalanced Objective = "Balanced" + ObjectiveBasic Objective = "Basic" + ObjectiveHighThroughput Objective = "HighThroughput" + ObjectiveLowLatency Objective = "LowLatency" +) + +func PossibleValuesForObjective() []string { + return []string{ + string(ObjectiveAuto), + string(ObjectiveBalanced), + string(ObjectiveBasic), + string(ObjectiveHighThroughput), + string(ObjectiveLowLatency), + } +} + +func (s *Objective) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseObjective(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseObjective(input string) (*Objective, error) { + vals := map[string]Objective{ + "auto": ObjectiveAuto, + "balanced": ObjectiveBalanced, + "basic": ObjectiveBasic, + "highthroughput": ObjectiveHighThroughput, + "lowlatency": ObjectiveLowLatency, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Objective(input) + return &out, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/id_cloudvmcluster.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/id_cloudvmcluster.go new file mode 100644 index 00000000000..f575d429e4e --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/id_cloudvmcluster.go @@ -0,0 +1,130 @@ +package cloudvmclusters + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&CloudVMClusterId{}) +} + +var _ resourceids.ResourceId = &CloudVMClusterId{} + +// CloudVMClusterId is a struct representing the Resource ID for a Cloud VM Cluster +type CloudVMClusterId struct { + SubscriptionId string + ResourceGroupName string + CloudVmClusterName string +} + +// NewCloudVMClusterID returns a new CloudVMClusterId struct +func NewCloudVMClusterID(subscriptionId string, resourceGroupName string, cloudVmClusterName string) CloudVMClusterId { + return CloudVMClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CloudVmClusterName: cloudVmClusterName, + } +} + +// ParseCloudVMClusterID parses 'input' into a CloudVMClusterId +func ParseCloudVMClusterID(input string) (*CloudVMClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(&CloudVMClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CloudVMClusterId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCloudVMClusterIDInsensitively parses 'input' case-insensitively into a CloudVMClusterId +// note: this method should only be used for API response data and not user input +func ParseCloudVMClusterIDInsensitively(input string) (*CloudVMClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(&CloudVMClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CloudVMClusterId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CloudVMClusterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.CloudVmClusterName, ok = input.Parsed["cloudVmClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudVmClusterName", input) + } + + return nil +} + +// ValidateCloudVMClusterID checks that 'input' can be parsed as a Cloud VM Cluster ID +func ValidateCloudVMClusterID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseCloudVMClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cloud VM Cluster ID +func (id CloudVMClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Oracle.Database/cloudVmClusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CloudVmClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cloud VM Cluster ID +func (id CloudVMClusterId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticCloudVmClusters", "cloudVmClusters", "cloudVmClusters"), + resourceids.UserSpecifiedSegment("cloudVmClusterName", "cloudVmClusterName"), + } +} + +// String returns a human-readable description of this Cloud VM Cluster ID +func (id CloudVMClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cloud Vm Cluster Name: %q", id.CloudVmClusterName), + } + return fmt.Sprintf("Cloud VM Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/id_cloudvmcluster_test.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/id_cloudvmcluster_test.go new file mode 100644 index 00000000000..2794d4cc0f4 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/id_cloudvmcluster_test.go @@ -0,0 +1,282 @@ +package cloudvmclusters + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &CloudVMClusterId{} + +func TestNewCloudVMClusterID(t *testing.T) { + id := NewCloudVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.CloudVmClusterName != "cloudVmClusterName" { + t.Fatalf("Expected %q but got %q for Segment 'CloudVmClusterName'", id.CloudVmClusterName, "cloudVmClusterName") + } +} + +func TestFormatCloudVMClusterID(t *testing.T) { + actual := NewCloudVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseCloudVMClusterID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CloudVMClusterId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName", + Expected: &CloudVMClusterId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CloudVmClusterName: "cloudVmClusterName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCloudVMClusterID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.CloudVmClusterName != v.Expected.CloudVmClusterName { + t.Fatalf("Expected %q but got %q for CloudVmClusterName", v.Expected.CloudVmClusterName, actual.CloudVmClusterName) + } + + } +} + +func TestParseCloudVMClusterIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CloudVMClusterId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdVmClUsTeRs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName", + Expected: &CloudVMClusterId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CloudVmClusterName: "cloudVmClusterName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdVmClUsTeRs/cLoUdVmClUsTeRnAmE", + Expected: &CloudVMClusterId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + CloudVmClusterName: "cLoUdVmClUsTeRnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdVmClUsTeRs/cLoUdVmClUsTeRnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCloudVMClusterIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.CloudVmClusterName != v.Expected.CloudVmClusterName { + t.Fatalf("Expected %q but got %q for CloudVmClusterName", v.Expected.CloudVmClusterName, actual.CloudVmClusterName) + } + + } +} + +func TestSegmentsForCloudVMClusterId(t *testing.T) { + segments := CloudVMClusterId{}.Segments() + if len(segments) == 0 { + t.Fatalf("CloudVMClusterId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_addvms.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_addvms.go new file mode 100644 index 00000000000..f83b1419e29 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_addvms.go @@ -0,0 +1,75 @@ +package cloudvmclusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AddVMsOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *CloudVMCluster +} + +// AddVMs ... +func (c CloudVMClustersClient) AddVMs(ctx context.Context, id CloudVMClusterId, input AddRemoveDbNode) (result AddVMsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/addVms", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// AddVMsThenPoll performs AddVMs then polls until it's completed +func (c CloudVMClustersClient) AddVMsThenPoll(ctx context.Context, id CloudVMClusterId, input AddRemoveDbNode) error { + result, err := c.AddVMs(ctx, id, input) + if err != nil { + return fmt.Errorf("performing AddVMs: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AddVMs: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_createorupdate.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_createorupdate.go new file mode 100644 index 00000000000..d4006bf71a3 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_createorupdate.go @@ -0,0 +1,75 @@ +package cloudvmclusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *CloudVMCluster +} + +// CreateOrUpdate ... +func (c CloudVMClustersClient) CreateOrUpdate(ctx context.Context, id CloudVMClusterId, input CloudVMCluster) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c CloudVMClustersClient) CreateOrUpdateThenPoll(ctx context.Context, id CloudVMClusterId, input CloudVMCluster) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_delete.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_delete.go new file mode 100644 index 00000000000..d8297753935 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_delete.go @@ -0,0 +1,70 @@ +package cloudvmclusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c CloudVMClustersClient) Delete(ctx context.Context, id CloudVMClusterId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c CloudVMClustersClient) DeleteThenPoll(ctx context.Context, id CloudVMClusterId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_get.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_get.go new file mode 100644 index 00000000000..c12e2449311 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_get.go @@ -0,0 +1,53 @@ +package cloudvmclusters + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CloudVMCluster +} + +// Get ... +func (c CloudVMClustersClient) Get(ctx context.Context, id CloudVMClusterId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model CloudVMCluster + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_listbyresourcegroup.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_listbyresourcegroup.go new file mode 100644 index 00000000000..c6f023cd917 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package cloudvmclusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]CloudVMCluster +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []CloudVMCluster +} + +type ListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByResourceGroup ... +func (c CloudVMClustersClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Oracle.Database/cloudVmClusters", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]CloudVMCluster `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c CloudVMClustersClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, CloudVMClusterOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CloudVMClustersClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate CloudVMClusterOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]CloudVMCluster, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_listbysubscription.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_listbysubscription.go new file mode 100644 index 00000000000..dfd4dafe734 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_listbysubscription.go @@ -0,0 +1,106 @@ +package cloudvmclusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]CloudVMCluster +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []CloudVMCluster +} + +type ListBySubscriptionCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListBySubscriptionCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListBySubscription ... +func (c CloudVMClustersClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Oracle.Database/cloudVmClusters", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]CloudVMCluster `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c CloudVMClustersClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, CloudVMClusterOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CloudVMClustersClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate CloudVMClusterOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]CloudVMCluster, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_listprivateipaddresses.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_listprivateipaddresses.go new file mode 100644 index 00000000000..3cb61c58437 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_listprivateipaddresses.go @@ -0,0 +1,58 @@ +package cloudvmclusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListPrivateIPAddressesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]PrivateIPAddressProperties +} + +// ListPrivateIPAddresses ... +func (c CloudVMClustersClient) ListPrivateIPAddresses(ctx context.Context, id CloudVMClusterId, input PrivateIPAddressesFilter) (result ListPrivateIPAddressesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listPrivateIpAddresses", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model []PrivateIPAddressProperties + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_removevms.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_removevms.go new file mode 100644 index 00000000000..6b285c4817a --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_removevms.go @@ -0,0 +1,75 @@ +package cloudvmclusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemoveVMsOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *CloudVMCluster +} + +// RemoveVMs ... +func (c CloudVMClustersClient) RemoveVMs(ctx context.Context, id CloudVMClusterId, input AddRemoveDbNode) (result RemoveVMsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/removeVms", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// RemoveVMsThenPoll performs RemoveVMs then polls until it's completed +func (c CloudVMClustersClient) RemoveVMsThenPoll(ctx context.Context, id CloudVMClusterId, input AddRemoveDbNode) error { + result, err := c.RemoveVMs(ctx, id, input) + if err != nil { + return fmt.Errorf("performing RemoveVMs: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RemoveVMs: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_update.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_update.go new file mode 100644 index 00000000000..b629960e83d --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/method_update.go @@ -0,0 +1,75 @@ +package cloudvmclusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *CloudVMCluster +} + +// Update ... +func (c CloudVMClustersClient) Update(ctx context.Context, id CloudVMClusterId, input CloudVMClusterUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c CloudVMClustersClient) UpdateThenPoll(ctx context.Context, id CloudVMClusterId, input CloudVMClusterUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_addremovedbnode.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_addremovedbnode.go new file mode 100644 index 00000000000..4339e88ab71 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_addremovedbnode.go @@ -0,0 +1,8 @@ +package cloudvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AddRemoveDbNode struct { + DbServers []string `json:"dbServers"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_cloudvmcluster.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_cloudvmcluster.go new file mode 100644 index 00000000000..794313d5e11 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_cloudvmcluster.go @@ -0,0 +1,18 @@ +package cloudvmclusters + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudVMCluster struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *CloudVMClusterProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_cloudvmclusterproperties.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_cloudvmclusterproperties.go new file mode 100644 index 00000000000..5469987cbce --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_cloudvmclusterproperties.go @@ -0,0 +1,77 @@ +package cloudvmclusters + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudVMClusterProperties struct { + BackupSubnetCidr *string `json:"backupSubnetCidr,omitempty"` + CloudExadataInfrastructureId string `json:"cloudExadataInfrastructureId"` + ClusterName *string `json:"clusterName,omitempty"` + CompartmentId *string `json:"compartmentId,omitempty"` + ComputeModel *ComputeModel `json:"computeModel,omitempty"` + ComputeNodes *[]string `json:"computeNodes,omitempty"` + CpuCoreCount int64 `json:"cpuCoreCount"` + DataCollectionOptions *DataCollectionOptions `json:"dataCollectionOptions,omitempty"` + DataStoragePercentage *int64 `json:"dataStoragePercentage,omitempty"` + DataStorageSizeInTbs *float64 `json:"dataStorageSizeInTbs,omitempty"` + DbNodeStorageSizeInGbs *int64 `json:"dbNodeStorageSizeInGbs,omitempty"` + DbServers *[]string `json:"dbServers,omitempty"` + DiskRedundancy *DiskRedundancy `json:"diskRedundancy,omitempty"` + DisplayName string `json:"displayName"` + Domain *string `json:"domain,omitempty"` + ExascaleDbStorageVaultId *string `json:"exascaleDbStorageVaultId,omitempty"` + FileSystemConfigurationDetails *[]FileSystemConfigurationDetails `json:"fileSystemConfigurationDetails,omitempty"` + GiVersion string `json:"giVersion"` + Hostname string `json:"hostname"` + IormConfigCache *ExadataIormConfig `json:"iormConfigCache,omitempty"` + IsLocalBackupEnabled *bool `json:"isLocalBackupEnabled,omitempty"` + IsSparseDiskgroupEnabled *bool `json:"isSparseDiskgroupEnabled,omitempty"` + LastUpdateHistoryEntryId *string `json:"lastUpdateHistoryEntryId,omitempty"` + LicenseModel *LicenseModel `json:"licenseModel,omitempty"` + LifecycleDetails *string `json:"lifecycleDetails,omitempty"` + LifecycleState *CloudVMClusterLifecycleState `json:"lifecycleState,omitempty"` + ListenerPort *int64 `json:"listenerPort,omitempty"` + MemorySizeInGbs *int64 `json:"memorySizeInGbs,omitempty"` + NodeCount *int64 `json:"nodeCount,omitempty"` + NsgCidrs *[]NsgCidr `json:"nsgCidrs,omitempty"` + NsgURL *string `json:"nsgUrl,omitempty"` + OciURL *string `json:"ociUrl,omitempty"` + Ocid *string `json:"ocid,omitempty"` + OcpuCount *float64 `json:"ocpuCount,omitempty"` + ProvisioningState *AzureResourceProvisioningState `json:"provisioningState,omitempty"` + ScanDnsName *string `json:"scanDnsName,omitempty"` + ScanDnsRecordId *string `json:"scanDnsRecordId,omitempty"` + ScanIPIds *[]string `json:"scanIpIds,omitempty"` + ScanListenerPortTcp *int64 `json:"scanListenerPortTcp,omitempty"` + ScanListenerPortTcpSsl *int64 `json:"scanListenerPortTcpSsl,omitempty"` + Shape *string `json:"shape,omitempty"` + SshPublicKeys []string `json:"sshPublicKeys"` + StorageManagementType *ExadataVMClusterStorageManagementType `json:"storageManagementType,omitempty"` + StorageSizeInGbs *int64 `json:"storageSizeInGbs,omitempty"` + SubnetId string `json:"subnetId"` + SubnetOcid *string `json:"subnetOcid,omitempty"` + SystemVersion *string `json:"systemVersion,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + VipIds *[]string `json:"vipIds,omitempty"` + VnetId string `json:"vnetId"` + ZoneId *string `json:"zoneId,omitempty"` +} + +func (o *CloudVMClusterProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *CloudVMClusterProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_cloudvmclusterupdate.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_cloudvmclusterupdate.go new file mode 100644 index 00000000000..9c45a82caab --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_cloudvmclusterupdate.go @@ -0,0 +1,9 @@ +package cloudvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudVMClusterUpdate struct { + Properties *CloudVMClusterUpdateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_cloudvmclusterupdateproperties.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_cloudvmclusterupdateproperties.go new file mode 100644 index 00000000000..76f1064e31c --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_cloudvmclusterupdateproperties.go @@ -0,0 +1,19 @@ +package cloudvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudVMClusterUpdateProperties struct { + ComputeNodes *[]string `json:"computeNodes,omitempty"` + CpuCoreCount *int64 `json:"cpuCoreCount,omitempty"` + DataCollectionOptions *DataCollectionOptions `json:"dataCollectionOptions,omitempty"` + DataStorageSizeInTbs *float64 `json:"dataStorageSizeInTbs,omitempty"` + DbNodeStorageSizeInGbs *int64 `json:"dbNodeStorageSizeInGbs,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + FileSystemConfigurationDetails *[]FileSystemConfigurationDetails `json:"fileSystemConfigurationDetails,omitempty"` + LicenseModel *LicenseModel `json:"licenseModel,omitempty"` + MemorySizeInGbs *int64 `json:"memorySizeInGbs,omitempty"` + OcpuCount *float64 `json:"ocpuCount,omitempty"` + SshPublicKeys *[]string `json:"sshPublicKeys,omitempty"` + StorageSizeInGbs *int64 `json:"storageSizeInGbs,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_datacollectionoptions.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_datacollectionoptions.go new file mode 100644 index 00000000000..df3ddfd596d --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_datacollectionoptions.go @@ -0,0 +1,10 @@ +package cloudvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataCollectionOptions struct { + IsDiagnosticsEventsEnabled *bool `json:"isDiagnosticsEventsEnabled,omitempty"` + IsHealthMonitoringEnabled *bool `json:"isHealthMonitoringEnabled,omitempty"` + IsIncidentLogsEnabled *bool `json:"isIncidentLogsEnabled,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_dbiormconfig.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_dbiormconfig.go new file mode 100644 index 00000000000..3ec47756c25 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_dbiormconfig.go @@ -0,0 +1,10 @@ +package cloudvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbIormConfig struct { + DbName *string `json:"dbName,omitempty"` + FlashCacheLimit *string `json:"flashCacheLimit,omitempty"` + Share *int64 `json:"share,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_exadataiormconfig.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_exadataiormconfig.go new file mode 100644 index 00000000000..07899f1e94d --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_exadataiormconfig.go @@ -0,0 +1,11 @@ +package cloudvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExadataIormConfig struct { + DbPlans *[]DbIormConfig `json:"dbPlans,omitempty"` + LifecycleDetails *string `json:"lifecycleDetails,omitempty"` + LifecycleState *IormLifecycleState `json:"lifecycleState,omitempty"` + Objective *Objective `json:"objective,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_filesystemconfigurationdetails.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_filesystemconfigurationdetails.go new file mode 100644 index 00000000000..6e5ecde672c --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_filesystemconfigurationdetails.go @@ -0,0 +1,9 @@ +package cloudvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FileSystemConfigurationDetails struct { + FileSystemSizeGb *int64 `json:"fileSystemSizeGb,omitempty"` + MountPoint *string `json:"mountPoint,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_nsgcidr.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_nsgcidr.go new file mode 100644 index 00000000000..7123fc5a165 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_nsgcidr.go @@ -0,0 +1,9 @@ +package cloudvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NsgCidr struct { + DestinationPortRange *PortRange `json:"destinationPortRange,omitempty"` + Source string `json:"source"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_portrange.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_portrange.go new file mode 100644 index 00000000000..a3906443e6a --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_portrange.go @@ -0,0 +1,9 @@ +package cloudvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PortRange struct { + Max int64 `json:"max"` + Min int64 `json:"min"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_privateipaddressesfilter.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_privateipaddressesfilter.go new file mode 100644 index 00000000000..4986845bb03 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_privateipaddressesfilter.go @@ -0,0 +1,9 @@ +package cloudvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateIPAddressesFilter struct { + SubnetId string `json:"subnetId"` + VnicId string `json:"vnicId"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_privateipaddressproperties.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_privateipaddressproperties.go new file mode 100644 index 00000000000..35ac2a7af42 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/model_privateipaddressproperties.go @@ -0,0 +1,12 @@ +package cloudvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateIPAddressProperties struct { + DisplayName string `json:"displayName"` + HostnameLabel string `json:"hostnameLabel"` + IPAddress string `json:"ipAddress"` + Ocid string `json:"ocid"` + SubnetId string `json:"subnetId"` +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/predicates.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/predicates.go similarity index 57% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/predicates.go rename to resource-manager/oracledatabase/2025-09-01/cloudvmclusters/predicates.go index 65cbf0427e6..174e49c11ca 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/predicates.go +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/predicates.go @@ -1,27 +1,22 @@ -package softdeletedcontainers +package cloudvmclusters // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type ProtectionContainerResourceOperationPredicate struct { - ETag *string +type CloudVMClusterOperationPredicate struct { Id *string Location *string Name *string Type *string } -func (p ProtectionContainerResourceOperationPredicate) Matches(input ProtectionContainerResource) bool { - - if p.ETag != nil && (input.ETag == nil || *p.ETag != *input.ETag) { - return false - } +func (p CloudVMClusterOperationPredicate) Matches(input CloudVMCluster) bool { if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { return false } - if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + if p.Location != nil && *p.Location != input.Location { return false } diff --git a/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/version.go b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/version.go new file mode 100644 index 00000000000..aa059c46af7 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/cloudvmclusters/version.go @@ -0,0 +1,10 @@ +package cloudvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-09-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/cloudvmclusters/2025-09-01" +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbnodes/README.md b/resource-manager/oracledatabase/2025-09-01/dbnodes/README.md new file mode 100644 index 00000000000..e0db30afd06 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbnodes/README.md @@ -0,0 +1,70 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/dbnodes` Documentation + +The `dbnodes` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/dbnodes" +``` + + +### Client Initialization + +```go +client := dbnodes.NewDbNodesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DbNodesClient.Action` + +```go +ctx := context.TODO() +id := dbnodes.NewDbNodeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName", "dbNodeName") + +payload := dbnodes.DbNodeAction{ + // ... +} + + +if err := client.ActionThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DbNodesClient.Get` + +```go +ctx := context.TODO() +id := dbnodes.NewDbNodeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName", "dbNodeName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DbNodesClient.ListByParent` + +```go +ctx := context.TODO() +id := dbnodes.NewCloudVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName") + +// alternatively `client.ListByParent(ctx, id)` can be used to do batched pagination +items, err := client.ListByParentComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/dbnodes/client.go b/resource-manager/oracledatabase/2025-09-01/dbnodes/client.go new file mode 100644 index 00000000000..bce691a3f42 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbnodes/client.go @@ -0,0 +1,26 @@ +package dbnodes + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbNodesClient struct { + Client *resourcemanager.Client +} + +func NewDbNodesClientWithBaseURI(sdkApi sdkEnv.Api) (*DbNodesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "dbnodes", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DbNodesClient: %+v", err) + } + + return &DbNodesClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbnodes/constants.go b/resource-manager/oracledatabase/2025-09-01/dbnodes/constants.go new file mode 100644 index 00000000000..f0304b7d961 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbnodes/constants.go @@ -0,0 +1,201 @@ +package dbnodes + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbNodeActionEnum string + +const ( + DbNodeActionEnumReset DbNodeActionEnum = "Reset" + DbNodeActionEnumSoftReset DbNodeActionEnum = "SoftReset" + DbNodeActionEnumStart DbNodeActionEnum = "Start" + DbNodeActionEnumStop DbNodeActionEnum = "Stop" +) + +func PossibleValuesForDbNodeActionEnum() []string { + return []string{ + string(DbNodeActionEnumReset), + string(DbNodeActionEnumSoftReset), + string(DbNodeActionEnumStart), + string(DbNodeActionEnumStop), + } +} + +func (s *DbNodeActionEnum) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDbNodeActionEnum(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDbNodeActionEnum(input string) (*DbNodeActionEnum, error) { + vals := map[string]DbNodeActionEnum{ + "reset": DbNodeActionEnumReset, + "softreset": DbNodeActionEnumSoftReset, + "start": DbNodeActionEnumStart, + "stop": DbNodeActionEnumStop, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DbNodeActionEnum(input) + return &out, nil +} + +type DbNodeMaintenanceType string + +const ( + DbNodeMaintenanceTypeVMdbRebootMigration DbNodeMaintenanceType = "VmdbRebootMigration" +) + +func PossibleValuesForDbNodeMaintenanceType() []string { + return []string{ + string(DbNodeMaintenanceTypeVMdbRebootMigration), + } +} + +func (s *DbNodeMaintenanceType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDbNodeMaintenanceType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDbNodeMaintenanceType(input string) (*DbNodeMaintenanceType, error) { + vals := map[string]DbNodeMaintenanceType{ + "vmdbrebootmigration": DbNodeMaintenanceTypeVMdbRebootMigration, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DbNodeMaintenanceType(input) + return &out, nil +} + +type DbNodeProvisioningState string + +const ( + DbNodeProvisioningStateAvailable DbNodeProvisioningState = "Available" + DbNodeProvisioningStateFailed DbNodeProvisioningState = "Failed" + DbNodeProvisioningStateProvisioning DbNodeProvisioningState = "Provisioning" + DbNodeProvisioningStateStarting DbNodeProvisioningState = "Starting" + DbNodeProvisioningStateStopped DbNodeProvisioningState = "Stopped" + DbNodeProvisioningStateStopping DbNodeProvisioningState = "Stopping" + DbNodeProvisioningStateTerminated DbNodeProvisioningState = "Terminated" + DbNodeProvisioningStateTerminating DbNodeProvisioningState = "Terminating" + DbNodeProvisioningStateUpdating DbNodeProvisioningState = "Updating" +) + +func PossibleValuesForDbNodeProvisioningState() []string { + return []string{ + string(DbNodeProvisioningStateAvailable), + string(DbNodeProvisioningStateFailed), + string(DbNodeProvisioningStateProvisioning), + string(DbNodeProvisioningStateStarting), + string(DbNodeProvisioningStateStopped), + string(DbNodeProvisioningStateStopping), + string(DbNodeProvisioningStateTerminated), + string(DbNodeProvisioningStateTerminating), + string(DbNodeProvisioningStateUpdating), + } +} + +func (s *DbNodeProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDbNodeProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDbNodeProvisioningState(input string) (*DbNodeProvisioningState, error) { + vals := map[string]DbNodeProvisioningState{ + "available": DbNodeProvisioningStateAvailable, + "failed": DbNodeProvisioningStateFailed, + "provisioning": DbNodeProvisioningStateProvisioning, + "starting": DbNodeProvisioningStateStarting, + "stopped": DbNodeProvisioningStateStopped, + "stopping": DbNodeProvisioningStateStopping, + "terminated": DbNodeProvisioningStateTerminated, + "terminating": DbNodeProvisioningStateTerminating, + "updating": DbNodeProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DbNodeProvisioningState(input) + return &out, nil +} + +type ResourceProvisioningState string + +const ( + ResourceProvisioningStateCanceled ResourceProvisioningState = "Canceled" + ResourceProvisioningStateFailed ResourceProvisioningState = "Failed" + ResourceProvisioningStateSucceeded ResourceProvisioningState = "Succeeded" +) + +func PossibleValuesForResourceProvisioningState() []string { + return []string{ + string(ResourceProvisioningStateCanceled), + string(ResourceProvisioningStateFailed), + string(ResourceProvisioningStateSucceeded), + } +} + +func (s *ResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseResourceProvisioningState(input string) (*ResourceProvisioningState, error) { + vals := map[string]ResourceProvisioningState{ + "canceled": ResourceProvisioningStateCanceled, + "failed": ResourceProvisioningStateFailed, + "succeeded": ResourceProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceProvisioningState(input) + return &out, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbnodes/id_cloudvmcluster.go b/resource-manager/oracledatabase/2025-09-01/dbnodes/id_cloudvmcluster.go new file mode 100644 index 00000000000..467ff1af363 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbnodes/id_cloudvmcluster.go @@ -0,0 +1,130 @@ +package dbnodes + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&CloudVMClusterId{}) +} + +var _ resourceids.ResourceId = &CloudVMClusterId{} + +// CloudVMClusterId is a struct representing the Resource ID for a Cloud VM Cluster +type CloudVMClusterId struct { + SubscriptionId string + ResourceGroupName string + CloudVmClusterName string +} + +// NewCloudVMClusterID returns a new CloudVMClusterId struct +func NewCloudVMClusterID(subscriptionId string, resourceGroupName string, cloudVmClusterName string) CloudVMClusterId { + return CloudVMClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CloudVmClusterName: cloudVmClusterName, + } +} + +// ParseCloudVMClusterID parses 'input' into a CloudVMClusterId +func ParseCloudVMClusterID(input string) (*CloudVMClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(&CloudVMClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CloudVMClusterId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCloudVMClusterIDInsensitively parses 'input' case-insensitively into a CloudVMClusterId +// note: this method should only be used for API response data and not user input +func ParseCloudVMClusterIDInsensitively(input string) (*CloudVMClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(&CloudVMClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CloudVMClusterId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CloudVMClusterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.CloudVmClusterName, ok = input.Parsed["cloudVmClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudVmClusterName", input) + } + + return nil +} + +// ValidateCloudVMClusterID checks that 'input' can be parsed as a Cloud VM Cluster ID +func ValidateCloudVMClusterID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseCloudVMClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cloud VM Cluster ID +func (id CloudVMClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Oracle.Database/cloudVmClusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CloudVmClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cloud VM Cluster ID +func (id CloudVMClusterId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticCloudVmClusters", "cloudVmClusters", "cloudVmClusters"), + resourceids.UserSpecifiedSegment("cloudVmClusterName", "cloudVmClusterName"), + } +} + +// String returns a human-readable description of this Cloud VM Cluster ID +func (id CloudVMClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cloud Vm Cluster Name: %q", id.CloudVmClusterName), + } + return fmt.Sprintf("Cloud VM Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/id_vault_test.go b/resource-manager/oracledatabase/2025-09-01/dbnodes/id_cloudvmcluster_test.go similarity index 66% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/id_vault_test.go rename to resource-manager/oracledatabase/2025-09-01/dbnodes/id_cloudvmcluster_test.go index 57ccb03f9af..84c155e42f5 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/id_vault_test.go +++ b/resource-manager/oracledatabase/2025-09-01/dbnodes/id_cloudvmcluster_test.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package dbnodes import ( "testing" @@ -9,10 +9,10 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -var _ resourceids.ResourceId = &VaultId{} +var _ resourceids.ResourceId = &CloudVMClusterId{} -func TestNewVaultID(t *testing.T) { - id := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") +func TestNewCloudVMClusterID(t *testing.T) { + id := NewCloudVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName") if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") @@ -22,24 +22,24 @@ func TestNewVaultID(t *testing.T) { t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") } - if id.VaultName != "vaultName" { - t.Fatalf("Expected %q but got %q for Segment 'VaultName'", id.VaultName, "vaultName") + if id.CloudVmClusterName != "cloudVmClusterName" { + t.Fatalf("Expected %q but got %q for Segment 'CloudVmClusterName'", id.CloudVmClusterName, "cloudVmClusterName") } } -func TestFormatVaultID(t *testing.T) { - actual := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName" +func TestFormatCloudVMClusterID(t *testing.T) { + actual := NewCloudVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName" if actual != expected { t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) } } -func TestParseVaultID(t *testing.T) { +func TestParseCloudVMClusterID(t *testing.T) { testData := []struct { Input string Error bool - Expected *VaultId + Expected *CloudVMClusterId }{ { // Incomplete URI @@ -73,33 +73,33 @@ func TestParseVaultID(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VaultName: "vaultName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName", + Expected: &CloudVMClusterId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CloudVmClusterName: "cloudVmClusterName", }, }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName/extra", Error: true, }, } for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ParseVaultID(v.Input) + actual, err := ParseCloudVMClusterID(v.Input) if err != nil { if v.Error { continue @@ -119,18 +119,18 @@ func TestParseVaultID(t *testing.T) { t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) } - if actual.VaultName != v.Expected.VaultName { - t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) + if actual.CloudVmClusterName != v.Expected.CloudVmClusterName { + t.Fatalf("Expected %q but got %q for CloudVmClusterName", v.Expected.CloudVmClusterName, actual.CloudVmClusterName) } } } -func TestParseVaultIDInsensitively(t *testing.T) { +func TestParseCloudVMClusterIDInsensitively(t *testing.T) { testData := []struct { Input string Error bool - Expected *VaultId + Expected *CloudVMClusterId }{ { // Incomplete URI @@ -189,57 +189,57 @@ func TestParseVaultIDInsensitively(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdVmClUsTeRs", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VaultName: "vaultName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName", + Expected: &CloudVMClusterId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CloudVmClusterName: "cloudVmClusterName", }, }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName/extra", Error: true, }, { // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - VaultName: "vAuLtNaMe", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdVmClUsTeRs/cLoUdVmClUsTeRnAmE", + Expected: &CloudVMClusterId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + CloudVmClusterName: "cLoUdVmClUsTeRnAmE", }, }, { // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/extra", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdVmClUsTeRs/cLoUdVmClUsTeRnAmE/extra", Error: true, }, } for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ParseVaultIDInsensitively(v.Input) + actual, err := ParseCloudVMClusterIDInsensitively(v.Input) if err != nil { if v.Error { continue @@ -259,17 +259,17 @@ func TestParseVaultIDInsensitively(t *testing.T) { t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) } - if actual.VaultName != v.Expected.VaultName { - t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) + if actual.CloudVmClusterName != v.Expected.CloudVmClusterName { + t.Fatalf("Expected %q but got %q for CloudVmClusterName", v.Expected.CloudVmClusterName, actual.CloudVmClusterName) } } } -func TestSegmentsForVaultId(t *testing.T) { - segments := VaultId{}.Segments() +func TestSegmentsForCloudVMClusterId(t *testing.T) { + segments := CloudVMClusterId{}.Segments() if len(segments) == 0 { - t.Fatalf("VaultId has no segments") + t.Fatalf("CloudVMClusterId has no segments") } uniqueNames := make(map[string]struct{}, 0) diff --git a/resource-manager/oracledatabase/2025-09-01/dbnodes/id_dbnode.go b/resource-manager/oracledatabase/2025-09-01/dbnodes/id_dbnode.go new file mode 100644 index 00000000000..ad7d9c0f415 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbnodes/id_dbnode.go @@ -0,0 +1,139 @@ +package dbnodes + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&DbNodeId{}) +} + +var _ resourceids.ResourceId = &DbNodeId{} + +// DbNodeId is a struct representing the Resource ID for a Db Node +type DbNodeId struct { + SubscriptionId string + ResourceGroupName string + CloudVmClusterName string + DbNodeName string +} + +// NewDbNodeID returns a new DbNodeId struct +func NewDbNodeID(subscriptionId string, resourceGroupName string, cloudVmClusterName string, dbNodeName string) DbNodeId { + return DbNodeId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CloudVmClusterName: cloudVmClusterName, + DbNodeName: dbNodeName, + } +} + +// ParseDbNodeID parses 'input' into a DbNodeId +func ParseDbNodeID(input string) (*DbNodeId, error) { + parser := resourceids.NewParserFromResourceIdType(&DbNodeId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DbNodeId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseDbNodeIDInsensitively parses 'input' case-insensitively into a DbNodeId +// note: this method should only be used for API response data and not user input +func ParseDbNodeIDInsensitively(input string) (*DbNodeId, error) { + parser := resourceids.NewParserFromResourceIdType(&DbNodeId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DbNodeId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DbNodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.CloudVmClusterName, ok = input.Parsed["cloudVmClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudVmClusterName", input) + } + + if id.DbNodeName, ok = input.Parsed["dbNodeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dbNodeName", input) + } + + return nil +} + +// ValidateDbNodeID checks that 'input' can be parsed as a Db Node ID +func ValidateDbNodeID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDbNodeID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Db Node ID +func (id DbNodeId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Oracle.Database/cloudVmClusters/%s/dbNodes/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CloudVmClusterName, id.DbNodeName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Db Node ID +func (id DbNodeId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticCloudVmClusters", "cloudVmClusters", "cloudVmClusters"), + resourceids.UserSpecifiedSegment("cloudVmClusterName", "cloudVmClusterName"), + resourceids.StaticSegment("staticDbNodes", "dbNodes", "dbNodes"), + resourceids.UserSpecifiedSegment("dbNodeName", "dbNodeName"), + } +} + +// String returns a human-readable description of this Db Node ID +func (id DbNodeId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cloud Vm Cluster Name: %q", id.CloudVmClusterName), + fmt.Sprintf("Db Node Name: %q", id.DbNodeName), + } + return fmt.Sprintf("Db Node (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbnodes/id_dbnode_test.go b/resource-manager/oracledatabase/2025-09-01/dbnodes/id_dbnode_test.go new file mode 100644 index 00000000000..dd69225af1d --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbnodes/id_dbnode_test.go @@ -0,0 +1,327 @@ +package dbnodes + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &DbNodeId{} + +func TestNewDbNodeID(t *testing.T) { + id := NewDbNodeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName", "dbNodeName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.CloudVmClusterName != "cloudVmClusterName" { + t.Fatalf("Expected %q but got %q for Segment 'CloudVmClusterName'", id.CloudVmClusterName, "cloudVmClusterName") + } + + if id.DbNodeName != "dbNodeName" { + t.Fatalf("Expected %q but got %q for Segment 'DbNodeName'", id.DbNodeName, "dbNodeName") + } +} + +func TestFormatDbNodeID(t *testing.T) { + actual := NewDbNodeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName", "dbNodeName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName/dbNodes/dbNodeName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseDbNodeID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *DbNodeId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName/dbNodes", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName/dbNodes/dbNodeName", + Expected: &DbNodeId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CloudVmClusterName: "cloudVmClusterName", + DbNodeName: "dbNodeName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName/dbNodes/dbNodeName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseDbNodeID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.CloudVmClusterName != v.Expected.CloudVmClusterName { + t.Fatalf("Expected %q but got %q for CloudVmClusterName", v.Expected.CloudVmClusterName, actual.CloudVmClusterName) + } + + if actual.DbNodeName != v.Expected.DbNodeName { + t.Fatalf("Expected %q but got %q for DbNodeName", v.Expected.DbNodeName, actual.DbNodeName) + } + + } +} + +func TestParseDbNodeIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *DbNodeId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdVmClUsTeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdVmClUsTeRs/cLoUdVmClUsTeRnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName/dbNodes", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdVmClUsTeRs/cLoUdVmClUsTeRnAmE/dBnOdEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName/dbNodes/dbNodeName", + Expected: &DbNodeId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CloudVmClusterName: "cloudVmClusterName", + DbNodeName: "dbNodeName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName/dbNodes/dbNodeName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdVmClUsTeRs/cLoUdVmClUsTeRnAmE/dBnOdEs/dBnOdEnAmE", + Expected: &DbNodeId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + CloudVmClusterName: "cLoUdVmClUsTeRnAmE", + DbNodeName: "dBnOdEnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdVmClUsTeRs/cLoUdVmClUsTeRnAmE/dBnOdEs/dBnOdEnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseDbNodeIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.CloudVmClusterName != v.Expected.CloudVmClusterName { + t.Fatalf("Expected %q but got %q for CloudVmClusterName", v.Expected.CloudVmClusterName, actual.CloudVmClusterName) + } + + if actual.DbNodeName != v.Expected.DbNodeName { + t.Fatalf("Expected %q but got %q for DbNodeName", v.Expected.DbNodeName, actual.DbNodeName) + } + + } +} + +func TestSegmentsForDbNodeId(t *testing.T) { + segments := DbNodeId{}.Segments() + if len(segments) == 0 { + t.Fatalf("DbNodeId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbnodes/method_action.go b/resource-manager/oracledatabase/2025-09-01/dbnodes/method_action.go new file mode 100644 index 00000000000..5183df9c35c --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbnodes/method_action.go @@ -0,0 +1,75 @@ +package dbnodes + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ActionOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *DbNode +} + +// Action ... +func (c DbNodesClient) Action(ctx context.Context, id DbNodeId, input DbNodeAction) (result ActionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/action", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ActionThenPoll performs Action then polls until it's completed +func (c DbNodesClient) ActionThenPoll(ctx context.Context, id DbNodeId, input DbNodeAction) error { + result, err := c.Action(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Action: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Action: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbnodes/method_get.go b/resource-manager/oracledatabase/2025-09-01/dbnodes/method_get.go new file mode 100644 index 00000000000..eeac598cb9c --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbnodes/method_get.go @@ -0,0 +1,53 @@ +package dbnodes + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DbNode +} + +// Get ... +func (c DbNodesClient) Get(ctx context.Context, id DbNodeId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model DbNode + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbnodes/method_listbyparent.go b/resource-manager/oracledatabase/2025-09-01/dbnodes/method_listbyparent.go new file mode 100644 index 00000000000..d851f56f03a --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbnodes/method_listbyparent.go @@ -0,0 +1,105 @@ +package dbnodes + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByParentOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DbNode +} + +type ListByParentCompleteResult struct { + LatestHttpResponse *http.Response + Items []DbNode +} + +type ListByParentCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByParentCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByParent ... +func (c DbNodesClient) ListByParent(ctx context.Context, id CloudVMClusterId) (result ListByParentOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByParentCustomPager{}, + Path: fmt.Sprintf("%s/dbNodes", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]DbNode `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByParentComplete retrieves all the results into a single object +func (c DbNodesClient) ListByParentComplete(ctx context.Context, id CloudVMClusterId) (ListByParentCompleteResult, error) { + return c.ListByParentCompleteMatchingPredicate(ctx, id, DbNodeOperationPredicate{}) +} + +// ListByParentCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DbNodesClient) ListByParentCompleteMatchingPredicate(ctx context.Context, id CloudVMClusterId, predicate DbNodeOperationPredicate) (result ListByParentCompleteResult, err error) { + items := make([]DbNode, 0) + + resp, err := c.ListByParent(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByParentCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbnodes/model_dbnode.go b/resource-manager/oracledatabase/2025-09-01/dbnodes/model_dbnode.go new file mode 100644 index 00000000000..fb43a32d89f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbnodes/model_dbnode.go @@ -0,0 +1,16 @@ +package dbnodes + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbNode struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DbNodeProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbnodes/model_dbnodeaction.go b/resource-manager/oracledatabase/2025-09-01/dbnodes/model_dbnodeaction.go new file mode 100644 index 00000000000..c73027704e8 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbnodes/model_dbnodeaction.go @@ -0,0 +1,8 @@ +package dbnodes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbNodeAction struct { + Action DbNodeActionEnum `json:"action"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbnodes/model_dbnodeproperties.go b/resource-manager/oracledatabase/2025-09-01/dbnodes/model_dbnodeproperties.go new file mode 100644 index 00000000000..f8ed526badb --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbnodes/model_dbnodeproperties.go @@ -0,0 +1,69 @@ +package dbnodes + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbNodeProperties struct { + AdditionalDetails *string `json:"additionalDetails,omitempty"` + BackupIPId *string `json:"backupIpId,omitempty"` + BackupVnic2Id *string `json:"backupVnic2Id,omitempty"` + BackupVnicId *string `json:"backupVnicId,omitempty"` + CpuCoreCount *int64 `json:"cpuCoreCount,omitempty"` + DbNodeStorageSizeInGbs *int64 `json:"dbNodeStorageSizeInGbs,omitempty"` + DbServerId *string `json:"dbServerId,omitempty"` + DbSystemId string `json:"dbSystemId"` + FaultDomain *string `json:"faultDomain,omitempty"` + HostIPId *string `json:"hostIpId,omitempty"` + Hostname *string `json:"hostname,omitempty"` + LifecycleDetails *string `json:"lifecycleDetails,omitempty"` + LifecycleState DbNodeProvisioningState `json:"lifecycleState"` + MaintenanceType *DbNodeMaintenanceType `json:"maintenanceType,omitempty"` + MemorySizeInGbs *int64 `json:"memorySizeInGbs,omitempty"` + Ocid string `json:"ocid"` + ProvisioningState *ResourceProvisioningState `json:"provisioningState,omitempty"` + SoftwareStorageSizeInGb *int64 `json:"softwareStorageSizeInGb,omitempty"` + TimeCreated string `json:"timeCreated"` + TimeMaintenanceWindowEnd *string `json:"timeMaintenanceWindowEnd,omitempty"` + TimeMaintenanceWindowStart *string `json:"timeMaintenanceWindowStart,omitempty"` + Vnic2Id *string `json:"vnic2Id,omitempty"` + VnicId string `json:"vnicId"` +} + +func (o *DbNodeProperties) GetTimeCreatedAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *DbNodeProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = formatted +} + +func (o *DbNodeProperties) GetTimeMaintenanceWindowEndAsTime() (*time.Time, error) { + if o.TimeMaintenanceWindowEnd == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeMaintenanceWindowEnd, "2006-01-02T15:04:05Z07:00") +} + +func (o *DbNodeProperties) SetTimeMaintenanceWindowEndAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeMaintenanceWindowEnd = &formatted +} + +func (o *DbNodeProperties) GetTimeMaintenanceWindowStartAsTime() (*time.Time, error) { + if o.TimeMaintenanceWindowStart == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeMaintenanceWindowStart, "2006-01-02T15:04:05Z07:00") +} + +func (o *DbNodeProperties) SetTimeMaintenanceWindowStartAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeMaintenanceWindowStart = &formatted +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbnodes/predicates.go b/resource-manager/oracledatabase/2025-09-01/dbnodes/predicates.go new file mode 100644 index 00000000000..d8b48325d58 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbnodes/predicates.go @@ -0,0 +1,27 @@ +package dbnodes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbNodeOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DbNodeOperationPredicate) Matches(input DbNode) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/datamove/version.go b/resource-manager/oracledatabase/2025-09-01/dbnodes/version.go similarity index 63% rename from resource-manager/recoveryservicesbackup/2025-02-01/datamove/version.go rename to resource-manager/oracledatabase/2025-09-01/dbnodes/version.go index 8eccf34fb2e..08d7e5d2304 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/datamove/version.go +++ b/resource-manager/oracledatabase/2025-09-01/dbnodes/version.go @@ -1,10 +1,10 @@ -package datamove +package dbnodes // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2025-02-01" +const defaultApiVersion = "2025-09-01" func userAgent() string { - return "hashicorp/go-azure-sdk/datamove/2025-02-01" + return "hashicorp/go-azure-sdk/dbnodes/2025-09-01" } diff --git a/resource-manager/oracledatabase/2025-09-01/dbservers/README.md b/resource-manager/oracledatabase/2025-09-01/dbservers/README.md new file mode 100644 index 00000000000..c2177b1f571 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbservers/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/dbservers` Documentation + +The `dbservers` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/dbservers" +``` + + +### Client Initialization + +```go +client := dbservers.NewDbServersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DbServersClient.Get` + +```go +ctx := context.TODO() +id := dbservers.NewDbServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudExadataInfrastructureName", "dbServerName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DbServersClient.ListByParent` + +```go +ctx := context.TODO() +id := dbservers.NewCloudExadataInfrastructureID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudExadataInfrastructureName") + +// alternatively `client.ListByParent(ctx, id)` can be used to do batched pagination +items, err := client.ListByParentComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/dbservers/client.go b/resource-manager/oracledatabase/2025-09-01/dbservers/client.go new file mode 100644 index 00000000000..29a4e148e48 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbservers/client.go @@ -0,0 +1,26 @@ +package dbservers + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbServersClient struct { + Client *resourcemanager.Client +} + +func NewDbServersClientWithBaseURI(sdkApi sdkEnv.Api) (*DbServersClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "dbservers", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DbServersClient: %+v", err) + } + + return &DbServersClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbservers/constants.go b/resource-manager/oracledatabase/2025-09-01/dbservers/constants.go new file mode 100644 index 00000000000..19de0c5e468 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbservers/constants.go @@ -0,0 +1,195 @@ +package dbservers + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComputeModel string + +const ( + ComputeModelECPU ComputeModel = "ECPU" + ComputeModelOCPU ComputeModel = "OCPU" +) + +func PossibleValuesForComputeModel() []string { + return []string{ + string(ComputeModelECPU), + string(ComputeModelOCPU), + } +} + +func (s *ComputeModel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseComputeModel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseComputeModel(input string) (*ComputeModel, error) { + vals := map[string]ComputeModel{ + "ecpu": ComputeModelECPU, + "ocpu": ComputeModelOCPU, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComputeModel(input) + return &out, nil +} + +type DbServerPatchingStatus string + +const ( + DbServerPatchingStatusComplete DbServerPatchingStatus = "Complete" + DbServerPatchingStatusFailed DbServerPatchingStatus = "Failed" + DbServerPatchingStatusMaintenanceInProgress DbServerPatchingStatus = "MaintenanceInProgress" + DbServerPatchingStatusScheduled DbServerPatchingStatus = "Scheduled" +) + +func PossibleValuesForDbServerPatchingStatus() []string { + return []string{ + string(DbServerPatchingStatusComplete), + string(DbServerPatchingStatusFailed), + string(DbServerPatchingStatusMaintenanceInProgress), + string(DbServerPatchingStatusScheduled), + } +} + +func (s *DbServerPatchingStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDbServerPatchingStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDbServerPatchingStatus(input string) (*DbServerPatchingStatus, error) { + vals := map[string]DbServerPatchingStatus{ + "complete": DbServerPatchingStatusComplete, + "failed": DbServerPatchingStatusFailed, + "maintenanceinprogress": DbServerPatchingStatusMaintenanceInProgress, + "scheduled": DbServerPatchingStatusScheduled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DbServerPatchingStatus(input) + return &out, nil +} + +type DbServerProvisioningState string + +const ( + DbServerProvisioningStateAvailable DbServerProvisioningState = "Available" + DbServerProvisioningStateCreating DbServerProvisioningState = "Creating" + DbServerProvisioningStateDeleted DbServerProvisioningState = "Deleted" + DbServerProvisioningStateDeleting DbServerProvisioningState = "Deleting" + DbServerProvisioningStateMaintenanceInProgress DbServerProvisioningState = "MaintenanceInProgress" + DbServerProvisioningStateUnavailable DbServerProvisioningState = "Unavailable" +) + +func PossibleValuesForDbServerProvisioningState() []string { + return []string{ + string(DbServerProvisioningStateAvailable), + string(DbServerProvisioningStateCreating), + string(DbServerProvisioningStateDeleted), + string(DbServerProvisioningStateDeleting), + string(DbServerProvisioningStateMaintenanceInProgress), + string(DbServerProvisioningStateUnavailable), + } +} + +func (s *DbServerProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDbServerProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDbServerProvisioningState(input string) (*DbServerProvisioningState, error) { + vals := map[string]DbServerProvisioningState{ + "available": DbServerProvisioningStateAvailable, + "creating": DbServerProvisioningStateCreating, + "deleted": DbServerProvisioningStateDeleted, + "deleting": DbServerProvisioningStateDeleting, + "maintenanceinprogress": DbServerProvisioningStateMaintenanceInProgress, + "unavailable": DbServerProvisioningStateUnavailable, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DbServerProvisioningState(input) + return &out, nil +} + +type ResourceProvisioningState string + +const ( + ResourceProvisioningStateCanceled ResourceProvisioningState = "Canceled" + ResourceProvisioningStateFailed ResourceProvisioningState = "Failed" + ResourceProvisioningStateSucceeded ResourceProvisioningState = "Succeeded" +) + +func PossibleValuesForResourceProvisioningState() []string { + return []string{ + string(ResourceProvisioningStateCanceled), + string(ResourceProvisioningStateFailed), + string(ResourceProvisioningStateSucceeded), + } +} + +func (s *ResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseResourceProvisioningState(input string) (*ResourceProvisioningState, error) { + vals := map[string]ResourceProvisioningState{ + "canceled": ResourceProvisioningStateCanceled, + "failed": ResourceProvisioningStateFailed, + "succeeded": ResourceProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceProvisioningState(input) + return &out, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbservers/id_cloudexadatainfrastructure.go b/resource-manager/oracledatabase/2025-09-01/dbservers/id_cloudexadatainfrastructure.go new file mode 100644 index 00000000000..1a0d2eda372 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbservers/id_cloudexadatainfrastructure.go @@ -0,0 +1,130 @@ +package dbservers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&CloudExadataInfrastructureId{}) +} + +var _ resourceids.ResourceId = &CloudExadataInfrastructureId{} + +// CloudExadataInfrastructureId is a struct representing the Resource ID for a Cloud Exadata Infrastructure +type CloudExadataInfrastructureId struct { + SubscriptionId string + ResourceGroupName string + CloudExadataInfrastructureName string +} + +// NewCloudExadataInfrastructureID returns a new CloudExadataInfrastructureId struct +func NewCloudExadataInfrastructureID(subscriptionId string, resourceGroupName string, cloudExadataInfrastructureName string) CloudExadataInfrastructureId { + return CloudExadataInfrastructureId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CloudExadataInfrastructureName: cloudExadataInfrastructureName, + } +} + +// ParseCloudExadataInfrastructureID parses 'input' into a CloudExadataInfrastructureId +func ParseCloudExadataInfrastructureID(input string) (*CloudExadataInfrastructureId, error) { + parser := resourceids.NewParserFromResourceIdType(&CloudExadataInfrastructureId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CloudExadataInfrastructureId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCloudExadataInfrastructureIDInsensitively parses 'input' case-insensitively into a CloudExadataInfrastructureId +// note: this method should only be used for API response data and not user input +func ParseCloudExadataInfrastructureIDInsensitively(input string) (*CloudExadataInfrastructureId, error) { + parser := resourceids.NewParserFromResourceIdType(&CloudExadataInfrastructureId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CloudExadataInfrastructureId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CloudExadataInfrastructureId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.CloudExadataInfrastructureName, ok = input.Parsed["cloudExadataInfrastructureName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudExadataInfrastructureName", input) + } + + return nil +} + +// ValidateCloudExadataInfrastructureID checks that 'input' can be parsed as a Cloud Exadata Infrastructure ID +func ValidateCloudExadataInfrastructureID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseCloudExadataInfrastructureID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cloud Exadata Infrastructure ID +func (id CloudExadataInfrastructureId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Oracle.Database/cloudExadataInfrastructures/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CloudExadataInfrastructureName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cloud Exadata Infrastructure ID +func (id CloudExadataInfrastructureId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticCloudExadataInfrastructures", "cloudExadataInfrastructures", "cloudExadataInfrastructures"), + resourceids.UserSpecifiedSegment("cloudExadataInfrastructureName", "cloudExadataInfrastructureName"), + } +} + +// String returns a human-readable description of this Cloud Exadata Infrastructure ID +func (id CloudExadataInfrastructureId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cloud Exadata Infrastructure Name: %q", id.CloudExadataInfrastructureName), + } + return fmt.Sprintf("Cloud Exadata Infrastructure (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbservers/id_cloudexadatainfrastructure_test.go b/resource-manager/oracledatabase/2025-09-01/dbservers/id_cloudexadatainfrastructure_test.go new file mode 100644 index 00000000000..ffa6cef424a --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbservers/id_cloudexadatainfrastructure_test.go @@ -0,0 +1,282 @@ +package dbservers + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &CloudExadataInfrastructureId{} + +func TestNewCloudExadataInfrastructureID(t *testing.T) { + id := NewCloudExadataInfrastructureID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudExadataInfrastructureName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.CloudExadataInfrastructureName != "cloudExadataInfrastructureName" { + t.Fatalf("Expected %q but got %q for Segment 'CloudExadataInfrastructureName'", id.CloudExadataInfrastructureName, "cloudExadataInfrastructureName") + } +} + +func TestFormatCloudExadataInfrastructureID(t *testing.T) { + actual := NewCloudExadataInfrastructureID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudExadataInfrastructureName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures/cloudExadataInfrastructureName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseCloudExadataInfrastructureID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CloudExadataInfrastructureId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures/cloudExadataInfrastructureName", + Expected: &CloudExadataInfrastructureId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CloudExadataInfrastructureName: "cloudExadataInfrastructureName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures/cloudExadataInfrastructureName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCloudExadataInfrastructureID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.CloudExadataInfrastructureName != v.Expected.CloudExadataInfrastructureName { + t.Fatalf("Expected %q but got %q for CloudExadataInfrastructureName", v.Expected.CloudExadataInfrastructureName, actual.CloudExadataInfrastructureName) + } + + } +} + +func TestParseCloudExadataInfrastructureIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CloudExadataInfrastructureId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdExAdAtAiNfRaStRuCtUrEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures/cloudExadataInfrastructureName", + Expected: &CloudExadataInfrastructureId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CloudExadataInfrastructureName: "cloudExadataInfrastructureName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures/cloudExadataInfrastructureName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdExAdAtAiNfRaStRuCtUrEs/cLoUdExAdAtAiNfRaStRuCtUrEnAmE", + Expected: &CloudExadataInfrastructureId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + CloudExadataInfrastructureName: "cLoUdExAdAtAiNfRaStRuCtUrEnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdExAdAtAiNfRaStRuCtUrEs/cLoUdExAdAtAiNfRaStRuCtUrEnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCloudExadataInfrastructureIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.CloudExadataInfrastructureName != v.Expected.CloudExadataInfrastructureName { + t.Fatalf("Expected %q but got %q for CloudExadataInfrastructureName", v.Expected.CloudExadataInfrastructureName, actual.CloudExadataInfrastructureName) + } + + } +} + +func TestSegmentsForCloudExadataInfrastructureId(t *testing.T) { + segments := CloudExadataInfrastructureId{}.Segments() + if len(segments) == 0 { + t.Fatalf("CloudExadataInfrastructureId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbservers/id_dbserver.go b/resource-manager/oracledatabase/2025-09-01/dbservers/id_dbserver.go new file mode 100644 index 00000000000..d8e6ee908f4 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbservers/id_dbserver.go @@ -0,0 +1,139 @@ +package dbservers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&DbServerId{}) +} + +var _ resourceids.ResourceId = &DbServerId{} + +// DbServerId is a struct representing the Resource ID for a Db Server +type DbServerId struct { + SubscriptionId string + ResourceGroupName string + CloudExadataInfrastructureName string + DbServerName string +} + +// NewDbServerID returns a new DbServerId struct +func NewDbServerID(subscriptionId string, resourceGroupName string, cloudExadataInfrastructureName string, dbServerName string) DbServerId { + return DbServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CloudExadataInfrastructureName: cloudExadataInfrastructureName, + DbServerName: dbServerName, + } +} + +// ParseDbServerID parses 'input' into a DbServerId +func ParseDbServerID(input string) (*DbServerId, error) { + parser := resourceids.NewParserFromResourceIdType(&DbServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DbServerId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseDbServerIDInsensitively parses 'input' case-insensitively into a DbServerId +// note: this method should only be used for API response data and not user input +func ParseDbServerIDInsensitively(input string) (*DbServerId, error) { + parser := resourceids.NewParserFromResourceIdType(&DbServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DbServerId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DbServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.CloudExadataInfrastructureName, ok = input.Parsed["cloudExadataInfrastructureName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudExadataInfrastructureName", input) + } + + if id.DbServerName, ok = input.Parsed["dbServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dbServerName", input) + } + + return nil +} + +// ValidateDbServerID checks that 'input' can be parsed as a Db Server ID +func ValidateDbServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDbServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Db Server ID +func (id DbServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Oracle.Database/cloudExadataInfrastructures/%s/dbServers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CloudExadataInfrastructureName, id.DbServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Db Server ID +func (id DbServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticCloudExadataInfrastructures", "cloudExadataInfrastructures", "cloudExadataInfrastructures"), + resourceids.UserSpecifiedSegment("cloudExadataInfrastructureName", "cloudExadataInfrastructureName"), + resourceids.StaticSegment("staticDbServers", "dbServers", "dbServers"), + resourceids.UserSpecifiedSegment("dbServerName", "dbServerName"), + } +} + +// String returns a human-readable description of this Db Server ID +func (id DbServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cloud Exadata Infrastructure Name: %q", id.CloudExadataInfrastructureName), + fmt.Sprintf("Db Server Name: %q", id.DbServerName), + } + return fmt.Sprintf("Db Server (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbservers/id_dbserver_test.go b/resource-manager/oracledatabase/2025-09-01/dbservers/id_dbserver_test.go new file mode 100644 index 00000000000..27ccb910619 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbservers/id_dbserver_test.go @@ -0,0 +1,327 @@ +package dbservers + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &DbServerId{} + +func TestNewDbServerID(t *testing.T) { + id := NewDbServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudExadataInfrastructureName", "dbServerName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.CloudExadataInfrastructureName != "cloudExadataInfrastructureName" { + t.Fatalf("Expected %q but got %q for Segment 'CloudExadataInfrastructureName'", id.CloudExadataInfrastructureName, "cloudExadataInfrastructureName") + } + + if id.DbServerName != "dbServerName" { + t.Fatalf("Expected %q but got %q for Segment 'DbServerName'", id.DbServerName, "dbServerName") + } +} + +func TestFormatDbServerID(t *testing.T) { + actual := NewDbServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudExadataInfrastructureName", "dbServerName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures/cloudExadataInfrastructureName/dbServers/dbServerName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseDbServerID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *DbServerId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures/cloudExadataInfrastructureName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures/cloudExadataInfrastructureName/dbServers", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures/cloudExadataInfrastructureName/dbServers/dbServerName", + Expected: &DbServerId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CloudExadataInfrastructureName: "cloudExadataInfrastructureName", + DbServerName: "dbServerName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures/cloudExadataInfrastructureName/dbServers/dbServerName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseDbServerID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.CloudExadataInfrastructureName != v.Expected.CloudExadataInfrastructureName { + t.Fatalf("Expected %q but got %q for CloudExadataInfrastructureName", v.Expected.CloudExadataInfrastructureName, actual.CloudExadataInfrastructureName) + } + + if actual.DbServerName != v.Expected.DbServerName { + t.Fatalf("Expected %q but got %q for DbServerName", v.Expected.DbServerName, actual.DbServerName) + } + + } +} + +func TestParseDbServerIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *DbServerId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdExAdAtAiNfRaStRuCtUrEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures/cloudExadataInfrastructureName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdExAdAtAiNfRaStRuCtUrEs/cLoUdExAdAtAiNfRaStRuCtUrEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures/cloudExadataInfrastructureName/dbServers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdExAdAtAiNfRaStRuCtUrEs/cLoUdExAdAtAiNfRaStRuCtUrEnAmE/dBsErVeRs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures/cloudExadataInfrastructureName/dbServers/dbServerName", + Expected: &DbServerId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CloudExadataInfrastructureName: "cloudExadataInfrastructureName", + DbServerName: "dbServerName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudExadataInfrastructures/cloudExadataInfrastructureName/dbServers/dbServerName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdExAdAtAiNfRaStRuCtUrEs/cLoUdExAdAtAiNfRaStRuCtUrEnAmE/dBsErVeRs/dBsErVeRnAmE", + Expected: &DbServerId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + CloudExadataInfrastructureName: "cLoUdExAdAtAiNfRaStRuCtUrEnAmE", + DbServerName: "dBsErVeRnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdExAdAtAiNfRaStRuCtUrEs/cLoUdExAdAtAiNfRaStRuCtUrEnAmE/dBsErVeRs/dBsErVeRnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseDbServerIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.CloudExadataInfrastructureName != v.Expected.CloudExadataInfrastructureName { + t.Fatalf("Expected %q but got %q for CloudExadataInfrastructureName", v.Expected.CloudExadataInfrastructureName, actual.CloudExadataInfrastructureName) + } + + if actual.DbServerName != v.Expected.DbServerName { + t.Fatalf("Expected %q but got %q for DbServerName", v.Expected.DbServerName, actual.DbServerName) + } + + } +} + +func TestSegmentsForDbServerId(t *testing.T) { + segments := DbServerId{}.Segments() + if len(segments) == 0 { + t.Fatalf("DbServerId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbservers/method_get.go b/resource-manager/oracledatabase/2025-09-01/dbservers/method_get.go new file mode 100644 index 00000000000..2a0abdf7d6d --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbservers/method_get.go @@ -0,0 +1,53 @@ +package dbservers + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DbServer +} + +// Get ... +func (c DbServersClient) Get(ctx context.Context, id DbServerId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model DbServer + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbservers/method_listbyparent.go b/resource-manager/oracledatabase/2025-09-01/dbservers/method_listbyparent.go new file mode 100644 index 00000000000..2402d07b98e --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbservers/method_listbyparent.go @@ -0,0 +1,105 @@ +package dbservers + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByParentOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DbServer +} + +type ListByParentCompleteResult struct { + LatestHttpResponse *http.Response + Items []DbServer +} + +type ListByParentCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByParentCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByParent ... +func (c DbServersClient) ListByParent(ctx context.Context, id CloudExadataInfrastructureId) (result ListByParentOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByParentCustomPager{}, + Path: fmt.Sprintf("%s/dbServers", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]DbServer `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByParentComplete retrieves all the results into a single object +func (c DbServersClient) ListByParentComplete(ctx context.Context, id CloudExadataInfrastructureId) (ListByParentCompleteResult, error) { + return c.ListByParentCompleteMatchingPredicate(ctx, id, DbServerOperationPredicate{}) +} + +// ListByParentCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DbServersClient) ListByParentCompleteMatchingPredicate(ctx context.Context, id CloudExadataInfrastructureId, predicate DbServerOperationPredicate) (result ListByParentCompleteResult, err error) { + items := make([]DbServer, 0) + + resp, err := c.ListByParent(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByParentCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbservers/model_dbserver.go b/resource-manager/oracledatabase/2025-09-01/dbservers/model_dbserver.go new file mode 100644 index 00000000000..a88571f8613 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbservers/model_dbserver.go @@ -0,0 +1,16 @@ +package dbservers + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbServer struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DbServerProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbservers/model_dbserverpatchingdetails.go b/resource-manager/oracledatabase/2025-09-01/dbservers/model_dbserverpatchingdetails.go new file mode 100644 index 00000000000..5bb65512c64 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbservers/model_dbserverpatchingdetails.go @@ -0,0 +1,41 @@ +package dbservers + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbServerPatchingDetails struct { + EstimatedPatchDuration *int64 `json:"estimatedPatchDuration,omitempty"` + PatchingStatus *DbServerPatchingStatus `json:"patchingStatus,omitempty"` + TimePatchingEnded *string `json:"timePatchingEnded,omitempty"` + TimePatchingStarted *string `json:"timePatchingStarted,omitempty"` +} + +func (o *DbServerPatchingDetails) GetTimePatchingEndedAsTime() (*time.Time, error) { + if o.TimePatchingEnded == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimePatchingEnded, "2006-01-02T15:04:05Z07:00") +} + +func (o *DbServerPatchingDetails) SetTimePatchingEndedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimePatchingEnded = &formatted +} + +func (o *DbServerPatchingDetails) GetTimePatchingStartedAsTime() (*time.Time, error) { + if o.TimePatchingStarted == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimePatchingStarted, "2006-01-02T15:04:05Z07:00") +} + +func (o *DbServerPatchingDetails) SetTimePatchingStartedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimePatchingStarted = &formatted +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbservers/model_dbserverproperties.go b/resource-manager/oracledatabase/2025-09-01/dbservers/model_dbserverproperties.go new file mode 100644 index 00000000000..16128373b22 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbservers/model_dbserverproperties.go @@ -0,0 +1,46 @@ +package dbservers + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbServerProperties struct { + AutonomousVMClusterIds *[]string `json:"autonomousVmClusterIds,omitempty"` + AutonomousVirtualMachineIds *[]string `json:"autonomousVirtualMachineIds,omitempty"` + CompartmentId *string `json:"compartmentId,omitempty"` + ComputeModel *ComputeModel `json:"computeModel,omitempty"` + CpuCoreCount *int64 `json:"cpuCoreCount,omitempty"` + DbNodeIds *[]string `json:"dbNodeIds,omitempty"` + DbNodeStorageSizeInGbs *int64 `json:"dbNodeStorageSizeInGbs,omitempty"` + DbServerPatchingDetails *DbServerPatchingDetails `json:"dbServerPatchingDetails,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + ExadataInfrastructureId *string `json:"exadataInfrastructureId,omitempty"` + LifecycleDetails *string `json:"lifecycleDetails,omitempty"` + LifecycleState *DbServerProvisioningState `json:"lifecycleState,omitempty"` + MaxCPUCount *int64 `json:"maxCpuCount,omitempty"` + MaxDbNodeStorageInGbs *int64 `json:"maxDbNodeStorageInGbs,omitempty"` + MaxMemoryInGbs *int64 `json:"maxMemoryInGbs,omitempty"` + MemorySizeInGbs *int64 `json:"memorySizeInGbs,omitempty"` + Ocid *string `json:"ocid,omitempty"` + ProvisioningState *ResourceProvisioningState `json:"provisioningState,omitempty"` + Shape *string `json:"shape,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + VMClusterIds *[]string `json:"vmClusterIds,omitempty"` +} + +func (o *DbServerProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *DbServerProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbservers/predicates.go b/resource-manager/oracledatabase/2025-09-01/dbservers/predicates.go new file mode 100644 index 00000000000..dfcc35d7ef6 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbservers/predicates.go @@ -0,0 +1,27 @@ +package dbservers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbServerOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DbServerOperationPredicate) Matches(input DbServer) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/version.go b/resource-manager/oracledatabase/2025-09-01/dbservers/version.go similarity index 62% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/version.go rename to resource-manager/oracledatabase/2025-09-01/dbservers/version.go index a3f0f8af5fb..7d8c85546f0 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/version.go +++ b/resource-manager/oracledatabase/2025-09-01/dbservers/version.go @@ -1,10 +1,10 @@ -package operation +package dbservers // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2025-02-01" +const defaultApiVersion = "2025-09-01" func userAgent() string { - return "hashicorp/go-azure-sdk/operation/2025-02-01" + return "hashicorp/go-azure-sdk/dbservers/2025-09-01" } diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystems/README.md b/resource-manager/oracledatabase/2025-09-01/dbsystems/README.md new file mode 100644 index 00000000000..f6b80a6db8f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystems/README.md @@ -0,0 +1,117 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/dbsystems` Documentation + +The `dbsystems` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/dbsystems" +``` + + +### Client Initialization + +```go +client := dbsystems.NewDbSystemsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DbSystemsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := dbsystems.NewDbSystemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dbSystemName") + +payload := dbsystems.DbSystem{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DbSystemsClient.Delete` + +```go +ctx := context.TODO() +id := dbsystems.NewDbSystemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dbSystemName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DbSystemsClient.Get` + +```go +ctx := context.TODO() +id := dbsystems.NewDbSystemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dbSystemName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DbSystemsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DbSystemsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DbSystemsClient.Update` + +```go +ctx := context.TODO() +id := dbsystems.NewDbSystemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dbSystemName") + +payload := dbsystems.DbSystemUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystems/client.go b/resource-manager/oracledatabase/2025-09-01/dbsystems/client.go new file mode 100644 index 00000000000..ff8d6b80e95 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystems/client.go @@ -0,0 +1,26 @@ +package dbsystems + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbSystemsClient struct { + Client *resourcemanager.Client +} + +func NewDbSystemsClientWithBaseURI(sdkApi sdkEnv.Api) (*DbSystemsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "dbsystems", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DbSystemsClient: %+v", err) + } + + return &DbSystemsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystems/constants.go b/resource-manager/oracledatabase/2025-09-01/dbsystems/constants.go new file mode 100644 index 00000000000..64f56647b06 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystems/constants.go @@ -0,0 +1,450 @@ +package dbsystems + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureResourceProvisioningState string + +const ( + AzureResourceProvisioningStateCanceled AzureResourceProvisioningState = "Canceled" + AzureResourceProvisioningStateFailed AzureResourceProvisioningState = "Failed" + AzureResourceProvisioningStateProvisioning AzureResourceProvisioningState = "Provisioning" + AzureResourceProvisioningStateSucceeded AzureResourceProvisioningState = "Succeeded" +) + +func PossibleValuesForAzureResourceProvisioningState() []string { + return []string{ + string(AzureResourceProvisioningStateCanceled), + string(AzureResourceProvisioningStateFailed), + string(AzureResourceProvisioningStateProvisioning), + string(AzureResourceProvisioningStateSucceeded), + } +} + +func (s *AzureResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAzureResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAzureResourceProvisioningState(input string) (*AzureResourceProvisioningState, error) { + vals := map[string]AzureResourceProvisioningState{ + "canceled": AzureResourceProvisioningStateCanceled, + "failed": AzureResourceProvisioningStateFailed, + "provisioning": AzureResourceProvisioningStateProvisioning, + "succeeded": AzureResourceProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AzureResourceProvisioningState(input) + return &out, nil +} + +type ComputeModel string + +const ( + ComputeModelECPU ComputeModel = "ECPU" + ComputeModelOCPU ComputeModel = "OCPU" +) + +func PossibleValuesForComputeModel() []string { + return []string{ + string(ComputeModelECPU), + string(ComputeModelOCPU), + } +} + +func (s *ComputeModel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseComputeModel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseComputeModel(input string) (*ComputeModel, error) { + vals := map[string]ComputeModel{ + "ecpu": ComputeModelECPU, + "ocpu": ComputeModelOCPU, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComputeModel(input) + return &out, nil +} + +type DbSystemDatabaseEditionType string + +const ( + DbSystemDatabaseEditionTypeEnterpriseEdition DbSystemDatabaseEditionType = "EnterpriseEdition" + DbSystemDatabaseEditionTypeEnterpriseEditionDeveloper DbSystemDatabaseEditionType = "EnterpriseEditionDeveloper" + DbSystemDatabaseEditionTypeEnterpriseEditionExtreme DbSystemDatabaseEditionType = "EnterpriseEditionExtreme" + DbSystemDatabaseEditionTypeEnterpriseEditionHighPerformance DbSystemDatabaseEditionType = "EnterpriseEditionHighPerformance" + DbSystemDatabaseEditionTypeStandardEdition DbSystemDatabaseEditionType = "StandardEdition" +) + +func PossibleValuesForDbSystemDatabaseEditionType() []string { + return []string{ + string(DbSystemDatabaseEditionTypeEnterpriseEdition), + string(DbSystemDatabaseEditionTypeEnterpriseEditionDeveloper), + string(DbSystemDatabaseEditionTypeEnterpriseEditionExtreme), + string(DbSystemDatabaseEditionTypeEnterpriseEditionHighPerformance), + string(DbSystemDatabaseEditionTypeStandardEdition), + } +} + +func (s *DbSystemDatabaseEditionType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDbSystemDatabaseEditionType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDbSystemDatabaseEditionType(input string) (*DbSystemDatabaseEditionType, error) { + vals := map[string]DbSystemDatabaseEditionType{ + "enterpriseedition": DbSystemDatabaseEditionTypeEnterpriseEdition, + "enterpriseeditiondeveloper": DbSystemDatabaseEditionTypeEnterpriseEditionDeveloper, + "enterpriseeditionextreme": DbSystemDatabaseEditionTypeEnterpriseEditionExtreme, + "enterpriseeditionhighperformance": DbSystemDatabaseEditionTypeEnterpriseEditionHighPerformance, + "standardedition": DbSystemDatabaseEditionTypeStandardEdition, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DbSystemDatabaseEditionType(input) + return &out, nil +} + +type DbSystemLifecycleState string + +const ( + DbSystemLifecycleStateAvailable DbSystemLifecycleState = "Available" + DbSystemLifecycleStateFailed DbSystemLifecycleState = "Failed" + DbSystemLifecycleStateMaintenanceInProgress DbSystemLifecycleState = "MaintenanceInProgress" + DbSystemLifecycleStateMigrated DbSystemLifecycleState = "Migrated" + DbSystemLifecycleStateNeedsAttention DbSystemLifecycleState = "NeedsAttention" + DbSystemLifecycleStateProvisioning DbSystemLifecycleState = "Provisioning" + DbSystemLifecycleStateTerminated DbSystemLifecycleState = "Terminated" + DbSystemLifecycleStateTerminating DbSystemLifecycleState = "Terminating" + DbSystemLifecycleStateUpdating DbSystemLifecycleState = "Updating" + DbSystemLifecycleStateUpgrading DbSystemLifecycleState = "Upgrading" +) + +func PossibleValuesForDbSystemLifecycleState() []string { + return []string{ + string(DbSystemLifecycleStateAvailable), + string(DbSystemLifecycleStateFailed), + string(DbSystemLifecycleStateMaintenanceInProgress), + string(DbSystemLifecycleStateMigrated), + string(DbSystemLifecycleStateNeedsAttention), + string(DbSystemLifecycleStateProvisioning), + string(DbSystemLifecycleStateTerminated), + string(DbSystemLifecycleStateTerminating), + string(DbSystemLifecycleStateUpdating), + string(DbSystemLifecycleStateUpgrading), + } +} + +func (s *DbSystemLifecycleState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDbSystemLifecycleState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDbSystemLifecycleState(input string) (*DbSystemLifecycleState, error) { + vals := map[string]DbSystemLifecycleState{ + "available": DbSystemLifecycleStateAvailable, + "failed": DbSystemLifecycleStateFailed, + "maintenanceinprogress": DbSystemLifecycleStateMaintenanceInProgress, + "migrated": DbSystemLifecycleStateMigrated, + "needsattention": DbSystemLifecycleStateNeedsAttention, + "provisioning": DbSystemLifecycleStateProvisioning, + "terminated": DbSystemLifecycleStateTerminated, + "terminating": DbSystemLifecycleStateTerminating, + "updating": DbSystemLifecycleStateUpdating, + "upgrading": DbSystemLifecycleStateUpgrading, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DbSystemLifecycleState(input) + return &out, nil +} + +type DbSystemSourceType string + +const ( + DbSystemSourceTypeNone DbSystemSourceType = "None" +) + +func PossibleValuesForDbSystemSourceType() []string { + return []string{ + string(DbSystemSourceTypeNone), + } +} + +func (s *DbSystemSourceType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDbSystemSourceType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDbSystemSourceType(input string) (*DbSystemSourceType, error) { + vals := map[string]DbSystemSourceType{ + "none": DbSystemSourceTypeNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DbSystemSourceType(input) + return &out, nil +} + +type DiskRedundancyType string + +const ( + DiskRedundancyTypeHigh DiskRedundancyType = "High" + DiskRedundancyTypeNormal DiskRedundancyType = "Normal" +) + +func PossibleValuesForDiskRedundancyType() []string { + return []string{ + string(DiskRedundancyTypeHigh), + string(DiskRedundancyTypeNormal), + } +} + +func (s *DiskRedundancyType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskRedundancyType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskRedundancyType(input string) (*DiskRedundancyType, error) { + vals := map[string]DiskRedundancyType{ + "high": DiskRedundancyTypeHigh, + "normal": DiskRedundancyTypeNormal, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskRedundancyType(input) + return &out, nil +} + +type LicenseModel string + +const ( + LicenseModelBringYourOwnLicense LicenseModel = "BringYourOwnLicense" + LicenseModelLicenseIncluded LicenseModel = "LicenseIncluded" +) + +func PossibleValuesForLicenseModel() []string { + return []string{ + string(LicenseModelBringYourOwnLicense), + string(LicenseModelLicenseIncluded), + } +} + +func (s *LicenseModel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLicenseModel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLicenseModel(input string) (*LicenseModel, error) { + vals := map[string]LicenseModel{ + "bringyourownlicense": LicenseModelBringYourOwnLicense, + "licenseincluded": LicenseModelLicenseIncluded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LicenseModel(input) + return &out, nil +} + +type Source string + +const ( + SourceNone Source = "None" +) + +func PossibleValuesForSource() []string { + return []string{ + string(SourceNone), + } +} + +func (s *Source) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSource(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSource(input string) (*Source, error) { + vals := map[string]Source{ + "none": SourceNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Source(input) + return &out, nil +} + +type StorageManagementType string + +const ( + StorageManagementTypeLVM StorageManagementType = "LVM" +) + +func PossibleValuesForStorageManagementType() []string { + return []string{ + string(StorageManagementTypeLVM), + } +} + +func (s *StorageManagementType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStorageManagementType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStorageManagementType(input string) (*StorageManagementType, error) { + vals := map[string]StorageManagementType{ + "lvm": StorageManagementTypeLVM, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageManagementType(input) + return &out, nil +} + +type StorageVolumePerformanceMode string + +const ( + StorageVolumePerformanceModeBalanced StorageVolumePerformanceMode = "Balanced" + StorageVolumePerformanceModeHighPerformance StorageVolumePerformanceMode = "HighPerformance" +) + +func PossibleValuesForStorageVolumePerformanceMode() []string { + return []string{ + string(StorageVolumePerformanceModeBalanced), + string(StorageVolumePerformanceModeHighPerformance), + } +} + +func (s *StorageVolumePerformanceMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStorageVolumePerformanceMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStorageVolumePerformanceMode(input string) (*StorageVolumePerformanceMode, error) { + vals := map[string]StorageVolumePerformanceMode{ + "balanced": StorageVolumePerformanceModeBalanced, + "highperformance": StorageVolumePerformanceModeHighPerformance, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageVolumePerformanceMode(input) + return &out, nil +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/id_vault.go b/resource-manager/oracledatabase/2025-09-01/dbsystems/id_dbsystem.go similarity index 52% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/id_vault.go rename to resource-manager/oracledatabase/2025-09-01/dbsystems/id_dbsystem.go index 4eb205d2d94..c9c4e419c4b 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/id_vault.go +++ b/resource-manager/oracledatabase/2025-09-01/dbsystems/id_dbsystem.go @@ -1,4 +1,4 @@ -package backupprotectioncontainers +package dbsystems import ( "fmt" @@ -12,36 +12,36 @@ import ( // Licensed under the MIT License. See NOTICE.txt in the project root for license information. func init() { - recaser.RegisterResourceId(&VaultId{}) + recaser.RegisterResourceId(&DbSystemId{}) } -var _ resourceids.ResourceId = &VaultId{} +var _ resourceids.ResourceId = &DbSystemId{} -// VaultId is a struct representing the Resource ID for a Vault -type VaultId struct { +// DbSystemId is a struct representing the Resource ID for a Db System +type DbSystemId struct { SubscriptionId string ResourceGroupName string - VaultName string + DbSystemName string } -// NewVaultID returns a new VaultId struct -func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { - return VaultId{ +// NewDbSystemID returns a new DbSystemId struct +func NewDbSystemID(subscriptionId string, resourceGroupName string, dbSystemName string) DbSystemId { + return DbSystemId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, - VaultName: vaultName, + DbSystemName: dbSystemName, } } -// ParseVaultID parses 'input' into a VaultId -func ParseVaultID(input string) (*VaultId, error) { - parser := resourceids.NewParserFromResourceIdType(&VaultId{}) +// ParseDbSystemID parses 'input' into a DbSystemId +func ParseDbSystemID(input string) (*DbSystemId, error) { + parser := resourceids.NewParserFromResourceIdType(&DbSystemId{}) parsed, err := parser.Parse(input, false) if err != nil { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - id := VaultId{} + id := DbSystemId{} if err = id.FromParseResult(*parsed); err != nil { return nil, err } @@ -49,16 +49,16 @@ func ParseVaultID(input string) (*VaultId, error) { return &id, nil } -// ParseVaultIDInsensitively parses 'input' case-insensitively into a VaultId +// ParseDbSystemIDInsensitively parses 'input' case-insensitively into a DbSystemId // note: this method should only be used for API response data and not user input -func ParseVaultIDInsensitively(input string) (*VaultId, error) { - parser := resourceids.NewParserFromResourceIdType(&VaultId{}) +func ParseDbSystemIDInsensitively(input string) (*DbSystemId, error) { + parser := resourceids.NewParserFromResourceIdType(&DbSystemId{}) parsed, err := parser.Parse(input, true) if err != nil { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - id := VaultId{} + id := DbSystemId{} if err = id.FromParseResult(*parsed); err != nil { return nil, err } @@ -66,7 +66,7 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return &id, nil } -func (id *VaultId) FromParseResult(input resourceids.ParseResult) error { +func (id *DbSystemId) FromParseResult(input resourceids.ParseResult) error { var ok bool if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { @@ -77,54 +77,54 @@ func (id *VaultId) FromParseResult(input resourceids.ParseResult) error { return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = input.Parsed["vaultName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) + if id.DbSystemName, ok = input.Parsed["dbSystemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dbSystemName", input) } return nil } -// ValidateVaultID checks that 'input' can be parsed as a Vault ID -func ValidateVaultID(input interface{}, key string) (warnings []string, errors []error) { +// ValidateDbSystemID checks that 'input' can be parsed as a Db System ID +func ValidateDbSystemID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) if !ok { errors = append(errors, fmt.Errorf("expected %q to be a string", key)) return } - if _, err := ParseVaultID(v); err != nil { + if _, err := ParseDbSystemID(v); err != nil { errors = append(errors, err) } return } -// ID returns the formatted Vault ID -func (id VaultId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) +// ID returns the formatted Db System ID +func (id DbSystemId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Oracle.Database/dbSystems/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DbSystemName) } -// Segments returns a slice of Resource ID Segments which comprise this Vault ID -func (id VaultId) Segments() []resourceids.Segment { +// Segments returns a slice of Resource ID Segments which comprise this Db System ID +func (id DbSystemId) Segments() []resourceids.Segment { return []resourceids.Segment{ resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), - resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("vaultName", "vaultName"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticDbSystems", "dbSystems", "dbSystems"), + resourceids.UserSpecifiedSegment("dbSystemName", "dbSystemName"), } } -// String returns a human-readable description of this Vault ID -func (id VaultId) String() string { +// String returns a human-readable description of this Db System ID +func (id DbSystemId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Db System Name: %q", id.DbSystemName), } - return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) + return fmt.Sprintf("Db System (%s)", strings.Join(components, "\n")) } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/id_vault_test.go b/resource-manager/oracledatabase/2025-09-01/dbsystems/id_dbsystem_test.go similarity index 72% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/id_vault_test.go rename to resource-manager/oracledatabase/2025-09-01/dbsystems/id_dbsystem_test.go index 9f59504b28c..dfe8e73616f 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/id_vault_test.go +++ b/resource-manager/oracledatabase/2025-09-01/dbsystems/id_dbsystem_test.go @@ -1,4 +1,4 @@ -package backupprotectableitems +package dbsystems import ( "testing" @@ -9,10 +9,10 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -var _ resourceids.ResourceId = &VaultId{} +var _ resourceids.ResourceId = &DbSystemId{} -func TestNewVaultID(t *testing.T) { - id := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") +func TestNewDbSystemID(t *testing.T) { + id := NewDbSystemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dbSystemName") if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") @@ -22,24 +22,24 @@ func TestNewVaultID(t *testing.T) { t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") } - if id.VaultName != "vaultName" { - t.Fatalf("Expected %q but got %q for Segment 'VaultName'", id.VaultName, "vaultName") + if id.DbSystemName != "dbSystemName" { + t.Fatalf("Expected %q but got %q for Segment 'DbSystemName'", id.DbSystemName, "dbSystemName") } } -func TestFormatVaultID(t *testing.T) { - actual := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName" +func TestFormatDbSystemID(t *testing.T) { + actual := NewDbSystemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dbSystemName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/dbSystems/dbSystemName" if actual != expected { t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) } } -func TestParseVaultID(t *testing.T) { +func TestParseDbSystemID(t *testing.T) { testData := []struct { Input string Error bool - Expected *VaultId + Expected *DbSystemId }{ { // Incomplete URI @@ -73,33 +73,33 @@ func TestParseVaultID(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/dbSystems", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Expected: &VaultId{ + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/dbSystems/dbSystemName", + Expected: &DbSystemId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroupName: "example-resource-group", - VaultName: "vaultName", + DbSystemName: "dbSystemName", }, }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/dbSystems/dbSystemName/extra", Error: true, }, } for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ParseVaultID(v.Input) + actual, err := ParseDbSystemID(v.Input) if err != nil { if v.Error { continue @@ -119,18 +119,18 @@ func TestParseVaultID(t *testing.T) { t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) } - if actual.VaultName != v.Expected.VaultName { - t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) + if actual.DbSystemName != v.Expected.DbSystemName { + t.Fatalf("Expected %q but got %q for DbSystemName", v.Expected.DbSystemName, actual.DbSystemName) } } } -func TestParseVaultIDInsensitively(t *testing.T) { +func TestParseDbSystemIDInsensitively(t *testing.T) { testData := []struct { Input string Error bool - Expected *VaultId + Expected *DbSystemId }{ { // Incomplete URI @@ -189,57 +189,57 @@ func TestParseVaultIDInsensitively(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/dbSystems", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/dBsYsTeMs", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Expected: &VaultId{ + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/dbSystems/dbSystemName", + Expected: &DbSystemId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroupName: "example-resource-group", - VaultName: "vaultName", + DbSystemName: "dbSystemName", }, }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/dbSystems/dbSystemName/extra", Error: true, }, { // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe", - Expected: &VaultId{ + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/dBsYsTeMs/dBsYsTeMnAmE", + Expected: &DbSystemId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - VaultName: "vAuLtNaMe", + DbSystemName: "dBsYsTeMnAmE", }, }, { // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/extra", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/dBsYsTeMs/dBsYsTeMnAmE/extra", Error: true, }, } for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ParseVaultIDInsensitively(v.Input) + actual, err := ParseDbSystemIDInsensitively(v.Input) if err != nil { if v.Error { continue @@ -259,17 +259,17 @@ func TestParseVaultIDInsensitively(t *testing.T) { t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) } - if actual.VaultName != v.Expected.VaultName { - t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) + if actual.DbSystemName != v.Expected.DbSystemName { + t.Fatalf("Expected %q but got %q for DbSystemName", v.Expected.DbSystemName, actual.DbSystemName) } } } -func TestSegmentsForVaultId(t *testing.T) { - segments := VaultId{}.Segments() +func TestSegmentsForDbSystemId(t *testing.T) { + segments := DbSystemId{}.Segments() if len(segments) == 0 { - t.Fatalf("VaultId has no segments") + t.Fatalf("DbSystemId has no segments") } uniqueNames := make(map[string]struct{}, 0) diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystems/method_createorupdate.go b/resource-manager/oracledatabase/2025-09-01/dbsystems/method_createorupdate.go new file mode 100644 index 00000000000..46f4e578b7b --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystems/method_createorupdate.go @@ -0,0 +1,75 @@ +package dbsystems + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *DbSystem +} + +// CreateOrUpdate ... +func (c DbSystemsClient) CreateOrUpdate(ctx context.Context, id DbSystemId, input DbSystem) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c DbSystemsClient) CreateOrUpdateThenPoll(ctx context.Context, id DbSystemId, input DbSystem) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystems/method_delete.go b/resource-manager/oracledatabase/2025-09-01/dbsystems/method_delete.go new file mode 100644 index 00000000000..b7adb60a418 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystems/method_delete.go @@ -0,0 +1,70 @@ +package dbsystems + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c DbSystemsClient) Delete(ctx context.Context, id DbSystemId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c DbSystemsClient) DeleteThenPoll(ctx context.Context, id DbSystemId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystems/method_get.go b/resource-manager/oracledatabase/2025-09-01/dbsystems/method_get.go new file mode 100644 index 00000000000..879a7afdad5 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystems/method_get.go @@ -0,0 +1,53 @@ +package dbsystems + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DbSystem +} + +// Get ... +func (c DbSystemsClient) Get(ctx context.Context, id DbSystemId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model DbSystem + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystems/method_listbyresourcegroup.go b/resource-manager/oracledatabase/2025-09-01/dbsystems/method_listbyresourcegroup.go new file mode 100644 index 00000000000..d6adb05cfba --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystems/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package dbsystems + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DbSystem +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []DbSystem +} + +type ListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByResourceGroup ... +func (c DbSystemsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Oracle.Database/dbSystems", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]DbSystem `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c DbSystemsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, DbSystemOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DbSystemsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate DbSystemOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]DbSystem, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystems/method_listbysubscription.go b/resource-manager/oracledatabase/2025-09-01/dbsystems/method_listbysubscription.go new file mode 100644 index 00000000000..bc075d6ae2f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystems/method_listbysubscription.go @@ -0,0 +1,106 @@ +package dbsystems + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DbSystem +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []DbSystem +} + +type ListBySubscriptionCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListBySubscriptionCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListBySubscription ... +func (c DbSystemsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Oracle.Database/dbSystems", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]DbSystem `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c DbSystemsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, DbSystemOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DbSystemsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate DbSystemOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]DbSystem, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystems/method_update.go b/resource-manager/oracledatabase/2025-09-01/dbsystems/method_update.go new file mode 100644 index 00000000000..5db5e432f04 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystems/method_update.go @@ -0,0 +1,75 @@ +package dbsystems + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *DbSystem +} + +// Update ... +func (c DbSystemsClient) Update(ctx context.Context, id DbSystemId, input DbSystemUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c DbSystemsClient) UpdateThenPoll(ctx context.Context, id DbSystemId, input DbSystemUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystem.go b/resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystem.go new file mode 100644 index 00000000000..374e0b10339 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystem.go @@ -0,0 +1,20 @@ +package dbsystems + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbSystem struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *DbSystemProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystembaseproperties.go b/resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystembaseproperties.go new file mode 100644 index 00000000000..48f76df53d8 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystembaseproperties.go @@ -0,0 +1,104 @@ +package dbsystems + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbSystemBaseProperties interface { + DbSystemBaseProperties() BaseDbSystemBasePropertiesImpl +} + +var _ DbSystemBaseProperties = BaseDbSystemBasePropertiesImpl{} + +type BaseDbSystemBasePropertiesImpl struct { + ClusterName *string `json:"clusterName,omitempty"` + ComputeCount *int64 `json:"computeCount,omitempty"` + ComputeModel *ComputeModel `json:"computeModel,omitempty"` + DataStorageSizeInGbs *int64 `json:"dataStorageSizeInGbs,omitempty"` + DbSystemOptions *DbSystemOptions `json:"dbSystemOptions,omitempty"` + DiskRedundancy *DiskRedundancyType `json:"diskRedundancy,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Domain *string `json:"domain,omitempty"` + GridImageOcid *string `json:"gridImageOcid,omitempty"` + Hostname string `json:"hostname"` + InitialDataStorageSizeInGb *int64 `json:"initialDataStorageSizeInGb,omitempty"` + LicenseModel *LicenseModel `json:"licenseModel,omitempty"` + LifecycleDetails *string `json:"lifecycleDetails,omitempty"` + LifecycleState *DbSystemLifecycleState `json:"lifecycleState,omitempty"` + ListenerPort *int64 `json:"listenerPort,omitempty"` + MemorySizeInGbs *int64 `json:"memorySizeInGbs,omitempty"` + NetworkAnchorId string `json:"networkAnchorId"` + NodeCount *int64 `json:"nodeCount,omitempty"` + OciURL *string `json:"ociUrl,omitempty"` + Ocid *string `json:"ocid,omitempty"` + ProvisioningState *AzureResourceProvisioningState `json:"provisioningState,omitempty"` + ResourceAnchorId string `json:"resourceAnchorId"` + ScanDnsName *string `json:"scanDnsName,omitempty"` + ScanIPs *[]string `json:"scanIps,omitempty"` + Shape string `json:"shape"` + Source DbSystemSourceType `json:"source"` + SshPublicKeys []string `json:"sshPublicKeys"` + StorageVolumePerformanceMode *StorageVolumePerformanceMode `json:"storageVolumePerformanceMode,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + Version *string `json:"version,omitempty"` +} + +func (s BaseDbSystemBasePropertiesImpl) DbSystemBaseProperties() BaseDbSystemBasePropertiesImpl { + return s +} + +var _ DbSystemBaseProperties = RawDbSystemBasePropertiesImpl{} + +// RawDbSystemBasePropertiesImpl is returned when the Discriminated Value doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawDbSystemBasePropertiesImpl struct { + dbSystemBaseProperties BaseDbSystemBasePropertiesImpl + Type string + Values map[string]interface{} +} + +func (s RawDbSystemBasePropertiesImpl) DbSystemBaseProperties() BaseDbSystemBasePropertiesImpl { + return s.dbSystemBaseProperties +} + +func UnmarshalDbSystemBasePropertiesImplementation(input []byte) (DbSystemBaseProperties, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling DbSystemBaseProperties into map[string]interface: %+v", err) + } + + var value string + if v, ok := temp["source"]; ok { + value = fmt.Sprintf("%v", v) + } + + if strings.EqualFold(value, "None") { + var out DbSystemProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into DbSystemProperties: %+v", err) + } + return out, nil + } + + var parent BaseDbSystemBasePropertiesImpl + if err := json.Unmarshal(input, &parent); err != nil { + return nil, fmt.Errorf("unmarshaling into BaseDbSystemBasePropertiesImpl: %+v", err) + } + + return RawDbSystemBasePropertiesImpl{ + dbSystemBaseProperties: parent, + Type: value, + Values: temp, + }, nil + +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystemoptions.go b/resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystemoptions.go new file mode 100644 index 00000000000..fcb61420026 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystemoptions.go @@ -0,0 +1,8 @@ +package dbsystems + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbSystemOptions struct { + StorageManagement *StorageManagementType `json:"storageManagement,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystemproperties.go b/resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystemproperties.go new file mode 100644 index 00000000000..e19f045e377 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystemproperties.go @@ -0,0 +1,111 @@ +package dbsystems + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DbSystemBaseProperties = DbSystemProperties{} + +type DbSystemProperties struct { + AdminPassword *string `json:"adminPassword,omitempty"` + DatabaseEdition DbSystemDatabaseEditionType `json:"databaseEdition"` + DbVersion string `json:"dbVersion"` + PdbName *string `json:"pdbName,omitempty"` + + // Fields inherited from DbSystemBaseProperties + + ClusterName *string `json:"clusterName,omitempty"` + ComputeCount *int64 `json:"computeCount,omitempty"` + ComputeModel *ComputeModel `json:"computeModel,omitempty"` + DataStorageSizeInGbs *int64 `json:"dataStorageSizeInGbs,omitempty"` + DbSystemOptions *DbSystemOptions `json:"dbSystemOptions,omitempty"` + DiskRedundancy *DiskRedundancyType `json:"diskRedundancy,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Domain *string `json:"domain,omitempty"` + GridImageOcid *string `json:"gridImageOcid,omitempty"` + Hostname string `json:"hostname"` + InitialDataStorageSizeInGb *int64 `json:"initialDataStorageSizeInGb,omitempty"` + LicenseModel *LicenseModel `json:"licenseModel,omitempty"` + LifecycleDetails *string `json:"lifecycleDetails,omitempty"` + LifecycleState *DbSystemLifecycleState `json:"lifecycleState,omitempty"` + ListenerPort *int64 `json:"listenerPort,omitempty"` + MemorySizeInGbs *int64 `json:"memorySizeInGbs,omitempty"` + NetworkAnchorId string `json:"networkAnchorId"` + NodeCount *int64 `json:"nodeCount,omitempty"` + OciURL *string `json:"ociUrl,omitempty"` + Ocid *string `json:"ocid,omitempty"` + ProvisioningState *AzureResourceProvisioningState `json:"provisioningState,omitempty"` + ResourceAnchorId string `json:"resourceAnchorId"` + ScanDnsName *string `json:"scanDnsName,omitempty"` + ScanIPs *[]string `json:"scanIps,omitempty"` + Shape string `json:"shape"` + Source DbSystemSourceType `json:"source"` + SshPublicKeys []string `json:"sshPublicKeys"` + StorageVolumePerformanceMode *StorageVolumePerformanceMode `json:"storageVolumePerformanceMode,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + Version *string `json:"version,omitempty"` +} + +func (s DbSystemProperties) DbSystemBaseProperties() BaseDbSystemBasePropertiesImpl { + return BaseDbSystemBasePropertiesImpl{ + ClusterName: s.ClusterName, + ComputeCount: s.ComputeCount, + ComputeModel: s.ComputeModel, + DataStorageSizeInGbs: s.DataStorageSizeInGbs, + DbSystemOptions: s.DbSystemOptions, + DiskRedundancy: s.DiskRedundancy, + DisplayName: s.DisplayName, + Domain: s.Domain, + GridImageOcid: s.GridImageOcid, + Hostname: s.Hostname, + InitialDataStorageSizeInGb: s.InitialDataStorageSizeInGb, + LicenseModel: s.LicenseModel, + LifecycleDetails: s.LifecycleDetails, + LifecycleState: s.LifecycleState, + ListenerPort: s.ListenerPort, + MemorySizeInGbs: s.MemorySizeInGbs, + NetworkAnchorId: s.NetworkAnchorId, + NodeCount: s.NodeCount, + OciURL: s.OciURL, + Ocid: s.Ocid, + ProvisioningState: s.ProvisioningState, + ResourceAnchorId: s.ResourceAnchorId, + ScanDnsName: s.ScanDnsName, + ScanIPs: s.ScanIPs, + Shape: s.Shape, + Source: s.Source, + SshPublicKeys: s.SshPublicKeys, + StorageVolumePerformanceMode: s.StorageVolumePerformanceMode, + TimeZone: s.TimeZone, + Version: s.Version, + } +} + +var _ json.Marshaler = DbSystemProperties{} + +func (s DbSystemProperties) MarshalJSON() ([]byte, error) { + type wrapper DbSystemProperties + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling DbSystemProperties: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling DbSystemProperties: %+v", err) + } + + decoded["source"] = "None" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling DbSystemProperties: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystemupdate.go b/resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystemupdate.go new file mode 100644 index 00000000000..f719d0f9293 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystemupdate.go @@ -0,0 +1,14 @@ +package dbsystems + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbSystemUpdate struct { + Properties *DbSystemUpdateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystemupdateproperties.go b/resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystemupdateproperties.go new file mode 100644 index 00000000000..8cf91968b6b --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystems/model_dbsystemupdateproperties.go @@ -0,0 +1,8 @@ +package dbsystems + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbSystemUpdateProperties struct { + Source *Source `json:"source,omitempty"` +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/predicates.go b/resource-manager/oracledatabase/2025-09-01/dbsystems/predicates.go similarity index 57% rename from resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/predicates.go rename to resource-manager/oracledatabase/2025-09-01/dbsystems/predicates.go index 8ce6de2e8ce..4381ddf58a8 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/predicates.go +++ b/resource-manager/oracledatabase/2025-09-01/dbsystems/predicates.go @@ -1,27 +1,22 @@ -package protectablecontainers +package dbsystems // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type ProtectableContainerResourceOperationPredicate struct { - ETag *string +type DbSystemOperationPredicate struct { Id *string Location *string Name *string Type *string } -func (p ProtectableContainerResourceOperationPredicate) Matches(input ProtectableContainerResource) bool { - - if p.ETag != nil && (input.ETag == nil || *p.ETag != *input.ETag) { - return false - } +func (p DbSystemOperationPredicate) Matches(input DbSystem) bool { if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { return false } - if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + if p.Location != nil && *p.Location != input.Location { return false } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/version.go b/resource-manager/oracledatabase/2025-09-01/dbsystems/version.go similarity index 61% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/version.go rename to resource-manager/oracledatabase/2025-09-01/dbsystems/version.go index 372dc392bf1..de9f4fea63b 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/version.go +++ b/resource-manager/oracledatabase/2025-09-01/dbsystems/version.go @@ -1,10 +1,10 @@ -package backupstatus +package dbsystems // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2025-02-01" +const defaultApiVersion = "2025-09-01" func userAgent() string { - return "hashicorp/go-azure-sdk/backupstatus/2025-02-01" + return "hashicorp/go-azure-sdk/dbsystems/2025-09-01" } diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/README.md b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/README.md new file mode 100644 index 00000000000..63e6b43aaa5 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/dbsystemshapes` Documentation + +The `dbsystemshapes` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/dbsystemshapes" +``` + + +### Client Initialization + +```go +client := dbsystemshapes.NewDbSystemShapesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DbSystemShapesClient.Get` + +```go +ctx := context.TODO() +id := dbsystemshapes.NewDbSystemShapeID("12345678-1234-9876-4563-123456789012", "locationName", "dbSystemShapeName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DbSystemShapesClient.ListByLocation` + +```go +ctx := context.TODO() +id := dbsystemshapes.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +// alternatively `client.ListByLocation(ctx, id, dbsystemshapes.DefaultListByLocationOperationOptions())` can be used to do batched pagination +items, err := client.ListByLocationComplete(ctx, id, dbsystemshapes.DefaultListByLocationOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/client.go b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/client.go new file mode 100644 index 00000000000..82bf6b4be58 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/client.go @@ -0,0 +1,26 @@ +package dbsystemshapes + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbSystemShapesClient struct { + Client *resourcemanager.Client +} + +func NewDbSystemShapesClientWithBaseURI(sdkApi sdkEnv.Api) (*DbSystemShapesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "dbsystemshapes", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DbSystemShapesClient: %+v", err) + } + + return &DbSystemShapesClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/constants.go b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/constants.go new file mode 100644 index 00000000000..a83864b82da --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/constants.go @@ -0,0 +1,51 @@ +package dbsystemshapes + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComputeModel string + +const ( + ComputeModelECPU ComputeModel = "ECPU" + ComputeModelOCPU ComputeModel = "OCPU" +) + +func PossibleValuesForComputeModel() []string { + return []string{ + string(ComputeModelECPU), + string(ComputeModelOCPU), + } +} + +func (s *ComputeModel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseComputeModel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseComputeModel(input string) (*ComputeModel, error) { + vals := map[string]ComputeModel{ + "ecpu": ComputeModelECPU, + "ocpu": ComputeModelOCPU, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComputeModel(input) + return &out, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/id_dbsystemshape.go b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/id_dbsystemshape.go new file mode 100644 index 00000000000..1215665cae7 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/id_dbsystemshape.go @@ -0,0 +1,130 @@ +package dbsystemshapes + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&DbSystemShapeId{}) +} + +var _ resourceids.ResourceId = &DbSystemShapeId{} + +// DbSystemShapeId is a struct representing the Resource ID for a Db System Shape +type DbSystemShapeId struct { + SubscriptionId string + LocationName string + DbSystemShapeName string +} + +// NewDbSystemShapeID returns a new DbSystemShapeId struct +func NewDbSystemShapeID(subscriptionId string, locationName string, dbSystemShapeName string) DbSystemShapeId { + return DbSystemShapeId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + DbSystemShapeName: dbSystemShapeName, + } +} + +// ParseDbSystemShapeID parses 'input' into a DbSystemShapeId +func ParseDbSystemShapeID(input string) (*DbSystemShapeId, error) { + parser := resourceids.NewParserFromResourceIdType(&DbSystemShapeId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DbSystemShapeId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseDbSystemShapeIDInsensitively parses 'input' case-insensitively into a DbSystemShapeId +// note: this method should only be used for API response data and not user input +func ParseDbSystemShapeIDInsensitively(input string) (*DbSystemShapeId, error) { + parser := resourceids.NewParserFromResourceIdType(&DbSystemShapeId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DbSystemShapeId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DbSystemShapeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.DbSystemShapeName, ok = input.Parsed["dbSystemShapeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dbSystemShapeName", input) + } + + return nil +} + +// ValidateDbSystemShapeID checks that 'input' can be parsed as a Db System Shape ID +func ValidateDbSystemShapeID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDbSystemShapeID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Db System Shape ID +func (id DbSystemShapeId) ID() string { + fmtString := "/subscriptions/%s/providers/Oracle.Database/locations/%s/dbSystemShapes/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.DbSystemShapeName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Db System Shape ID +func (id DbSystemShapeId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticDbSystemShapes", "dbSystemShapes", "dbSystemShapes"), + resourceids.UserSpecifiedSegment("dbSystemShapeName", "dbSystemShapeName"), + } +} + +// String returns a human-readable description of this Db System Shape ID +func (id DbSystemShapeId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Db System Shape Name: %q", id.DbSystemShapeName), + } + return fmt.Sprintf("Db System Shape (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/id_dbsystemshape_test.go b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/id_dbsystemshape_test.go new file mode 100644 index 00000000000..7615681d7ce --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/id_dbsystemshape_test.go @@ -0,0 +1,282 @@ +package dbsystemshapes + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &DbSystemShapeId{} + +func TestNewDbSystemShapeID(t *testing.T) { + id := NewDbSystemShapeID("12345678-1234-9876-4563-123456789012", "locationName", "dbSystemShapeName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.DbSystemShapeName != "dbSystemShapeName" { + t.Fatalf("Expected %q but got %q for Segment 'DbSystemShapeName'", id.DbSystemShapeName, "dbSystemShapeName") + } +} + +func TestFormatDbSystemShapeID(t *testing.T) { + actual := NewDbSystemShapeID("12345678-1234-9876-4563-123456789012", "locationName", "dbSystemShapeName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dbSystemShapes/dbSystemShapeName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseDbSystemShapeID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *DbSystemShapeId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dbSystemShapes", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dbSystemShapes/dbSystemShapeName", + Expected: &DbSystemShapeId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + DbSystemShapeName: "dbSystemShapeName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dbSystemShapes/dbSystemShapeName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseDbSystemShapeID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.DbSystemShapeName != v.Expected.DbSystemShapeName { + t.Fatalf("Expected %q but got %q for DbSystemShapeName", v.Expected.DbSystemShapeName, actual.DbSystemShapeName) + } + + } +} + +func TestParseDbSystemShapeIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *DbSystemShapeId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dbSystemShapes", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/dBsYsTeMsHaPeS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dbSystemShapes/dbSystemShapeName", + Expected: &DbSystemShapeId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + DbSystemShapeName: "dbSystemShapeName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dbSystemShapes/dbSystemShapeName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/dBsYsTeMsHaPeS/dBsYsTeMsHaPeNaMe", + Expected: &DbSystemShapeId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + DbSystemShapeName: "dBsYsTeMsHaPeNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/dBsYsTeMsHaPeS/dBsYsTeMsHaPeNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseDbSystemShapeIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.DbSystemShapeName != v.Expected.DbSystemShapeName { + t.Fatalf("Expected %q but got %q for DbSystemShapeName", v.Expected.DbSystemShapeName, actual.DbSystemShapeName) + } + + } +} + +func TestSegmentsForDbSystemShapeId(t *testing.T) { + segments := DbSystemShapeId{}.Segments() + if len(segments) == 0 { + t.Fatalf("DbSystemShapeId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/id_location.go b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/id_location.go new file mode 100644 index 00000000000..56e5e6d1a13 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/id_location.go @@ -0,0 +1,121 @@ +package dbsystemshapes + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&LocationId{}) +} + +var _ resourceids.ResourceId = &LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + LocationName string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, locationName string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Oracle.Database/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/id_location_test.go b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/id_location_test.go new file mode 100644 index 00000000000..8b39bd12c17 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/id_location_test.go @@ -0,0 +1,237 @@ +package dbsystemshapes + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &LocationId{} + +func TestNewLocationID(t *testing.T) { + id := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } +} + +func TestFormatLocationID(t *testing.T) { + actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseLocationID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LocationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseLocationID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestParseLocationIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LocationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseLocationIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestSegmentsForLocationId(t *testing.T) { + segments := LocationId{}.Segments() + if len(segments) == 0 { + t.Fatalf("LocationId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/method_get.go b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/method_get.go new file mode 100644 index 00000000000..3d30b9db9fc --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/method_get.go @@ -0,0 +1,53 @@ +package dbsystemshapes + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DbSystemShape +} + +// Get ... +func (c DbSystemShapesClient) Get(ctx context.Context, id DbSystemShapeId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model DbSystemShape + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/method_listbylocation.go b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/method_listbylocation.go new file mode 100644 index 00000000000..f76d497f994 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/method_listbylocation.go @@ -0,0 +1,138 @@ +package dbsystemshapes + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByLocationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DbSystemShape +} + +type ListByLocationCompleteResult struct { + LatestHttpResponse *http.Response + Items []DbSystemShape +} + +type ListByLocationOperationOptions struct { + ShapeAttribute *string + Zone *string +} + +func DefaultListByLocationOperationOptions() ListByLocationOperationOptions { + return ListByLocationOperationOptions{} +} + +func (o ListByLocationOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByLocationOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListByLocationOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ShapeAttribute != nil { + out.Append("shapeAttribute", fmt.Sprintf("%v", *o.ShapeAttribute)) + } + if o.Zone != nil { + out.Append("zone", fmt.Sprintf("%v", *o.Zone)) + } + return &out +} + +type ListByLocationCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByLocationCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByLocation ... +func (c DbSystemShapesClient) ListByLocation(ctx context.Context, id LocationId, options ListByLocationOperationOptions) (result ListByLocationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListByLocationCustomPager{}, + Path: fmt.Sprintf("%s/dbSystemShapes", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]DbSystemShape `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByLocationComplete retrieves all the results into a single object +func (c DbSystemShapesClient) ListByLocationComplete(ctx context.Context, id LocationId, options ListByLocationOperationOptions) (ListByLocationCompleteResult, error) { + return c.ListByLocationCompleteMatchingPredicate(ctx, id, options, DbSystemShapeOperationPredicate{}) +} + +// ListByLocationCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DbSystemShapesClient) ListByLocationCompleteMatchingPredicate(ctx context.Context, id LocationId, options ListByLocationOperationOptions, predicate DbSystemShapeOperationPredicate) (result ListByLocationCompleteResult, err error) { + items := make([]DbSystemShape, 0) + + resp, err := c.ListByLocation(ctx, id, options) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByLocationCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/model_dbsystemshape.go b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/model_dbsystemshape.go new file mode 100644 index 00000000000..69813657351 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/model_dbsystemshape.go @@ -0,0 +1,16 @@ +package dbsystemshapes + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbSystemShape struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DbSystemShapeProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/model_dbsystemshapeproperties.go b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/model_dbsystemshapeproperties.go new file mode 100644 index 00000000000..12dc7ac3ddb --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/model_dbsystemshapeproperties.go @@ -0,0 +1,32 @@ +package dbsystemshapes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbSystemShapeProperties struct { + AreServerTypesSupported *bool `json:"areServerTypesSupported,omitempty"` + AvailableCoreCount int64 `json:"availableCoreCount"` + AvailableCoreCountPerNode *int64 `json:"availableCoreCountPerNode,omitempty"` + AvailableDataStorageInTbs *int64 `json:"availableDataStorageInTbs,omitempty"` + AvailableDataStoragePerServerInTbs *float64 `json:"availableDataStoragePerServerInTbs,omitempty"` + AvailableDbNodePerNodeInGbs *int64 `json:"availableDbNodePerNodeInGbs,omitempty"` + AvailableDbNodeStorageInGbs *int64 `json:"availableDbNodeStorageInGbs,omitempty"` + AvailableMemoryInGbs *int64 `json:"availableMemoryInGbs,omitempty"` + AvailableMemoryPerNodeInGbs *int64 `json:"availableMemoryPerNodeInGbs,omitempty"` + ComputeModel *ComputeModel `json:"computeModel,omitempty"` + CoreCountIncrement *int64 `json:"coreCountIncrement,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + MaxStorageCount *int64 `json:"maxStorageCount,omitempty"` + MaximumNodeCount *int64 `json:"maximumNodeCount,omitempty"` + MinCoreCountPerNode *int64 `json:"minCoreCountPerNode,omitempty"` + MinDataStorageInTbs *int64 `json:"minDataStorageInTbs,omitempty"` + MinDbNodeStoragePerNodeInGbs *int64 `json:"minDbNodeStoragePerNodeInGbs,omitempty"` + MinMemoryPerNodeInGbs *int64 `json:"minMemoryPerNodeInGbs,omitempty"` + MinStorageCount *int64 `json:"minStorageCount,omitempty"` + MinimumCoreCount *int64 `json:"minimumCoreCount,omitempty"` + MinimumNodeCount *int64 `json:"minimumNodeCount,omitempty"` + RuntimeMinimumCoreCount *int64 `json:"runtimeMinimumCoreCount,omitempty"` + ShapeAttributes *[]string `json:"shapeAttributes,omitempty"` + ShapeFamily *string `json:"shapeFamily,omitempty"` + ShapeName string `json:"shapeName"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/predicates.go b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/predicates.go new file mode 100644 index 00000000000..34452fe4cf6 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/predicates.go @@ -0,0 +1,27 @@ +package dbsystemshapes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbSystemShapeOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DbSystemShapeOperationPredicate) Matches(input DbSystemShape) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/version.go b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/version.go similarity index 60% rename from resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/version.go rename to resource-manager/oracledatabase/2025-09-01/dbsystemshapes/version.go index 7f16d91bcd0..e0bf8346a1b 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/version.go +++ b/resource-manager/oracledatabase/2025-09-01/dbsystemshapes/version.go @@ -1,10 +1,10 @@ -package featuresupport +package dbsystemshapes // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2025-02-01" +const defaultApiVersion = "2025-09-01" func userAgent() string { - return "hashicorp/go-azure-sdk/featuresupport/2025-02-01" + return "hashicorp/go-azure-sdk/dbsystemshapes/2025-09-01" } diff --git a/resource-manager/oracledatabase/2025-09-01/dbversions/README.md b/resource-manager/oracledatabase/2025-09-01/dbversions/README.md new file mode 100644 index 00000000000..b1507ab82ec --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbversions/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/dbversions` Documentation + +The `dbversions` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/dbversions" +``` + + +### Client Initialization + +```go +client := dbversions.NewDbVersionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DbVersionsClient.Get` + +```go +ctx := context.TODO() +id := dbversions.NewDbSystemDbVersionID("12345678-1234-9876-4563-123456789012", "locationName", "dbSystemDbVersionName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DbVersionsClient.ListByLocation` + +```go +ctx := context.TODO() +id := dbversions.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +// alternatively `client.ListByLocation(ctx, id, dbversions.DefaultListByLocationOperationOptions())` can be used to do batched pagination +items, err := client.ListByLocationComplete(ctx, id, dbversions.DefaultListByLocationOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/dbversions/client.go b/resource-manager/oracledatabase/2025-09-01/dbversions/client.go new file mode 100644 index 00000000000..2f16c652100 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbversions/client.go @@ -0,0 +1,26 @@ +package dbversions + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbVersionsClient struct { + Client *resourcemanager.Client +} + +func NewDbVersionsClientWithBaseURI(sdkApi sdkEnv.Api) (*DbVersionsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "dbversions", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DbVersionsClient: %+v", err) + } + + return &DbVersionsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbversions/constants.go b/resource-manager/oracledatabase/2025-09-01/dbversions/constants.go new file mode 100644 index 00000000000..f5b022b8cfa --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbversions/constants.go @@ -0,0 +1,133 @@ +package dbversions + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BaseDbSystemShapes string + +const ( + BaseDbSystemShapesVMPointStandardPointxEightSix BaseDbSystemShapes = "VM.Standard.x86" +) + +func PossibleValuesForBaseDbSystemShapes() []string { + return []string{ + string(BaseDbSystemShapesVMPointStandardPointxEightSix), + } +} + +func (s *BaseDbSystemShapes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBaseDbSystemShapes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseBaseDbSystemShapes(input string) (*BaseDbSystemShapes, error) { + vals := map[string]BaseDbSystemShapes{ + "vm.standard.x86": BaseDbSystemShapesVMPointStandardPointxEightSix, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BaseDbSystemShapes(input) + return &out, nil +} + +type ShapeFamilyType string + +const ( + ShapeFamilyTypeEXADATA ShapeFamilyType = "EXADATA" + ShapeFamilyTypeEXADBXS ShapeFamilyType = "EXADB_XS" + ShapeFamilyTypeSINGLENODE ShapeFamilyType = "SINGLENODE" + ShapeFamilyTypeVirtualMachine ShapeFamilyType = "VIRTUALMACHINE" +) + +func PossibleValuesForShapeFamilyType() []string { + return []string{ + string(ShapeFamilyTypeEXADATA), + string(ShapeFamilyTypeEXADBXS), + string(ShapeFamilyTypeSINGLENODE), + string(ShapeFamilyTypeVirtualMachine), + } +} + +func (s *ShapeFamilyType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseShapeFamilyType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseShapeFamilyType(input string) (*ShapeFamilyType, error) { + vals := map[string]ShapeFamilyType{ + "exadata": ShapeFamilyTypeEXADATA, + "exadb_xs": ShapeFamilyTypeEXADBXS, + "singlenode": ShapeFamilyTypeSINGLENODE, + "virtualmachine": ShapeFamilyTypeVirtualMachine, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ShapeFamilyType(input) + return &out, nil +} + +type StorageManagementType string + +const ( + StorageManagementTypeLVM StorageManagementType = "LVM" +) + +func PossibleValuesForStorageManagementType() []string { + return []string{ + string(StorageManagementTypeLVM), + } +} + +func (s *StorageManagementType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStorageManagementType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStorageManagementType(input string) (*StorageManagementType, error) { + vals := map[string]StorageManagementType{ + "lvm": StorageManagementTypeLVM, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageManagementType(input) + return &out, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbversions/id_dbsystemdbversion.go b/resource-manager/oracledatabase/2025-09-01/dbversions/id_dbsystemdbversion.go new file mode 100644 index 00000000000..67b33742a3c --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbversions/id_dbsystemdbversion.go @@ -0,0 +1,130 @@ +package dbversions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&DbSystemDbVersionId{}) +} + +var _ resourceids.ResourceId = &DbSystemDbVersionId{} + +// DbSystemDbVersionId is a struct representing the Resource ID for a Db System Db Version +type DbSystemDbVersionId struct { + SubscriptionId string + LocationName string + DbSystemDbVersionName string +} + +// NewDbSystemDbVersionID returns a new DbSystemDbVersionId struct +func NewDbSystemDbVersionID(subscriptionId string, locationName string, dbSystemDbVersionName string) DbSystemDbVersionId { + return DbSystemDbVersionId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + DbSystemDbVersionName: dbSystemDbVersionName, + } +} + +// ParseDbSystemDbVersionID parses 'input' into a DbSystemDbVersionId +func ParseDbSystemDbVersionID(input string) (*DbSystemDbVersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&DbSystemDbVersionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DbSystemDbVersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseDbSystemDbVersionIDInsensitively parses 'input' case-insensitively into a DbSystemDbVersionId +// note: this method should only be used for API response data and not user input +func ParseDbSystemDbVersionIDInsensitively(input string) (*DbSystemDbVersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&DbSystemDbVersionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DbSystemDbVersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DbSystemDbVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.DbSystemDbVersionName, ok = input.Parsed["dbSystemDbVersionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dbSystemDbVersionName", input) + } + + return nil +} + +// ValidateDbSystemDbVersionID checks that 'input' can be parsed as a Db System Db Version ID +func ValidateDbSystemDbVersionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDbSystemDbVersionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Db System Db Version ID +func (id DbSystemDbVersionId) ID() string { + fmtString := "/subscriptions/%s/providers/Oracle.Database/locations/%s/dbSystemDbVersions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.DbSystemDbVersionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Db System Db Version ID +func (id DbSystemDbVersionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticDbSystemDbVersions", "dbSystemDbVersions", "dbSystemDbVersions"), + resourceids.UserSpecifiedSegment("dbSystemDbVersionName", "dbSystemDbVersionName"), + } +} + +// String returns a human-readable description of this Db System Db Version ID +func (id DbSystemDbVersionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Db System Db Version Name: %q", id.DbSystemDbVersionName), + } + return fmt.Sprintf("Db System Db Version (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbversions/id_dbsystemdbversion_test.go b/resource-manager/oracledatabase/2025-09-01/dbversions/id_dbsystemdbversion_test.go new file mode 100644 index 00000000000..36a5ed8a742 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbversions/id_dbsystemdbversion_test.go @@ -0,0 +1,282 @@ +package dbversions + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &DbSystemDbVersionId{} + +func TestNewDbSystemDbVersionID(t *testing.T) { + id := NewDbSystemDbVersionID("12345678-1234-9876-4563-123456789012", "locationName", "dbSystemDbVersionName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.DbSystemDbVersionName != "dbSystemDbVersionName" { + t.Fatalf("Expected %q but got %q for Segment 'DbSystemDbVersionName'", id.DbSystemDbVersionName, "dbSystemDbVersionName") + } +} + +func TestFormatDbSystemDbVersionID(t *testing.T) { + actual := NewDbSystemDbVersionID("12345678-1234-9876-4563-123456789012", "locationName", "dbSystemDbVersionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dbSystemDbVersions/dbSystemDbVersionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseDbSystemDbVersionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *DbSystemDbVersionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dbSystemDbVersions", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dbSystemDbVersions/dbSystemDbVersionName", + Expected: &DbSystemDbVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + DbSystemDbVersionName: "dbSystemDbVersionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dbSystemDbVersions/dbSystemDbVersionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseDbSystemDbVersionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.DbSystemDbVersionName != v.Expected.DbSystemDbVersionName { + t.Fatalf("Expected %q but got %q for DbSystemDbVersionName", v.Expected.DbSystemDbVersionName, actual.DbSystemDbVersionName) + } + + } +} + +func TestParseDbSystemDbVersionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *DbSystemDbVersionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dbSystemDbVersions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/dBsYsTeMdBvErSiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dbSystemDbVersions/dbSystemDbVersionName", + Expected: &DbSystemDbVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + DbSystemDbVersionName: "dbSystemDbVersionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dbSystemDbVersions/dbSystemDbVersionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/dBsYsTeMdBvErSiOnS/dBsYsTeMdBvErSiOnNaMe", + Expected: &DbSystemDbVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + DbSystemDbVersionName: "dBsYsTeMdBvErSiOnNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/dBsYsTeMdBvErSiOnS/dBsYsTeMdBvErSiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseDbSystemDbVersionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.DbSystemDbVersionName != v.Expected.DbSystemDbVersionName { + t.Fatalf("Expected %q but got %q for DbSystemDbVersionName", v.Expected.DbSystemDbVersionName, actual.DbSystemDbVersionName) + } + + } +} + +func TestSegmentsForDbSystemDbVersionId(t *testing.T) { + segments := DbSystemDbVersionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("DbSystemDbVersionId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbversions/id_location.go b/resource-manager/oracledatabase/2025-09-01/dbversions/id_location.go new file mode 100644 index 00000000000..3bb30f8ce7e --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbversions/id_location.go @@ -0,0 +1,121 @@ +package dbversions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&LocationId{}) +} + +var _ resourceids.ResourceId = &LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + LocationName string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, locationName string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Oracle.Database/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbversions/id_location_test.go b/resource-manager/oracledatabase/2025-09-01/dbversions/id_location_test.go new file mode 100644 index 00000000000..1268763edb9 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbversions/id_location_test.go @@ -0,0 +1,237 @@ +package dbversions + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &LocationId{} + +func TestNewLocationID(t *testing.T) { + id := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } +} + +func TestFormatLocationID(t *testing.T) { + actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseLocationID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LocationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseLocationID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestParseLocationIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LocationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseLocationIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestSegmentsForLocationId(t *testing.T) { + segments := LocationId{}.Segments() + if len(segments) == 0 { + t.Fatalf("LocationId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbversions/method_get.go b/resource-manager/oracledatabase/2025-09-01/dbversions/method_get.go new file mode 100644 index 00000000000..eabbf58c8fe --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbversions/method_get.go @@ -0,0 +1,53 @@ +package dbversions + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DbVersion +} + +// Get ... +func (c DbVersionsClient) Get(ctx context.Context, id DbSystemDbVersionId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model DbVersion + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbversions/method_listbylocation.go b/resource-manager/oracledatabase/2025-09-01/dbversions/method_listbylocation.go new file mode 100644 index 00000000000..e834440e4bc --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbversions/method_listbylocation.go @@ -0,0 +1,154 @@ +package dbversions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByLocationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DbVersion +} + +type ListByLocationCompleteResult struct { + LatestHttpResponse *http.Response + Items []DbVersion +} + +type ListByLocationOperationOptions struct { + DbSystemId *string + DbSystemShape *BaseDbSystemShapes + IsDatabaseSoftwareImageSupported *bool + IsUpgradeSupported *bool + ShapeFamily *ShapeFamilyType + StorageManagement *StorageManagementType +} + +func DefaultListByLocationOperationOptions() ListByLocationOperationOptions { + return ListByLocationOperationOptions{} +} + +func (o ListByLocationOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByLocationOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListByLocationOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.DbSystemId != nil { + out.Append("dbSystemId", fmt.Sprintf("%v", *o.DbSystemId)) + } + if o.DbSystemShape != nil { + out.Append("dbSystemShape", fmt.Sprintf("%v", *o.DbSystemShape)) + } + if o.IsDatabaseSoftwareImageSupported != nil { + out.Append("isDatabaseSoftwareImageSupported", fmt.Sprintf("%v", *o.IsDatabaseSoftwareImageSupported)) + } + if o.IsUpgradeSupported != nil { + out.Append("isUpgradeSupported", fmt.Sprintf("%v", *o.IsUpgradeSupported)) + } + if o.ShapeFamily != nil { + out.Append("shapeFamily", fmt.Sprintf("%v", *o.ShapeFamily)) + } + if o.StorageManagement != nil { + out.Append("storageManagement", fmt.Sprintf("%v", *o.StorageManagement)) + } + return &out +} + +type ListByLocationCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByLocationCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByLocation ... +func (c DbVersionsClient) ListByLocation(ctx context.Context, id LocationId, options ListByLocationOperationOptions) (result ListByLocationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListByLocationCustomPager{}, + Path: fmt.Sprintf("%s/dbSystemDbVersions", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]DbVersion `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByLocationComplete retrieves all the results into a single object +func (c DbVersionsClient) ListByLocationComplete(ctx context.Context, id LocationId, options ListByLocationOperationOptions) (ListByLocationCompleteResult, error) { + return c.ListByLocationCompleteMatchingPredicate(ctx, id, options, DbVersionOperationPredicate{}) +} + +// ListByLocationCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DbVersionsClient) ListByLocationCompleteMatchingPredicate(ctx context.Context, id LocationId, options ListByLocationOperationOptions, predicate DbVersionOperationPredicate) (result ListByLocationCompleteResult, err error) { + items := make([]DbVersion, 0) + + resp, err := c.ListByLocation(ctx, id, options) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByLocationCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbversions/model_dbversion.go b/resource-manager/oracledatabase/2025-09-01/dbversions/model_dbversion.go new file mode 100644 index 00000000000..52df77f561e --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbversions/model_dbversion.go @@ -0,0 +1,16 @@ +package dbversions + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbVersion struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DbVersionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbversions/model_dbversionproperties.go b/resource-manager/oracledatabase/2025-09-01/dbversions/model_dbversionproperties.go new file mode 100644 index 00000000000..5ee3ef630dc --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbversions/model_dbversionproperties.go @@ -0,0 +1,12 @@ +package dbversions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbVersionProperties struct { + IsLatestForMajorVersion *bool `json:"isLatestForMajorVersion,omitempty"` + IsPreviewDbVersion *bool `json:"isPreviewDbVersion,omitempty"` + IsUpgradeSupported *bool `json:"isUpgradeSupported,omitempty"` + SupportsPdb *bool `json:"supportsPdb,omitempty"` + Version string `json:"version"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbversions/predicates.go b/resource-manager/oracledatabase/2025-09-01/dbversions/predicates.go new file mode 100644 index 00000000000..48dde7053eb --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbversions/predicates.go @@ -0,0 +1,27 @@ +package dbversions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbVersionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DbVersionOperationPredicate) Matches(input DbVersion) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/oracledatabase/2025-09-01/dbversions/version.go b/resource-manager/oracledatabase/2025-09-01/dbversions/version.go new file mode 100644 index 00000000000..b5fd2a840a9 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dbversions/version.go @@ -0,0 +1,10 @@ +package dbversions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-09-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/dbversions/2025-09-01" +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/README.md b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/README.md new file mode 100644 index 00000000000..0907584b631 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/dnsprivateviews` Documentation + +The `dnsprivateviews` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/dnsprivateviews" +``` + + +### Client Initialization + +```go +client := dnsprivateviews.NewDnsPrivateViewsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DnsPrivateViewsClient.Get` + +```go +ctx := context.TODO() +id := dnsprivateviews.NewDnsPrivateViewID("12345678-1234-9876-4563-123456789012", "locationName", "dnsPrivateViewName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DnsPrivateViewsClient.ListByLocation` + +```go +ctx := context.TODO() +id := dnsprivateviews.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +// alternatively `client.ListByLocation(ctx, id)` can be used to do batched pagination +items, err := client.ListByLocationComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/client.go b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/client.go new file mode 100644 index 00000000000..85e60c22dc9 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/client.go @@ -0,0 +1,26 @@ +package dnsprivateviews + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnsPrivateViewsClient struct { + Client *resourcemanager.Client +} + +func NewDnsPrivateViewsClientWithBaseURI(sdkApi sdkEnv.Api) (*DnsPrivateViewsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "dnsprivateviews", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DnsPrivateViewsClient: %+v", err) + } + + return &DnsPrivateViewsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/constants.go b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/constants.go new file mode 100644 index 00000000000..2dbb8a48f9e --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/constants.go @@ -0,0 +1,101 @@ +package dnsprivateviews + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnsPrivateViewsLifecycleState string + +const ( + DnsPrivateViewsLifecycleStateActive DnsPrivateViewsLifecycleState = "Active" + DnsPrivateViewsLifecycleStateDeleted DnsPrivateViewsLifecycleState = "Deleted" + DnsPrivateViewsLifecycleStateDeleting DnsPrivateViewsLifecycleState = "Deleting" + DnsPrivateViewsLifecycleStateUpdating DnsPrivateViewsLifecycleState = "Updating" +) + +func PossibleValuesForDnsPrivateViewsLifecycleState() []string { + return []string{ + string(DnsPrivateViewsLifecycleStateActive), + string(DnsPrivateViewsLifecycleStateDeleted), + string(DnsPrivateViewsLifecycleStateDeleting), + string(DnsPrivateViewsLifecycleStateUpdating), + } +} + +func (s *DnsPrivateViewsLifecycleState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDnsPrivateViewsLifecycleState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDnsPrivateViewsLifecycleState(input string) (*DnsPrivateViewsLifecycleState, error) { + vals := map[string]DnsPrivateViewsLifecycleState{ + "active": DnsPrivateViewsLifecycleStateActive, + "deleted": DnsPrivateViewsLifecycleStateDeleted, + "deleting": DnsPrivateViewsLifecycleStateDeleting, + "updating": DnsPrivateViewsLifecycleStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DnsPrivateViewsLifecycleState(input) + return &out, nil +} + +type ResourceProvisioningState string + +const ( + ResourceProvisioningStateCanceled ResourceProvisioningState = "Canceled" + ResourceProvisioningStateFailed ResourceProvisioningState = "Failed" + ResourceProvisioningStateSucceeded ResourceProvisioningState = "Succeeded" +) + +func PossibleValuesForResourceProvisioningState() []string { + return []string{ + string(ResourceProvisioningStateCanceled), + string(ResourceProvisioningStateFailed), + string(ResourceProvisioningStateSucceeded), + } +} + +func (s *ResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseResourceProvisioningState(input string) (*ResourceProvisioningState, error) { + vals := map[string]ResourceProvisioningState{ + "canceled": ResourceProvisioningStateCanceled, + "failed": ResourceProvisioningStateFailed, + "succeeded": ResourceProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceProvisioningState(input) + return &out, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/id_dnsprivateview.go b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/id_dnsprivateview.go new file mode 100644 index 00000000000..a2434fd5825 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/id_dnsprivateview.go @@ -0,0 +1,130 @@ +package dnsprivateviews + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&DnsPrivateViewId{}) +} + +var _ resourceids.ResourceId = &DnsPrivateViewId{} + +// DnsPrivateViewId is a struct representing the Resource ID for a Dns Private View +type DnsPrivateViewId struct { + SubscriptionId string + LocationName string + DnsPrivateViewName string +} + +// NewDnsPrivateViewID returns a new DnsPrivateViewId struct +func NewDnsPrivateViewID(subscriptionId string, locationName string, dnsPrivateViewName string) DnsPrivateViewId { + return DnsPrivateViewId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + DnsPrivateViewName: dnsPrivateViewName, + } +} + +// ParseDnsPrivateViewID parses 'input' into a DnsPrivateViewId +func ParseDnsPrivateViewID(input string) (*DnsPrivateViewId, error) { + parser := resourceids.NewParserFromResourceIdType(&DnsPrivateViewId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DnsPrivateViewId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseDnsPrivateViewIDInsensitively parses 'input' case-insensitively into a DnsPrivateViewId +// note: this method should only be used for API response data and not user input +func ParseDnsPrivateViewIDInsensitively(input string) (*DnsPrivateViewId, error) { + parser := resourceids.NewParserFromResourceIdType(&DnsPrivateViewId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DnsPrivateViewId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DnsPrivateViewId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.DnsPrivateViewName, ok = input.Parsed["dnsPrivateViewName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsPrivateViewName", input) + } + + return nil +} + +// ValidateDnsPrivateViewID checks that 'input' can be parsed as a Dns Private View ID +func ValidateDnsPrivateViewID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDnsPrivateViewID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Dns Private View ID +func (id DnsPrivateViewId) ID() string { + fmtString := "/subscriptions/%s/providers/Oracle.Database/locations/%s/dnsPrivateViews/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.DnsPrivateViewName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Dns Private View ID +func (id DnsPrivateViewId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticDnsPrivateViews", "dnsPrivateViews", "dnsPrivateViews"), + resourceids.UserSpecifiedSegment("dnsPrivateViewName", "dnsPrivateViewName"), + } +} + +// String returns a human-readable description of this Dns Private View ID +func (id DnsPrivateViewId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Dns Private View Name: %q", id.DnsPrivateViewName), + } + return fmt.Sprintf("Dns Private View (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/id_dnsprivateview_test.go b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/id_dnsprivateview_test.go new file mode 100644 index 00000000000..87deb9c6162 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/id_dnsprivateview_test.go @@ -0,0 +1,282 @@ +package dnsprivateviews + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &DnsPrivateViewId{} + +func TestNewDnsPrivateViewID(t *testing.T) { + id := NewDnsPrivateViewID("12345678-1234-9876-4563-123456789012", "locationName", "dnsPrivateViewName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.DnsPrivateViewName != "dnsPrivateViewName" { + t.Fatalf("Expected %q but got %q for Segment 'DnsPrivateViewName'", id.DnsPrivateViewName, "dnsPrivateViewName") + } +} + +func TestFormatDnsPrivateViewID(t *testing.T) { + actual := NewDnsPrivateViewID("12345678-1234-9876-4563-123456789012", "locationName", "dnsPrivateViewName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dnsPrivateViews/dnsPrivateViewName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseDnsPrivateViewID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *DnsPrivateViewId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dnsPrivateViews", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dnsPrivateViews/dnsPrivateViewName", + Expected: &DnsPrivateViewId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + DnsPrivateViewName: "dnsPrivateViewName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dnsPrivateViews/dnsPrivateViewName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseDnsPrivateViewID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.DnsPrivateViewName != v.Expected.DnsPrivateViewName { + t.Fatalf("Expected %q but got %q for DnsPrivateViewName", v.Expected.DnsPrivateViewName, actual.DnsPrivateViewName) + } + + } +} + +func TestParseDnsPrivateViewIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *DnsPrivateViewId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dnsPrivateViews", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/dNsPrIvAtEvIeWs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dnsPrivateViews/dnsPrivateViewName", + Expected: &DnsPrivateViewId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + DnsPrivateViewName: "dnsPrivateViewName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dnsPrivateViews/dnsPrivateViewName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/dNsPrIvAtEvIeWs/dNsPrIvAtEvIeWnAmE", + Expected: &DnsPrivateViewId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + DnsPrivateViewName: "dNsPrIvAtEvIeWnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/dNsPrIvAtEvIeWs/dNsPrIvAtEvIeWnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseDnsPrivateViewIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.DnsPrivateViewName != v.Expected.DnsPrivateViewName { + t.Fatalf("Expected %q but got %q for DnsPrivateViewName", v.Expected.DnsPrivateViewName, actual.DnsPrivateViewName) + } + + } +} + +func TestSegmentsForDnsPrivateViewId(t *testing.T) { + segments := DnsPrivateViewId{}.Segments() + if len(segments) == 0 { + t.Fatalf("DnsPrivateViewId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/id_location.go b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/id_location.go new file mode 100644 index 00000000000..8224f875a87 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/id_location.go @@ -0,0 +1,121 @@ +package dnsprivateviews + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&LocationId{}) +} + +var _ resourceids.ResourceId = &LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + LocationName string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, locationName string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Oracle.Database/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/id_location_test.go b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/id_location_test.go new file mode 100644 index 00000000000..6d5d848b925 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/id_location_test.go @@ -0,0 +1,237 @@ +package dnsprivateviews + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &LocationId{} + +func TestNewLocationID(t *testing.T) { + id := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } +} + +func TestFormatLocationID(t *testing.T) { + actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseLocationID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LocationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseLocationID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestParseLocationIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LocationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseLocationIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestSegmentsForLocationId(t *testing.T) { + segments := LocationId{}.Segments() + if len(segments) == 0 { + t.Fatalf("LocationId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/method_get.go b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/method_get.go new file mode 100644 index 00000000000..81ad40dd47f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/method_get.go @@ -0,0 +1,53 @@ +package dnsprivateviews + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DnsPrivateView +} + +// Get ... +func (c DnsPrivateViewsClient) Get(ctx context.Context, id DnsPrivateViewId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model DnsPrivateView + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/method_listbylocation.go b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/method_listbylocation.go new file mode 100644 index 00000000000..a0a0c822770 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/method_listbylocation.go @@ -0,0 +1,105 @@ +package dnsprivateviews + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByLocationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DnsPrivateView +} + +type ListByLocationCompleteResult struct { + LatestHttpResponse *http.Response + Items []DnsPrivateView +} + +type ListByLocationCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByLocationCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByLocation ... +func (c DnsPrivateViewsClient) ListByLocation(ctx context.Context, id LocationId) (result ListByLocationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByLocationCustomPager{}, + Path: fmt.Sprintf("%s/dnsPrivateViews", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]DnsPrivateView `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByLocationComplete retrieves all the results into a single object +func (c DnsPrivateViewsClient) ListByLocationComplete(ctx context.Context, id LocationId) (ListByLocationCompleteResult, error) { + return c.ListByLocationCompleteMatchingPredicate(ctx, id, DnsPrivateViewOperationPredicate{}) +} + +// ListByLocationCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DnsPrivateViewsClient) ListByLocationCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate DnsPrivateViewOperationPredicate) (result ListByLocationCompleteResult, err error) { + items := make([]DnsPrivateView, 0) + + resp, err := c.ListByLocation(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByLocationCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/model_dnsprivateview.go b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/model_dnsprivateview.go new file mode 100644 index 00000000000..fbf51b79e0f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/model_dnsprivateview.go @@ -0,0 +1,16 @@ +package dnsprivateviews + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnsPrivateView struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DnsPrivateViewProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/model_dnsprivateviewproperties.go b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/model_dnsprivateviewproperties.go new file mode 100644 index 00000000000..6f06446ebce --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/model_dnsprivateviewproperties.go @@ -0,0 +1,39 @@ +package dnsprivateviews + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnsPrivateViewProperties struct { + DisplayName string `json:"displayName"` + IsProtected bool `json:"isProtected"` + LifecycleState DnsPrivateViewsLifecycleState `json:"lifecycleState"` + Ocid string `json:"ocid"` + ProvisioningState *ResourceProvisioningState `json:"provisioningState,omitempty"` + Self string `json:"self"` + TimeCreated string `json:"timeCreated"` + TimeUpdated string `json:"timeUpdated"` +} + +func (o *DnsPrivateViewProperties) GetTimeCreatedAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *DnsPrivateViewProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = formatted +} + +func (o *DnsPrivateViewProperties) GetTimeUpdatedAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.TimeUpdated, "2006-01-02T15:04:05Z07:00") +} + +func (o *DnsPrivateViewProperties) SetTimeUpdatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeUpdated = formatted +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/predicates.go b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/predicates.go new file mode 100644 index 00000000000..294303d391a --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/predicates.go @@ -0,0 +1,27 @@ +package dnsprivateviews + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnsPrivateViewOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DnsPrivateViewOperationPredicate) Matches(input DnsPrivateView) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/version.go b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/version.go new file mode 100644 index 00000000000..6c01f7bc193 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivateviews/version.go @@ -0,0 +1,10 @@ +package dnsprivateviews + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-09-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/dnsprivateviews/2025-09-01" +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/README.md b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/README.md new file mode 100644 index 00000000000..a45320a1956 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/dnsprivatezones` Documentation + +The `dnsprivatezones` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/dnsprivatezones" +``` + + +### Client Initialization + +```go +client := dnsprivatezones.NewDnsPrivateZonesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DnsPrivateZonesClient.Get` + +```go +ctx := context.TODO() +id := dnsprivatezones.NewDnsPrivateZoneID("12345678-1234-9876-4563-123456789012", "locationName", "dnsPrivateZoneName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DnsPrivateZonesClient.ListByLocation` + +```go +ctx := context.TODO() +id := dnsprivatezones.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +// alternatively `client.ListByLocation(ctx, id)` can be used to do batched pagination +items, err := client.ListByLocationComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/client.go b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/client.go new file mode 100644 index 00000000000..5596628406e --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/client.go @@ -0,0 +1,26 @@ +package dnsprivatezones + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnsPrivateZonesClient struct { + Client *resourcemanager.Client +} + +func NewDnsPrivateZonesClientWithBaseURI(sdkApi sdkEnv.Api) (*DnsPrivateZonesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "dnsprivatezones", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DnsPrivateZonesClient: %+v", err) + } + + return &DnsPrivateZonesClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/constants.go b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/constants.go new file mode 100644 index 00000000000..e9502880546 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/constants.go @@ -0,0 +1,145 @@ +package dnsprivatezones + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnsPrivateZonesLifecycleState string + +const ( + DnsPrivateZonesLifecycleStateActive DnsPrivateZonesLifecycleState = "Active" + DnsPrivateZonesLifecycleStateCreating DnsPrivateZonesLifecycleState = "Creating" + DnsPrivateZonesLifecycleStateDeleted DnsPrivateZonesLifecycleState = "Deleted" + DnsPrivateZonesLifecycleStateDeleting DnsPrivateZonesLifecycleState = "Deleting" + DnsPrivateZonesLifecycleStateUpdating DnsPrivateZonesLifecycleState = "Updating" +) + +func PossibleValuesForDnsPrivateZonesLifecycleState() []string { + return []string{ + string(DnsPrivateZonesLifecycleStateActive), + string(DnsPrivateZonesLifecycleStateCreating), + string(DnsPrivateZonesLifecycleStateDeleted), + string(DnsPrivateZonesLifecycleStateDeleting), + string(DnsPrivateZonesLifecycleStateUpdating), + } +} + +func (s *DnsPrivateZonesLifecycleState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDnsPrivateZonesLifecycleState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDnsPrivateZonesLifecycleState(input string) (*DnsPrivateZonesLifecycleState, error) { + vals := map[string]DnsPrivateZonesLifecycleState{ + "active": DnsPrivateZonesLifecycleStateActive, + "creating": DnsPrivateZonesLifecycleStateCreating, + "deleted": DnsPrivateZonesLifecycleStateDeleted, + "deleting": DnsPrivateZonesLifecycleStateDeleting, + "updating": DnsPrivateZonesLifecycleStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DnsPrivateZonesLifecycleState(input) + return &out, nil +} + +type ResourceProvisioningState string + +const ( + ResourceProvisioningStateCanceled ResourceProvisioningState = "Canceled" + ResourceProvisioningStateFailed ResourceProvisioningState = "Failed" + ResourceProvisioningStateSucceeded ResourceProvisioningState = "Succeeded" +) + +func PossibleValuesForResourceProvisioningState() []string { + return []string{ + string(ResourceProvisioningStateCanceled), + string(ResourceProvisioningStateFailed), + string(ResourceProvisioningStateSucceeded), + } +} + +func (s *ResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseResourceProvisioningState(input string) (*ResourceProvisioningState, error) { + vals := map[string]ResourceProvisioningState{ + "canceled": ResourceProvisioningStateCanceled, + "failed": ResourceProvisioningStateFailed, + "succeeded": ResourceProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceProvisioningState(input) + return &out, nil +} + +type ZoneType string + +const ( + ZoneTypePrimary ZoneType = "Primary" + ZoneTypeSecondary ZoneType = "Secondary" +) + +func PossibleValuesForZoneType() []string { + return []string{ + string(ZoneTypePrimary), + string(ZoneTypeSecondary), + } +} + +func (s *ZoneType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseZoneType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseZoneType(input string) (*ZoneType, error) { + vals := map[string]ZoneType{ + "primary": ZoneTypePrimary, + "secondary": ZoneTypeSecondary, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ZoneType(input) + return &out, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/id_dnsprivatezone.go b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/id_dnsprivatezone.go new file mode 100644 index 00000000000..436717fdeaf --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/id_dnsprivatezone.go @@ -0,0 +1,130 @@ +package dnsprivatezones + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&DnsPrivateZoneId{}) +} + +var _ resourceids.ResourceId = &DnsPrivateZoneId{} + +// DnsPrivateZoneId is a struct representing the Resource ID for a Dns Private Zone +type DnsPrivateZoneId struct { + SubscriptionId string + LocationName string + DnsPrivateZoneName string +} + +// NewDnsPrivateZoneID returns a new DnsPrivateZoneId struct +func NewDnsPrivateZoneID(subscriptionId string, locationName string, dnsPrivateZoneName string) DnsPrivateZoneId { + return DnsPrivateZoneId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + DnsPrivateZoneName: dnsPrivateZoneName, + } +} + +// ParseDnsPrivateZoneID parses 'input' into a DnsPrivateZoneId +func ParseDnsPrivateZoneID(input string) (*DnsPrivateZoneId, error) { + parser := resourceids.NewParserFromResourceIdType(&DnsPrivateZoneId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DnsPrivateZoneId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseDnsPrivateZoneIDInsensitively parses 'input' case-insensitively into a DnsPrivateZoneId +// note: this method should only be used for API response data and not user input +func ParseDnsPrivateZoneIDInsensitively(input string) (*DnsPrivateZoneId, error) { + parser := resourceids.NewParserFromResourceIdType(&DnsPrivateZoneId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DnsPrivateZoneId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DnsPrivateZoneId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.DnsPrivateZoneName, ok = input.Parsed["dnsPrivateZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsPrivateZoneName", input) + } + + return nil +} + +// ValidateDnsPrivateZoneID checks that 'input' can be parsed as a Dns Private Zone ID +func ValidateDnsPrivateZoneID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDnsPrivateZoneID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Dns Private Zone ID +func (id DnsPrivateZoneId) ID() string { + fmtString := "/subscriptions/%s/providers/Oracle.Database/locations/%s/dnsPrivateZones/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.DnsPrivateZoneName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Dns Private Zone ID +func (id DnsPrivateZoneId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticDnsPrivateZones", "dnsPrivateZones", "dnsPrivateZones"), + resourceids.UserSpecifiedSegment("dnsPrivateZoneName", "dnsPrivateZoneName"), + } +} + +// String returns a human-readable description of this Dns Private Zone ID +func (id DnsPrivateZoneId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Dns Private Zone Name: %q", id.DnsPrivateZoneName), + } + return fmt.Sprintf("Dns Private Zone (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/id_dnsprivatezone_test.go b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/id_dnsprivatezone_test.go new file mode 100644 index 00000000000..74562aa8144 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/id_dnsprivatezone_test.go @@ -0,0 +1,282 @@ +package dnsprivatezones + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &DnsPrivateZoneId{} + +func TestNewDnsPrivateZoneID(t *testing.T) { + id := NewDnsPrivateZoneID("12345678-1234-9876-4563-123456789012", "locationName", "dnsPrivateZoneName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.DnsPrivateZoneName != "dnsPrivateZoneName" { + t.Fatalf("Expected %q but got %q for Segment 'DnsPrivateZoneName'", id.DnsPrivateZoneName, "dnsPrivateZoneName") + } +} + +func TestFormatDnsPrivateZoneID(t *testing.T) { + actual := NewDnsPrivateZoneID("12345678-1234-9876-4563-123456789012", "locationName", "dnsPrivateZoneName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dnsPrivateZones/dnsPrivateZoneName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseDnsPrivateZoneID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *DnsPrivateZoneId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dnsPrivateZones", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dnsPrivateZones/dnsPrivateZoneName", + Expected: &DnsPrivateZoneId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + DnsPrivateZoneName: "dnsPrivateZoneName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dnsPrivateZones/dnsPrivateZoneName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseDnsPrivateZoneID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.DnsPrivateZoneName != v.Expected.DnsPrivateZoneName { + t.Fatalf("Expected %q but got %q for DnsPrivateZoneName", v.Expected.DnsPrivateZoneName, actual.DnsPrivateZoneName) + } + + } +} + +func TestParseDnsPrivateZoneIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *DnsPrivateZoneId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dnsPrivateZones", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/dNsPrIvAtEzOnEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dnsPrivateZones/dnsPrivateZoneName", + Expected: &DnsPrivateZoneId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + DnsPrivateZoneName: "dnsPrivateZoneName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/dnsPrivateZones/dnsPrivateZoneName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/dNsPrIvAtEzOnEs/dNsPrIvAtEzOnEnAmE", + Expected: &DnsPrivateZoneId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + DnsPrivateZoneName: "dNsPrIvAtEzOnEnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/dNsPrIvAtEzOnEs/dNsPrIvAtEzOnEnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseDnsPrivateZoneIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.DnsPrivateZoneName != v.Expected.DnsPrivateZoneName { + t.Fatalf("Expected %q but got %q for DnsPrivateZoneName", v.Expected.DnsPrivateZoneName, actual.DnsPrivateZoneName) + } + + } +} + +func TestSegmentsForDnsPrivateZoneId(t *testing.T) { + segments := DnsPrivateZoneId{}.Segments() + if len(segments) == 0 { + t.Fatalf("DnsPrivateZoneId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/id_location.go b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/id_location.go new file mode 100644 index 00000000000..da99d928e82 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/id_location.go @@ -0,0 +1,121 @@ +package dnsprivatezones + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&LocationId{}) +} + +var _ resourceids.ResourceId = &LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + LocationName string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, locationName string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Oracle.Database/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/id_location_test.go b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/id_location_test.go new file mode 100644 index 00000000000..148355e5931 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/id_location_test.go @@ -0,0 +1,237 @@ +package dnsprivatezones + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &LocationId{} + +func TestNewLocationID(t *testing.T) { + id := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } +} + +func TestFormatLocationID(t *testing.T) { + actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseLocationID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LocationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseLocationID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestParseLocationIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LocationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseLocationIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestSegmentsForLocationId(t *testing.T) { + segments := LocationId{}.Segments() + if len(segments) == 0 { + t.Fatalf("LocationId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/method_get.go b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/method_get.go new file mode 100644 index 00000000000..87277d0e938 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/method_get.go @@ -0,0 +1,53 @@ +package dnsprivatezones + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DnsPrivateZone +} + +// Get ... +func (c DnsPrivateZonesClient) Get(ctx context.Context, id DnsPrivateZoneId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model DnsPrivateZone + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/method_listbylocation.go b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/method_listbylocation.go new file mode 100644 index 00000000000..a8f06fd1edc --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/method_listbylocation.go @@ -0,0 +1,105 @@ +package dnsprivatezones + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByLocationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DnsPrivateZone +} + +type ListByLocationCompleteResult struct { + LatestHttpResponse *http.Response + Items []DnsPrivateZone +} + +type ListByLocationCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByLocationCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByLocation ... +func (c DnsPrivateZonesClient) ListByLocation(ctx context.Context, id LocationId) (result ListByLocationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByLocationCustomPager{}, + Path: fmt.Sprintf("%s/dnsPrivateZones", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]DnsPrivateZone `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByLocationComplete retrieves all the results into a single object +func (c DnsPrivateZonesClient) ListByLocationComplete(ctx context.Context, id LocationId) (ListByLocationCompleteResult, error) { + return c.ListByLocationCompleteMatchingPredicate(ctx, id, DnsPrivateZoneOperationPredicate{}) +} + +// ListByLocationCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DnsPrivateZonesClient) ListByLocationCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate DnsPrivateZoneOperationPredicate) (result ListByLocationCompleteResult, err error) { + items := make([]DnsPrivateZone, 0) + + resp, err := c.ListByLocation(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByLocationCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/model_dnsprivatezone.go b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/model_dnsprivatezone.go new file mode 100644 index 00000000000..753c8a9c469 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/model_dnsprivatezone.go @@ -0,0 +1,16 @@ +package dnsprivatezones + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnsPrivateZone struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DnsPrivateZoneProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/model_dnsprivatezoneproperties.go b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/model_dnsprivatezoneproperties.go new file mode 100644 index 00000000000..5c84986be86 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/model_dnsprivatezoneproperties.go @@ -0,0 +1,32 @@ +package dnsprivatezones + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnsPrivateZoneProperties struct { + IsProtected bool `json:"isProtected"` + LifecycleState DnsPrivateZonesLifecycleState `json:"lifecycleState"` + Ocid string `json:"ocid"` + ProvisioningState *ResourceProvisioningState `json:"provisioningState,omitempty"` + Self string `json:"self"` + Serial int64 `json:"serial"` + TimeCreated string `json:"timeCreated"` + Version string `json:"version"` + ViewId *string `json:"viewId,omitempty"` + ZoneType ZoneType `json:"zoneType"` +} + +func (o *DnsPrivateZoneProperties) GetTimeCreatedAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *DnsPrivateZoneProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = formatted +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/predicates.go b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/predicates.go new file mode 100644 index 00000000000..c135bf5afb1 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/predicates.go @@ -0,0 +1,27 @@ +package dnsprivatezones + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnsPrivateZoneOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DnsPrivateZoneOperationPredicate) Matches(input DnsPrivateZone) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/version.go b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/version.go new file mode 100644 index 00000000000..a41a74885fc --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/dnsprivatezones/version.go @@ -0,0 +1,10 @@ +package dnsprivatezones + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-09-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/dnsprivatezones/2025-09-01" +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/README.md b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/README.md new file mode 100644 index 00000000000..07e1e2d3443 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/README.md @@ -0,0 +1,134 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/exadbvmclusters` Documentation + +The `exadbvmclusters` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/exadbvmclusters" +``` + + +### Client Initialization + +```go +client := exadbvmclusters.NewExadbVMClustersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ExadbVMClustersClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := exadbvmclusters.NewExadbVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "exadbVmClusterName") + +payload := exadbvmclusters.ExadbVMCluster{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ExadbVMClustersClient.Delete` + +```go +ctx := context.TODO() +id := exadbvmclusters.NewExadbVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "exadbVmClusterName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ExadbVMClustersClient.Get` + +```go +ctx := context.TODO() +id := exadbvmclusters.NewExadbVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "exadbVmClusterName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ExadbVMClustersClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ExadbVMClustersClient.ListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ExadbVMClustersClient.RemoveVMs` + +```go +ctx := context.TODO() +id := exadbvmclusters.NewExadbVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "exadbVmClusterName") + +payload := exadbvmclusters.RemoveVirtualMachineFromExadbVMClusterDetails{ + // ... +} + + +if err := client.RemoveVMsThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ExadbVMClustersClient.Update` + +```go +ctx := context.TODO() +id := exadbvmclusters.NewExadbVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "exadbVmClusterName") + +payload := exadbvmclusters.ExadbVMClusterUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/client.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/client.go new file mode 100644 index 00000000000..f6232bdda8d --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/client.go @@ -0,0 +1,26 @@ +package exadbvmclusters + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExadbVMClustersClient struct { + Client *resourcemanager.Client +} + +func NewExadbVMClustersClientWithBaseURI(sdkApi sdkEnv.Api) (*ExadbVMClustersClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "exadbvmclusters", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ExadbVMClustersClient: %+v", err) + } + + return &ExadbVMClustersClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/constants.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/constants.go new file mode 100644 index 00000000000..f9df859bc40 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/constants.go @@ -0,0 +1,336 @@ +package exadbvmclusters + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureResourceProvisioningState string + +const ( + AzureResourceProvisioningStateCanceled AzureResourceProvisioningState = "Canceled" + AzureResourceProvisioningStateFailed AzureResourceProvisioningState = "Failed" + AzureResourceProvisioningStateProvisioning AzureResourceProvisioningState = "Provisioning" + AzureResourceProvisioningStateSucceeded AzureResourceProvisioningState = "Succeeded" +) + +func PossibleValuesForAzureResourceProvisioningState() []string { + return []string{ + string(AzureResourceProvisioningStateCanceled), + string(AzureResourceProvisioningStateFailed), + string(AzureResourceProvisioningStateProvisioning), + string(AzureResourceProvisioningStateSucceeded), + } +} + +func (s *AzureResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAzureResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAzureResourceProvisioningState(input string) (*AzureResourceProvisioningState, error) { + vals := map[string]AzureResourceProvisioningState{ + "canceled": AzureResourceProvisioningStateCanceled, + "failed": AzureResourceProvisioningStateFailed, + "provisioning": AzureResourceProvisioningStateProvisioning, + "succeeded": AzureResourceProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AzureResourceProvisioningState(input) + return &out, nil +} + +type ExadbVMClusterLifecycleState string + +const ( + ExadbVMClusterLifecycleStateAvailable ExadbVMClusterLifecycleState = "Available" + ExadbVMClusterLifecycleStateFailed ExadbVMClusterLifecycleState = "Failed" + ExadbVMClusterLifecycleStateMaintenanceInProgress ExadbVMClusterLifecycleState = "MaintenanceInProgress" + ExadbVMClusterLifecycleStateProvisioning ExadbVMClusterLifecycleState = "Provisioning" + ExadbVMClusterLifecycleStateTerminated ExadbVMClusterLifecycleState = "Terminated" + ExadbVMClusterLifecycleStateTerminating ExadbVMClusterLifecycleState = "Terminating" + ExadbVMClusterLifecycleStateUpdating ExadbVMClusterLifecycleState = "Updating" +) + +func PossibleValuesForExadbVMClusterLifecycleState() []string { + return []string{ + string(ExadbVMClusterLifecycleStateAvailable), + string(ExadbVMClusterLifecycleStateFailed), + string(ExadbVMClusterLifecycleStateMaintenanceInProgress), + string(ExadbVMClusterLifecycleStateProvisioning), + string(ExadbVMClusterLifecycleStateTerminated), + string(ExadbVMClusterLifecycleStateTerminating), + string(ExadbVMClusterLifecycleStateUpdating), + } +} + +func (s *ExadbVMClusterLifecycleState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseExadbVMClusterLifecycleState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseExadbVMClusterLifecycleState(input string) (*ExadbVMClusterLifecycleState, error) { + vals := map[string]ExadbVMClusterLifecycleState{ + "available": ExadbVMClusterLifecycleStateAvailable, + "failed": ExadbVMClusterLifecycleStateFailed, + "maintenanceinprogress": ExadbVMClusterLifecycleStateMaintenanceInProgress, + "provisioning": ExadbVMClusterLifecycleStateProvisioning, + "terminated": ExadbVMClusterLifecycleStateTerminated, + "terminating": ExadbVMClusterLifecycleStateTerminating, + "updating": ExadbVMClusterLifecycleStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExadbVMClusterLifecycleState(input) + return &out, nil +} + +type GridImageType string + +const ( + GridImageTypeCustomImage GridImageType = "CustomImage" + GridImageTypeReleaseUpdate GridImageType = "ReleaseUpdate" +) + +func PossibleValuesForGridImageType() []string { + return []string{ + string(GridImageTypeCustomImage), + string(GridImageTypeReleaseUpdate), + } +} + +func (s *GridImageType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseGridImageType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseGridImageType(input string) (*GridImageType, error) { + vals := map[string]GridImageType{ + "customimage": GridImageTypeCustomImage, + "releaseupdate": GridImageTypeReleaseUpdate, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GridImageType(input) + return &out, nil +} + +type IormLifecycleState string + +const ( + IormLifecycleStateBootStrapping IormLifecycleState = "BootStrapping" + IormLifecycleStateDisabled IormLifecycleState = "Disabled" + IormLifecycleStateEnabled IormLifecycleState = "Enabled" + IormLifecycleStateFailed IormLifecycleState = "Failed" + IormLifecycleStateUpdating IormLifecycleState = "Updating" +) + +func PossibleValuesForIormLifecycleState() []string { + return []string{ + string(IormLifecycleStateBootStrapping), + string(IormLifecycleStateDisabled), + string(IormLifecycleStateEnabled), + string(IormLifecycleStateFailed), + string(IormLifecycleStateUpdating), + } +} + +func (s *IormLifecycleState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIormLifecycleState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIormLifecycleState(input string) (*IormLifecycleState, error) { + vals := map[string]IormLifecycleState{ + "bootstrapping": IormLifecycleStateBootStrapping, + "disabled": IormLifecycleStateDisabled, + "enabled": IormLifecycleStateEnabled, + "failed": IormLifecycleStateFailed, + "updating": IormLifecycleStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IormLifecycleState(input) + return &out, nil +} + +type LicenseModel string + +const ( + LicenseModelBringYourOwnLicense LicenseModel = "BringYourOwnLicense" + LicenseModelLicenseIncluded LicenseModel = "LicenseIncluded" +) + +func PossibleValuesForLicenseModel() []string { + return []string{ + string(LicenseModelBringYourOwnLicense), + string(LicenseModelLicenseIncluded), + } +} + +func (s *LicenseModel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLicenseModel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLicenseModel(input string) (*LicenseModel, error) { + vals := map[string]LicenseModel{ + "bringyourownlicense": LicenseModelBringYourOwnLicense, + "licenseincluded": LicenseModelLicenseIncluded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LicenseModel(input) + return &out, nil +} + +type Objective string + +const ( + ObjectiveAuto Objective = "Auto" + ObjectiveBalanced Objective = "Balanced" + ObjectiveBasic Objective = "Basic" + ObjectiveHighThroughput Objective = "HighThroughput" + ObjectiveLowLatency Objective = "LowLatency" +) + +func PossibleValuesForObjective() []string { + return []string{ + string(ObjectiveAuto), + string(ObjectiveBalanced), + string(ObjectiveBasic), + string(ObjectiveHighThroughput), + string(ObjectiveLowLatency), + } +} + +func (s *Objective) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseObjective(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseObjective(input string) (*Objective, error) { + vals := map[string]Objective{ + "auto": ObjectiveAuto, + "balanced": ObjectiveBalanced, + "basic": ObjectiveBasic, + "highthroughput": ObjectiveHighThroughput, + "lowlatency": ObjectiveLowLatency, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Objective(input) + return &out, nil +} + +type ShapeAttribute string + +const ( + ShapeAttributeBLOCKSTORAGE ShapeAttribute = "BLOCK_STORAGE" + ShapeAttributeSMARTSTORAGE ShapeAttribute = "SMART_STORAGE" +) + +func PossibleValuesForShapeAttribute() []string { + return []string{ + string(ShapeAttributeBLOCKSTORAGE), + string(ShapeAttributeSMARTSTORAGE), + } +} + +func (s *ShapeAttribute) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseShapeAttribute(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseShapeAttribute(input string) (*ShapeAttribute, error) { + vals := map[string]ShapeAttribute{ + "block_storage": ShapeAttributeBLOCKSTORAGE, + "smart_storage": ShapeAttributeSMARTSTORAGE, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ShapeAttribute(input) + return &out, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/id_exadbvmcluster.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/id_exadbvmcluster.go new file mode 100644 index 00000000000..2e9ef1c55e0 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/id_exadbvmcluster.go @@ -0,0 +1,130 @@ +package exadbvmclusters + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&ExadbVMClusterId{}) +} + +var _ resourceids.ResourceId = &ExadbVMClusterId{} + +// ExadbVMClusterId is a struct representing the Resource ID for a Exadb VM Cluster +type ExadbVMClusterId struct { + SubscriptionId string + ResourceGroupName string + ExadbVmClusterName string +} + +// NewExadbVMClusterID returns a new ExadbVMClusterId struct +func NewExadbVMClusterID(subscriptionId string, resourceGroupName string, exadbVmClusterName string) ExadbVMClusterId { + return ExadbVMClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ExadbVmClusterName: exadbVmClusterName, + } +} + +// ParseExadbVMClusterID parses 'input' into a ExadbVMClusterId +func ParseExadbVMClusterID(input string) (*ExadbVMClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(&ExadbVMClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ExadbVMClusterId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseExadbVMClusterIDInsensitively parses 'input' case-insensitively into a ExadbVMClusterId +// note: this method should only be used for API response data and not user input +func ParseExadbVMClusterIDInsensitively(input string) (*ExadbVMClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(&ExadbVMClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ExadbVMClusterId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExadbVMClusterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.ExadbVmClusterName, ok = input.Parsed["exadbVmClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "exadbVmClusterName", input) + } + + return nil +} + +// ValidateExadbVMClusterID checks that 'input' can be parsed as a Exadb VM Cluster ID +func ValidateExadbVMClusterID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseExadbVMClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Exadb VM Cluster ID +func (id ExadbVMClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Oracle.Database/exadbVmClusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ExadbVmClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Exadb VM Cluster ID +func (id ExadbVMClusterId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticExadbVmClusters", "exadbVmClusters", "exadbVmClusters"), + resourceids.UserSpecifiedSegment("exadbVmClusterName", "exadbVmClusterName"), + } +} + +// String returns a human-readable description of this Exadb VM Cluster ID +func (id ExadbVMClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Exadb Vm Cluster Name: %q", id.ExadbVmClusterName), + } + return fmt.Sprintf("Exadb VM Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/id_exadbvmcluster_test.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/id_exadbvmcluster_test.go new file mode 100644 index 00000000000..02820a4b8ea --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/id_exadbvmcluster_test.go @@ -0,0 +1,282 @@ +package exadbvmclusters + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ExadbVMClusterId{} + +func TestNewExadbVMClusterID(t *testing.T) { + id := NewExadbVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "exadbVmClusterName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.ExadbVmClusterName != "exadbVmClusterName" { + t.Fatalf("Expected %q but got %q for Segment 'ExadbVmClusterName'", id.ExadbVmClusterName, "exadbVmClusterName") + } +} + +func TestFormatExadbVMClusterID(t *testing.T) { + actual := NewExadbVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "exadbVmClusterName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters/exadbVmClusterName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseExadbVMClusterID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ExadbVMClusterId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters/exadbVmClusterName", + Expected: &ExadbVMClusterId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ExadbVmClusterName: "exadbVmClusterName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters/exadbVmClusterName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseExadbVMClusterID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.ExadbVmClusterName != v.Expected.ExadbVmClusterName { + t.Fatalf("Expected %q but got %q for ExadbVmClusterName", v.Expected.ExadbVmClusterName, actual.ExadbVmClusterName) + } + + } +} + +func TestParseExadbVMClusterIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ExadbVMClusterId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/eXaDbVmClUsTeRs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters/exadbVmClusterName", + Expected: &ExadbVMClusterId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ExadbVmClusterName: "exadbVmClusterName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters/exadbVmClusterName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/eXaDbVmClUsTeRs/eXaDbVmClUsTeRnAmE", + Expected: &ExadbVMClusterId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + ExadbVmClusterName: "eXaDbVmClUsTeRnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/eXaDbVmClUsTeRs/eXaDbVmClUsTeRnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseExadbVMClusterIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.ExadbVmClusterName != v.Expected.ExadbVmClusterName { + t.Fatalf("Expected %q but got %q for ExadbVmClusterName", v.Expected.ExadbVmClusterName, actual.ExadbVmClusterName) + } + + } +} + +func TestSegmentsForExadbVMClusterId(t *testing.T) { + segments := ExadbVMClusterId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ExadbVMClusterId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_createorupdate.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_createorupdate.go new file mode 100644 index 00000000000..85109adf3fa --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_createorupdate.go @@ -0,0 +1,75 @@ +package exadbvmclusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ExadbVMCluster +} + +// CreateOrUpdate ... +func (c ExadbVMClustersClient) CreateOrUpdate(ctx context.Context, id ExadbVMClusterId, input ExadbVMCluster) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ExadbVMClustersClient) CreateOrUpdateThenPoll(ctx context.Context, id ExadbVMClusterId, input ExadbVMCluster) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_delete.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_delete.go new file mode 100644 index 00000000000..215f82c5a9a --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_delete.go @@ -0,0 +1,70 @@ +package exadbvmclusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c ExadbVMClustersClient) Delete(ctx context.Context, id ExadbVMClusterId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ExadbVMClustersClient) DeleteThenPoll(ctx context.Context, id ExadbVMClusterId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_get.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_get.go new file mode 100644 index 00000000000..f1ede954ea8 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_get.go @@ -0,0 +1,53 @@ +package exadbvmclusters + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ExadbVMCluster +} + +// Get ... +func (c ExadbVMClustersClient) Get(ctx context.Context, id ExadbVMClusterId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ExadbVMCluster + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_listbyresourcegroup.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_listbyresourcegroup.go new file mode 100644 index 00000000000..90a3552020e --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package exadbvmclusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ExadbVMCluster +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []ExadbVMCluster +} + +type ListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByResourceGroup ... +func (c ExadbVMClustersClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Oracle.Database/exadbVmClusters", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ExadbVMCluster `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c ExadbVMClustersClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ExadbVMClusterOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ExadbVMClustersClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ExadbVMClusterOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]ExadbVMCluster, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_listbysubscription.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_listbysubscription.go new file mode 100644 index 00000000000..89593ce40ec --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_listbysubscription.go @@ -0,0 +1,106 @@ +package exadbvmclusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ExadbVMCluster +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []ExadbVMCluster +} + +type ListBySubscriptionCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListBySubscriptionCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListBySubscription ... +func (c ExadbVMClustersClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Oracle.Database/exadbVmClusters", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ExadbVMCluster `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c ExadbVMClustersClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, ExadbVMClusterOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ExadbVMClustersClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ExadbVMClusterOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]ExadbVMCluster, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_removevms.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_removevms.go new file mode 100644 index 00000000000..dcbad8b6ec0 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_removevms.go @@ -0,0 +1,75 @@ +package exadbvmclusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemoveVMsOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ExadbVMCluster +} + +// RemoveVMs ... +func (c ExadbVMClustersClient) RemoveVMs(ctx context.Context, id ExadbVMClusterId, input RemoveVirtualMachineFromExadbVMClusterDetails) (result RemoveVMsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/removeVms", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// RemoveVMsThenPoll performs RemoveVMs then polls until it's completed +func (c ExadbVMClustersClient) RemoveVMsThenPoll(ctx context.Context, id ExadbVMClusterId, input RemoveVirtualMachineFromExadbVMClusterDetails) error { + result, err := c.RemoveVMs(ctx, id, input) + if err != nil { + return fmt.Errorf("performing RemoveVMs: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RemoveVMs: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_update.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_update.go new file mode 100644 index 00000000000..a96f0892e04 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/method_update.go @@ -0,0 +1,75 @@ +package exadbvmclusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ExadbVMCluster +} + +// Update ... +func (c ExadbVMClustersClient) Update(ctx context.Context, id ExadbVMClusterId, input ExadbVMClusterUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ExadbVMClustersClient) UpdateThenPoll(ctx context.Context, id ExadbVMClusterId, input ExadbVMClusterUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_datacollectionoptions.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_datacollectionoptions.go new file mode 100644 index 00000000000..43729b597f0 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_datacollectionoptions.go @@ -0,0 +1,10 @@ +package exadbvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataCollectionOptions struct { + IsDiagnosticsEventsEnabled *bool `json:"isDiagnosticsEventsEnabled,omitempty"` + IsHealthMonitoringEnabled *bool `json:"isHealthMonitoringEnabled,omitempty"` + IsIncidentLogsEnabled *bool `json:"isIncidentLogsEnabled,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_dbiormconfig.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_dbiormconfig.go new file mode 100644 index 00000000000..afc0bd400b4 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_dbiormconfig.go @@ -0,0 +1,10 @@ +package exadbvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbIormConfig struct { + DbName *string `json:"dbName,omitempty"` + FlashCacheLimit *string `json:"flashCacheLimit,omitempty"` + Share *int64 `json:"share,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_dbnodedetails.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_dbnodedetails.go new file mode 100644 index 00000000000..3eb98163872 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_dbnodedetails.go @@ -0,0 +1,8 @@ +package exadbvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbNodeDetails struct { + DbNodeId string `json:"dbNodeId"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadataiormconfig.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadataiormconfig.go new file mode 100644 index 00000000000..f4c7edf8208 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadataiormconfig.go @@ -0,0 +1,11 @@ +package exadbvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExadataIormConfig struct { + DbPlans *[]DbIormConfig `json:"dbPlans,omitempty"` + LifecycleDetails *string `json:"lifecycleDetails,omitempty"` + LifecycleState *IormLifecycleState `json:"lifecycleState,omitempty"` + Objective *Objective `json:"objective,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadbvmcluster.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadbvmcluster.go new file mode 100644 index 00000000000..f05f44d45f0 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadbvmcluster.go @@ -0,0 +1,20 @@ +package exadbvmclusters + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExadbVMCluster struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ExadbVMClusterProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadbvmclusterproperties.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadbvmclusterproperties.go new file mode 100644 index 00000000000..6f97e03319b --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadbvmclusterproperties.go @@ -0,0 +1,51 @@ +package exadbvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExadbVMClusterProperties struct { + BackupSubnetCidr *string `json:"backupSubnetCidr,omitempty"` + BackupSubnetOcid *string `json:"backupSubnetOcid,omitempty"` + ClusterName *string `json:"clusterName,omitempty"` + DataCollectionOptions *DataCollectionOptions `json:"dataCollectionOptions,omitempty"` + DisplayName string `json:"displayName"` + Domain *string `json:"domain,omitempty"` + EnabledEcpuCount int64 `json:"enabledEcpuCount"` + ExascaleDbStorageVaultId string `json:"exascaleDbStorageVaultId"` + GiVersion *string `json:"giVersion,omitempty"` + GridImageOcid *string `json:"gridImageOcid,omitempty"` + GridImageType *GridImageType `json:"gridImageType,omitempty"` + Hostname string `json:"hostname"` + IormConfigCache *ExadataIormConfig `json:"iormConfigCache,omitempty"` + LicenseModel *LicenseModel `json:"licenseModel,omitempty"` + LifecycleDetails *string `json:"lifecycleDetails,omitempty"` + LifecycleState *ExadbVMClusterLifecycleState `json:"lifecycleState,omitempty"` + ListenerPort *int64 `json:"listenerPort,omitempty"` + MemorySizeInGbs *int64 `json:"memorySizeInGbs,omitempty"` + NodeCount int64 `json:"nodeCount"` + NsgCidrs *[]NsgCidr `json:"nsgCidrs,omitempty"` + NsgURL *string `json:"nsgUrl,omitempty"` + OciURL *string `json:"ociUrl,omitempty"` + Ocid *string `json:"ocid,omitempty"` + PrivateZoneOcid *string `json:"privateZoneOcid,omitempty"` + ProvisioningState *AzureResourceProvisioningState `json:"provisioningState,omitempty"` + ScanDnsName *string `json:"scanDnsName,omitempty"` + ScanDnsRecordId *string `json:"scanDnsRecordId,omitempty"` + ScanIPIds *[]string `json:"scanIpIds,omitempty"` + ScanListenerPortTcp *int64 `json:"scanListenerPortTcp,omitempty"` + ScanListenerPortTcpSsl *int64 `json:"scanListenerPortTcpSsl,omitempty"` + Shape string `json:"shape"` + ShapeAttribute *ShapeAttribute `json:"shapeAttribute,omitempty"` + SnapshotFileSystemStorage *ExadbVMClusterStorageDetails `json:"snapshotFileSystemStorage,omitempty"` + SshPublicKeys []string `json:"sshPublicKeys"` + SubnetId string `json:"subnetId"` + SubnetOcid *string `json:"subnetOcid,omitempty"` + SystemVersion *string `json:"systemVersion,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + TotalEcpuCount int64 `json:"totalEcpuCount"` + TotalFileSystemStorage *ExadbVMClusterStorageDetails `json:"totalFileSystemStorage,omitempty"` + VMFileSystemStorage ExadbVMClusterStorageDetails `json:"vmFileSystemStorage"` + VipIds *[]string `json:"vipIds,omitempty"` + VnetId string `json:"vnetId"` + ZoneOcid *string `json:"zoneOcid,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadbvmclusterstoragedetails.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadbvmclusterstoragedetails.go new file mode 100644 index 00000000000..9eb416f3747 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadbvmclusterstoragedetails.go @@ -0,0 +1,8 @@ +package exadbvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExadbVMClusterStorageDetails struct { + TotalSizeInGbs int64 `json:"totalSizeInGbs"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadbvmclusterupdate.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadbvmclusterupdate.go new file mode 100644 index 00000000000..32736cce6d8 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadbvmclusterupdate.go @@ -0,0 +1,14 @@ +package exadbvmclusters + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExadbVMClusterUpdate struct { + Properties *ExadbVMClusterUpdateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadbvmclusterupdateproperties.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadbvmclusterupdateproperties.go new file mode 100644 index 00000000000..4bf07a53354 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_exadbvmclusterupdateproperties.go @@ -0,0 +1,8 @@ +package exadbvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExadbVMClusterUpdateProperties struct { + NodeCount *int64 `json:"nodeCount,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_nsgcidr.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_nsgcidr.go new file mode 100644 index 00000000000..2d908146d6e --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_nsgcidr.go @@ -0,0 +1,9 @@ +package exadbvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NsgCidr struct { + DestinationPortRange *PortRange `json:"destinationPortRange,omitempty"` + Source string `json:"source"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_portrange.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_portrange.go new file mode 100644 index 00000000000..932a27e3d2f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_portrange.go @@ -0,0 +1,9 @@ +package exadbvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PortRange struct { + Max int64 `json:"max"` + Min int64 `json:"min"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_removevirtualmachinefromexadbvmclusterdetails.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_removevirtualmachinefromexadbvmclusterdetails.go new file mode 100644 index 00000000000..7a4955d9f80 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/model_removevirtualmachinefromexadbvmclusterdetails.go @@ -0,0 +1,8 @@ +package exadbvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemoveVirtualMachineFromExadbVMClusterDetails struct { + DbNodes []DbNodeDetails `json:"dbNodes"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/predicates.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/predicates.go new file mode 100644 index 00000000000..3722f90302e --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/predicates.go @@ -0,0 +1,32 @@ +package exadbvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExadbVMClusterOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ExadbVMClusterOperationPredicate) Matches(input ExadbVMCluster) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/version.go b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/version.go new file mode 100644 index 00000000000..760a2a9267a --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exadbvmclusters/version.go @@ -0,0 +1,10 @@ +package exadbvmclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-09-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/exadbvmclusters/2025-09-01" +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/README.md b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/README.md new file mode 100644 index 00000000000..fcd5f344a7f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/README.md @@ -0,0 +1,70 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/exascaledbnodes` Documentation + +The `exascaledbnodes` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/exascaledbnodes" +``` + + +### Client Initialization + +```go +client := exascaledbnodes.NewExascaleDbNodesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ExascaleDbNodesClient.Action` + +```go +ctx := context.TODO() +id := exascaledbnodes.NewExadbVMClusterDbNodeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "exadbVmClusterName", "dbNodeName") + +payload := exascaledbnodes.DbNodeAction{ + // ... +} + + +if err := client.ActionThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ExascaleDbNodesClient.Get` + +```go +ctx := context.TODO() +id := exascaledbnodes.NewExadbVMClusterDbNodeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "exadbVmClusterName", "dbNodeName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ExascaleDbNodesClient.ListByParent` + +```go +ctx := context.TODO() +id := exascaledbnodes.NewExadbVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "exadbVmClusterName") + +// alternatively `client.ListByParent(ctx, id)` can be used to do batched pagination +items, err := client.ListByParentComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/client.go b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/client.go new file mode 100644 index 00000000000..9ee82734a41 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/client.go @@ -0,0 +1,26 @@ +package exascaledbnodes + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExascaleDbNodesClient struct { + Client *resourcemanager.Client +} + +func NewExascaleDbNodesClientWithBaseURI(sdkApi sdkEnv.Api) (*ExascaleDbNodesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "exascaledbnodes", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ExascaleDbNodesClient: %+v", err) + } + + return &ExascaleDbNodesClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/constants.go b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/constants.go new file mode 100644 index 00000000000..5f551903e50 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/constants.go @@ -0,0 +1,166 @@ +package exascaledbnodes + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureResourceProvisioningState string + +const ( + AzureResourceProvisioningStateCanceled AzureResourceProvisioningState = "Canceled" + AzureResourceProvisioningStateFailed AzureResourceProvisioningState = "Failed" + AzureResourceProvisioningStateProvisioning AzureResourceProvisioningState = "Provisioning" + AzureResourceProvisioningStateSucceeded AzureResourceProvisioningState = "Succeeded" +) + +func PossibleValuesForAzureResourceProvisioningState() []string { + return []string{ + string(AzureResourceProvisioningStateCanceled), + string(AzureResourceProvisioningStateFailed), + string(AzureResourceProvisioningStateProvisioning), + string(AzureResourceProvisioningStateSucceeded), + } +} + +func (s *AzureResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAzureResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAzureResourceProvisioningState(input string) (*AzureResourceProvisioningState, error) { + vals := map[string]AzureResourceProvisioningState{ + "canceled": AzureResourceProvisioningStateCanceled, + "failed": AzureResourceProvisioningStateFailed, + "provisioning": AzureResourceProvisioningStateProvisioning, + "succeeded": AzureResourceProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AzureResourceProvisioningState(input) + return &out, nil +} + +type DbNodeActionEnum string + +const ( + DbNodeActionEnumReset DbNodeActionEnum = "Reset" + DbNodeActionEnumSoftReset DbNodeActionEnum = "SoftReset" + DbNodeActionEnumStart DbNodeActionEnum = "Start" + DbNodeActionEnumStop DbNodeActionEnum = "Stop" +) + +func PossibleValuesForDbNodeActionEnum() []string { + return []string{ + string(DbNodeActionEnumReset), + string(DbNodeActionEnumSoftReset), + string(DbNodeActionEnumStart), + string(DbNodeActionEnumStop), + } +} + +func (s *DbNodeActionEnum) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDbNodeActionEnum(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDbNodeActionEnum(input string) (*DbNodeActionEnum, error) { + vals := map[string]DbNodeActionEnum{ + "reset": DbNodeActionEnumReset, + "softreset": DbNodeActionEnumSoftReset, + "start": DbNodeActionEnumStart, + "stop": DbNodeActionEnumStop, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DbNodeActionEnum(input) + return &out, nil +} + +type DbNodeProvisioningState string + +const ( + DbNodeProvisioningStateAvailable DbNodeProvisioningState = "Available" + DbNodeProvisioningStateFailed DbNodeProvisioningState = "Failed" + DbNodeProvisioningStateProvisioning DbNodeProvisioningState = "Provisioning" + DbNodeProvisioningStateStarting DbNodeProvisioningState = "Starting" + DbNodeProvisioningStateStopped DbNodeProvisioningState = "Stopped" + DbNodeProvisioningStateStopping DbNodeProvisioningState = "Stopping" + DbNodeProvisioningStateTerminated DbNodeProvisioningState = "Terminated" + DbNodeProvisioningStateTerminating DbNodeProvisioningState = "Terminating" + DbNodeProvisioningStateUpdating DbNodeProvisioningState = "Updating" +) + +func PossibleValuesForDbNodeProvisioningState() []string { + return []string{ + string(DbNodeProvisioningStateAvailable), + string(DbNodeProvisioningStateFailed), + string(DbNodeProvisioningStateProvisioning), + string(DbNodeProvisioningStateStarting), + string(DbNodeProvisioningStateStopped), + string(DbNodeProvisioningStateStopping), + string(DbNodeProvisioningStateTerminated), + string(DbNodeProvisioningStateTerminating), + string(DbNodeProvisioningStateUpdating), + } +} + +func (s *DbNodeProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDbNodeProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDbNodeProvisioningState(input string) (*DbNodeProvisioningState, error) { + vals := map[string]DbNodeProvisioningState{ + "available": DbNodeProvisioningStateAvailable, + "failed": DbNodeProvisioningStateFailed, + "provisioning": DbNodeProvisioningStateProvisioning, + "starting": DbNodeProvisioningStateStarting, + "stopped": DbNodeProvisioningStateStopped, + "stopping": DbNodeProvisioningStateStopping, + "terminated": DbNodeProvisioningStateTerminated, + "terminating": DbNodeProvisioningStateTerminating, + "updating": DbNodeProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DbNodeProvisioningState(input) + return &out, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/id_exadbvmcluster.go b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/id_exadbvmcluster.go new file mode 100644 index 00000000000..4181c57e732 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/id_exadbvmcluster.go @@ -0,0 +1,130 @@ +package exascaledbnodes + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&ExadbVMClusterId{}) +} + +var _ resourceids.ResourceId = &ExadbVMClusterId{} + +// ExadbVMClusterId is a struct representing the Resource ID for a Exadb VM Cluster +type ExadbVMClusterId struct { + SubscriptionId string + ResourceGroupName string + ExadbVmClusterName string +} + +// NewExadbVMClusterID returns a new ExadbVMClusterId struct +func NewExadbVMClusterID(subscriptionId string, resourceGroupName string, exadbVmClusterName string) ExadbVMClusterId { + return ExadbVMClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ExadbVmClusterName: exadbVmClusterName, + } +} + +// ParseExadbVMClusterID parses 'input' into a ExadbVMClusterId +func ParseExadbVMClusterID(input string) (*ExadbVMClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(&ExadbVMClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ExadbVMClusterId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseExadbVMClusterIDInsensitively parses 'input' case-insensitively into a ExadbVMClusterId +// note: this method should only be used for API response data and not user input +func ParseExadbVMClusterIDInsensitively(input string) (*ExadbVMClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(&ExadbVMClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ExadbVMClusterId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExadbVMClusterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.ExadbVmClusterName, ok = input.Parsed["exadbVmClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "exadbVmClusterName", input) + } + + return nil +} + +// ValidateExadbVMClusterID checks that 'input' can be parsed as a Exadb VM Cluster ID +func ValidateExadbVMClusterID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseExadbVMClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Exadb VM Cluster ID +func (id ExadbVMClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Oracle.Database/exadbVmClusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ExadbVmClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Exadb VM Cluster ID +func (id ExadbVMClusterId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticExadbVmClusters", "exadbVmClusters", "exadbVmClusters"), + resourceids.UserSpecifiedSegment("exadbVmClusterName", "exadbVmClusterName"), + } +} + +// String returns a human-readable description of this Exadb VM Cluster ID +func (id ExadbVMClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Exadb Vm Cluster Name: %q", id.ExadbVmClusterName), + } + return fmt.Sprintf("Exadb VM Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/id_exadbvmcluster_test.go b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/id_exadbvmcluster_test.go new file mode 100644 index 00000000000..8e6449e5dab --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/id_exadbvmcluster_test.go @@ -0,0 +1,282 @@ +package exascaledbnodes + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ExadbVMClusterId{} + +func TestNewExadbVMClusterID(t *testing.T) { + id := NewExadbVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "exadbVmClusterName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.ExadbVmClusterName != "exadbVmClusterName" { + t.Fatalf("Expected %q but got %q for Segment 'ExadbVmClusterName'", id.ExadbVmClusterName, "exadbVmClusterName") + } +} + +func TestFormatExadbVMClusterID(t *testing.T) { + actual := NewExadbVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "exadbVmClusterName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters/exadbVmClusterName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseExadbVMClusterID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ExadbVMClusterId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters/exadbVmClusterName", + Expected: &ExadbVMClusterId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ExadbVmClusterName: "exadbVmClusterName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters/exadbVmClusterName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseExadbVMClusterID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.ExadbVmClusterName != v.Expected.ExadbVmClusterName { + t.Fatalf("Expected %q but got %q for ExadbVmClusterName", v.Expected.ExadbVmClusterName, actual.ExadbVmClusterName) + } + + } +} + +func TestParseExadbVMClusterIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ExadbVMClusterId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/eXaDbVmClUsTeRs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters/exadbVmClusterName", + Expected: &ExadbVMClusterId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ExadbVmClusterName: "exadbVmClusterName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters/exadbVmClusterName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/eXaDbVmClUsTeRs/eXaDbVmClUsTeRnAmE", + Expected: &ExadbVMClusterId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + ExadbVmClusterName: "eXaDbVmClUsTeRnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/eXaDbVmClUsTeRs/eXaDbVmClUsTeRnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseExadbVMClusterIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.ExadbVmClusterName != v.Expected.ExadbVmClusterName { + t.Fatalf("Expected %q but got %q for ExadbVmClusterName", v.Expected.ExadbVmClusterName, actual.ExadbVmClusterName) + } + + } +} + +func TestSegmentsForExadbVMClusterId(t *testing.T) { + segments := ExadbVMClusterId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ExadbVMClusterId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/id_exadbvmclusterdbnode.go b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/id_exadbvmclusterdbnode.go new file mode 100644 index 00000000000..5805db59a18 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/id_exadbvmclusterdbnode.go @@ -0,0 +1,139 @@ +package exascaledbnodes + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&ExadbVMClusterDbNodeId{}) +} + +var _ resourceids.ResourceId = &ExadbVMClusterDbNodeId{} + +// ExadbVMClusterDbNodeId is a struct representing the Resource ID for a Exadb VM Cluster Db Node +type ExadbVMClusterDbNodeId struct { + SubscriptionId string + ResourceGroupName string + ExadbVmClusterName string + DbNodeName string +} + +// NewExadbVMClusterDbNodeID returns a new ExadbVMClusterDbNodeId struct +func NewExadbVMClusterDbNodeID(subscriptionId string, resourceGroupName string, exadbVmClusterName string, dbNodeName string) ExadbVMClusterDbNodeId { + return ExadbVMClusterDbNodeId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ExadbVmClusterName: exadbVmClusterName, + DbNodeName: dbNodeName, + } +} + +// ParseExadbVMClusterDbNodeID parses 'input' into a ExadbVMClusterDbNodeId +func ParseExadbVMClusterDbNodeID(input string) (*ExadbVMClusterDbNodeId, error) { + parser := resourceids.NewParserFromResourceIdType(&ExadbVMClusterDbNodeId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ExadbVMClusterDbNodeId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseExadbVMClusterDbNodeIDInsensitively parses 'input' case-insensitively into a ExadbVMClusterDbNodeId +// note: this method should only be used for API response data and not user input +func ParseExadbVMClusterDbNodeIDInsensitively(input string) (*ExadbVMClusterDbNodeId, error) { + parser := resourceids.NewParserFromResourceIdType(&ExadbVMClusterDbNodeId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ExadbVMClusterDbNodeId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExadbVMClusterDbNodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.ExadbVmClusterName, ok = input.Parsed["exadbVmClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "exadbVmClusterName", input) + } + + if id.DbNodeName, ok = input.Parsed["dbNodeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dbNodeName", input) + } + + return nil +} + +// ValidateExadbVMClusterDbNodeID checks that 'input' can be parsed as a Exadb VM Cluster Db Node ID +func ValidateExadbVMClusterDbNodeID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseExadbVMClusterDbNodeID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Exadb VM Cluster Db Node ID +func (id ExadbVMClusterDbNodeId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Oracle.Database/exadbVmClusters/%s/dbNodes/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ExadbVmClusterName, id.DbNodeName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Exadb VM Cluster Db Node ID +func (id ExadbVMClusterDbNodeId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticExadbVmClusters", "exadbVmClusters", "exadbVmClusters"), + resourceids.UserSpecifiedSegment("exadbVmClusterName", "exadbVmClusterName"), + resourceids.StaticSegment("staticDbNodes", "dbNodes", "dbNodes"), + resourceids.UserSpecifiedSegment("dbNodeName", "dbNodeName"), + } +} + +// String returns a human-readable description of this Exadb VM Cluster Db Node ID +func (id ExadbVMClusterDbNodeId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Exadb Vm Cluster Name: %q", id.ExadbVmClusterName), + fmt.Sprintf("Db Node Name: %q", id.DbNodeName), + } + return fmt.Sprintf("Exadb VM Cluster Db Node (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/id_exadbvmclusterdbnode_test.go b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/id_exadbvmclusterdbnode_test.go new file mode 100644 index 00000000000..b94dbdc24a0 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/id_exadbvmclusterdbnode_test.go @@ -0,0 +1,327 @@ +package exascaledbnodes + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ExadbVMClusterDbNodeId{} + +func TestNewExadbVMClusterDbNodeID(t *testing.T) { + id := NewExadbVMClusterDbNodeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "exadbVmClusterName", "dbNodeName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.ExadbVmClusterName != "exadbVmClusterName" { + t.Fatalf("Expected %q but got %q for Segment 'ExadbVmClusterName'", id.ExadbVmClusterName, "exadbVmClusterName") + } + + if id.DbNodeName != "dbNodeName" { + t.Fatalf("Expected %q but got %q for Segment 'DbNodeName'", id.DbNodeName, "dbNodeName") + } +} + +func TestFormatExadbVMClusterDbNodeID(t *testing.T) { + actual := NewExadbVMClusterDbNodeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "exadbVmClusterName", "dbNodeName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters/exadbVmClusterName/dbNodes/dbNodeName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseExadbVMClusterDbNodeID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ExadbVMClusterDbNodeId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters/exadbVmClusterName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters/exadbVmClusterName/dbNodes", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters/exadbVmClusterName/dbNodes/dbNodeName", + Expected: &ExadbVMClusterDbNodeId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ExadbVmClusterName: "exadbVmClusterName", + DbNodeName: "dbNodeName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters/exadbVmClusterName/dbNodes/dbNodeName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseExadbVMClusterDbNodeID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.ExadbVmClusterName != v.Expected.ExadbVmClusterName { + t.Fatalf("Expected %q but got %q for ExadbVmClusterName", v.Expected.ExadbVmClusterName, actual.ExadbVmClusterName) + } + + if actual.DbNodeName != v.Expected.DbNodeName { + t.Fatalf("Expected %q but got %q for DbNodeName", v.Expected.DbNodeName, actual.DbNodeName) + } + + } +} + +func TestParseExadbVMClusterDbNodeIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ExadbVMClusterDbNodeId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/eXaDbVmClUsTeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters/exadbVmClusterName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/eXaDbVmClUsTeRs/eXaDbVmClUsTeRnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters/exadbVmClusterName/dbNodes", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/eXaDbVmClUsTeRs/eXaDbVmClUsTeRnAmE/dBnOdEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters/exadbVmClusterName/dbNodes/dbNodeName", + Expected: &ExadbVMClusterDbNodeId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ExadbVmClusterName: "exadbVmClusterName", + DbNodeName: "dbNodeName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exadbVmClusters/exadbVmClusterName/dbNodes/dbNodeName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/eXaDbVmClUsTeRs/eXaDbVmClUsTeRnAmE/dBnOdEs/dBnOdEnAmE", + Expected: &ExadbVMClusterDbNodeId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + ExadbVmClusterName: "eXaDbVmClUsTeRnAmE", + DbNodeName: "dBnOdEnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/eXaDbVmClUsTeRs/eXaDbVmClUsTeRnAmE/dBnOdEs/dBnOdEnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseExadbVMClusterDbNodeIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.ExadbVmClusterName != v.Expected.ExadbVmClusterName { + t.Fatalf("Expected %q but got %q for ExadbVmClusterName", v.Expected.ExadbVmClusterName, actual.ExadbVmClusterName) + } + + if actual.DbNodeName != v.Expected.DbNodeName { + t.Fatalf("Expected %q but got %q for DbNodeName", v.Expected.DbNodeName, actual.DbNodeName) + } + + } +} + +func TestSegmentsForExadbVMClusterDbNodeId(t *testing.T) { + segments := ExadbVMClusterDbNodeId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ExadbVMClusterDbNodeId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/method_action.go b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/method_action.go new file mode 100644 index 00000000000..44eda57d5c7 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/method_action.go @@ -0,0 +1,75 @@ +package exascaledbnodes + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ActionOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *DbActionResponse +} + +// Action ... +func (c ExascaleDbNodesClient) Action(ctx context.Context, id ExadbVMClusterDbNodeId, input DbNodeAction) (result ActionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/action", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ActionThenPoll performs Action then polls until it's completed +func (c ExascaleDbNodesClient) ActionThenPoll(ctx context.Context, id ExadbVMClusterDbNodeId, input DbNodeAction) error { + result, err := c.Action(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Action: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Action: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/method_get.go b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/method_get.go new file mode 100644 index 00000000000..5ea70b981f6 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/method_get.go @@ -0,0 +1,53 @@ +package exascaledbnodes + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ExascaleDbNode +} + +// Get ... +func (c ExascaleDbNodesClient) Get(ctx context.Context, id ExadbVMClusterDbNodeId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ExascaleDbNode + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/method_listbyparent.go b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/method_listbyparent.go new file mode 100644 index 00000000000..32ece600561 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/method_listbyparent.go @@ -0,0 +1,105 @@ +package exascaledbnodes + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByParentOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ExascaleDbNode +} + +type ListByParentCompleteResult struct { + LatestHttpResponse *http.Response + Items []ExascaleDbNode +} + +type ListByParentCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByParentCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByParent ... +func (c ExascaleDbNodesClient) ListByParent(ctx context.Context, id ExadbVMClusterId) (result ListByParentOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByParentCustomPager{}, + Path: fmt.Sprintf("%s/dbNodes", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ExascaleDbNode `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByParentComplete retrieves all the results into a single object +func (c ExascaleDbNodesClient) ListByParentComplete(ctx context.Context, id ExadbVMClusterId) (ListByParentCompleteResult, error) { + return c.ListByParentCompleteMatchingPredicate(ctx, id, ExascaleDbNodeOperationPredicate{}) +} + +// ListByParentCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ExascaleDbNodesClient) ListByParentCompleteMatchingPredicate(ctx context.Context, id ExadbVMClusterId, predicate ExascaleDbNodeOperationPredicate) (result ListByParentCompleteResult, err error) { + items := make([]ExascaleDbNode, 0) + + resp, err := c.ListByParent(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByParentCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/model_dbactionresponse.go b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/model_dbactionresponse.go new file mode 100644 index 00000000000..d4d222e7cbe --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/model_dbactionresponse.go @@ -0,0 +1,8 @@ +package exascaledbnodes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbActionResponse struct { + ProvisioningState *AzureResourceProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/model_dbnodeaction.go b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/model_dbnodeaction.go new file mode 100644 index 00000000000..6b4b107d545 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/model_dbnodeaction.go @@ -0,0 +1,8 @@ +package exascaledbnodes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DbNodeAction struct { + Action DbNodeActionEnum `json:"action"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/model_exascaledbnode.go b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/model_exascaledbnode.go new file mode 100644 index 00000000000..25940582a4f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/model_exascaledbnode.go @@ -0,0 +1,16 @@ +package exascaledbnodes + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExascaleDbNode struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ExascaleDbNodeProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/model_exascaledbnodeproperties.go b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/model_exascaledbnodeproperties.go new file mode 100644 index 00000000000..a14efc9aec9 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/model_exascaledbnodeproperties.go @@ -0,0 +1,50 @@ +package exascaledbnodes + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExascaleDbNodeProperties struct { + AdditionalDetails *string `json:"additionalDetails,omitempty"` + CpuCoreCount *int64 `json:"cpuCoreCount,omitempty"` + DbNodeStorageSizeInGbs *int64 `json:"dbNodeStorageSizeInGbs,omitempty"` + FaultDomain *string `json:"faultDomain,omitempty"` + Hostname *string `json:"hostname,omitempty"` + LifecycleState *DbNodeProvisioningState `json:"lifecycleState,omitempty"` + MaintenanceType *string `json:"maintenanceType,omitempty"` + MemorySizeInGbs *int64 `json:"memorySizeInGbs,omitempty"` + Ocid string `json:"ocid"` + SoftwareStorageSizeInGb *int64 `json:"softwareStorageSizeInGb,omitempty"` + TimeMaintenanceWindowEnd *string `json:"timeMaintenanceWindowEnd,omitempty"` + TimeMaintenanceWindowStart *string `json:"timeMaintenanceWindowStart,omitempty"` + TotalCPUCoreCount *int64 `json:"totalCpuCoreCount,omitempty"` +} + +func (o *ExascaleDbNodeProperties) GetTimeMaintenanceWindowEndAsTime() (*time.Time, error) { + if o.TimeMaintenanceWindowEnd == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeMaintenanceWindowEnd, "2006-01-02T15:04:05Z07:00") +} + +func (o *ExascaleDbNodeProperties) SetTimeMaintenanceWindowEndAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeMaintenanceWindowEnd = &formatted +} + +func (o *ExascaleDbNodeProperties) GetTimeMaintenanceWindowStartAsTime() (*time.Time, error) { + if o.TimeMaintenanceWindowStart == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeMaintenanceWindowStart, "2006-01-02T15:04:05Z07:00") +} + +func (o *ExascaleDbNodeProperties) SetTimeMaintenanceWindowStartAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeMaintenanceWindowStart = &formatted +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/predicates.go b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/predicates.go new file mode 100644 index 00000000000..cc7b16ac411 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/predicates.go @@ -0,0 +1,27 @@ +package exascaledbnodes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExascaleDbNodeOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ExascaleDbNodeOperationPredicate) Matches(input ExascaleDbNode) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/version.go b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/version.go new file mode 100644 index 00000000000..62a4f3551d5 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbnodes/version.go @@ -0,0 +1,10 @@ +package exascaledbnodes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-09-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/exascaledbnodes/2025-09-01" +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/README.md b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/README.md new file mode 100644 index 00000000000..9dcb7e2516e --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/README.md @@ -0,0 +1,117 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults` Documentation + +The `exascaledbstoragevaults` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults" +``` + + +### Client Initialization + +```go +client := exascaledbstoragevaults.NewExascaleDbStorageVaultsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ExascaleDbStorageVaultsClient.Create` + +```go +ctx := context.TODO() +id := exascaledbstoragevaults.NewExascaleDbStorageVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "exascaleDbStorageVaultName") + +payload := exascaledbstoragevaults.ExascaleDbStorageVault{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ExascaleDbStorageVaultsClient.Delete` + +```go +ctx := context.TODO() +id := exascaledbstoragevaults.NewExascaleDbStorageVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "exascaleDbStorageVaultName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ExascaleDbStorageVaultsClient.Get` + +```go +ctx := context.TODO() +id := exascaledbstoragevaults.NewExascaleDbStorageVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "exascaleDbStorageVaultName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ExascaleDbStorageVaultsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ExascaleDbStorageVaultsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ExascaleDbStorageVaultsClient.Update` + +```go +ctx := context.TODO() +id := exascaledbstoragevaults.NewExascaleDbStorageVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "exascaleDbStorageVaultName") + +payload := exascaledbstoragevaults.ExascaleDbStorageVaultTagsUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/client.go b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/client.go new file mode 100644 index 00000000000..83eac2a6ad9 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/client.go @@ -0,0 +1,26 @@ +package exascaledbstoragevaults + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExascaleDbStorageVaultsClient struct { + Client *resourcemanager.Client +} + +func NewExascaleDbStorageVaultsClientWithBaseURI(sdkApi sdkEnv.Api) (*ExascaleDbStorageVaultsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "exascaledbstoragevaults", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ExascaleDbStorageVaultsClient: %+v", err) + } + + return &ExascaleDbStorageVaultsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/constants.go b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/constants.go new file mode 100644 index 00000000000..f64f3c537a0 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/constants.go @@ -0,0 +1,151 @@ +package exascaledbstoragevaults + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureResourceProvisioningState string + +const ( + AzureResourceProvisioningStateCanceled AzureResourceProvisioningState = "Canceled" + AzureResourceProvisioningStateFailed AzureResourceProvisioningState = "Failed" + AzureResourceProvisioningStateProvisioning AzureResourceProvisioningState = "Provisioning" + AzureResourceProvisioningStateSucceeded AzureResourceProvisioningState = "Succeeded" +) + +func PossibleValuesForAzureResourceProvisioningState() []string { + return []string{ + string(AzureResourceProvisioningStateCanceled), + string(AzureResourceProvisioningStateFailed), + string(AzureResourceProvisioningStateProvisioning), + string(AzureResourceProvisioningStateSucceeded), + } +} + +func (s *AzureResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAzureResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAzureResourceProvisioningState(input string) (*AzureResourceProvisioningState, error) { + vals := map[string]AzureResourceProvisioningState{ + "canceled": AzureResourceProvisioningStateCanceled, + "failed": AzureResourceProvisioningStateFailed, + "provisioning": AzureResourceProvisioningStateProvisioning, + "succeeded": AzureResourceProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AzureResourceProvisioningState(input) + return &out, nil +} + +type ExascaleDbStorageVaultLifecycleState string + +const ( + ExascaleDbStorageVaultLifecycleStateAvailable ExascaleDbStorageVaultLifecycleState = "Available" + ExascaleDbStorageVaultLifecycleStateFailed ExascaleDbStorageVaultLifecycleState = "Failed" + ExascaleDbStorageVaultLifecycleStateProvisioning ExascaleDbStorageVaultLifecycleState = "Provisioning" + ExascaleDbStorageVaultLifecycleStateTerminated ExascaleDbStorageVaultLifecycleState = "Terminated" + ExascaleDbStorageVaultLifecycleStateTerminating ExascaleDbStorageVaultLifecycleState = "Terminating" + ExascaleDbStorageVaultLifecycleStateUpdating ExascaleDbStorageVaultLifecycleState = "Updating" +) + +func PossibleValuesForExascaleDbStorageVaultLifecycleState() []string { + return []string{ + string(ExascaleDbStorageVaultLifecycleStateAvailable), + string(ExascaleDbStorageVaultLifecycleStateFailed), + string(ExascaleDbStorageVaultLifecycleStateProvisioning), + string(ExascaleDbStorageVaultLifecycleStateTerminated), + string(ExascaleDbStorageVaultLifecycleStateTerminating), + string(ExascaleDbStorageVaultLifecycleStateUpdating), + } +} + +func (s *ExascaleDbStorageVaultLifecycleState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseExascaleDbStorageVaultLifecycleState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseExascaleDbStorageVaultLifecycleState(input string) (*ExascaleDbStorageVaultLifecycleState, error) { + vals := map[string]ExascaleDbStorageVaultLifecycleState{ + "available": ExascaleDbStorageVaultLifecycleStateAvailable, + "failed": ExascaleDbStorageVaultLifecycleStateFailed, + "provisioning": ExascaleDbStorageVaultLifecycleStateProvisioning, + "terminated": ExascaleDbStorageVaultLifecycleStateTerminated, + "terminating": ExascaleDbStorageVaultLifecycleStateTerminating, + "updating": ExascaleDbStorageVaultLifecycleStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExascaleDbStorageVaultLifecycleState(input) + return &out, nil +} + +type ShapeAttribute string + +const ( + ShapeAttributeBLOCKSTORAGE ShapeAttribute = "BLOCK_STORAGE" + ShapeAttributeSMARTSTORAGE ShapeAttribute = "SMART_STORAGE" +) + +func PossibleValuesForShapeAttribute() []string { + return []string{ + string(ShapeAttributeBLOCKSTORAGE), + string(ShapeAttributeSMARTSTORAGE), + } +} + +func (s *ShapeAttribute) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseShapeAttribute(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseShapeAttribute(input string) (*ShapeAttribute, error) { + vals := map[string]ShapeAttribute{ + "block_storage": ShapeAttributeBLOCKSTORAGE, + "smart_storage": ShapeAttributeSMARTSTORAGE, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ShapeAttribute(input) + return &out, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/id_exascaledbstoragevault.go b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/id_exascaledbstoragevault.go new file mode 100644 index 00000000000..1e3c8b70bb7 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/id_exascaledbstoragevault.go @@ -0,0 +1,130 @@ +package exascaledbstoragevaults + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&ExascaleDbStorageVaultId{}) +} + +var _ resourceids.ResourceId = &ExascaleDbStorageVaultId{} + +// ExascaleDbStorageVaultId is a struct representing the Resource ID for a Exascale Db Storage Vault +type ExascaleDbStorageVaultId struct { + SubscriptionId string + ResourceGroupName string + ExascaleDbStorageVaultName string +} + +// NewExascaleDbStorageVaultID returns a new ExascaleDbStorageVaultId struct +func NewExascaleDbStorageVaultID(subscriptionId string, resourceGroupName string, exascaleDbStorageVaultName string) ExascaleDbStorageVaultId { + return ExascaleDbStorageVaultId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ExascaleDbStorageVaultName: exascaleDbStorageVaultName, + } +} + +// ParseExascaleDbStorageVaultID parses 'input' into a ExascaleDbStorageVaultId +func ParseExascaleDbStorageVaultID(input string) (*ExascaleDbStorageVaultId, error) { + parser := resourceids.NewParserFromResourceIdType(&ExascaleDbStorageVaultId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ExascaleDbStorageVaultId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseExascaleDbStorageVaultIDInsensitively parses 'input' case-insensitively into a ExascaleDbStorageVaultId +// note: this method should only be used for API response data and not user input +func ParseExascaleDbStorageVaultIDInsensitively(input string) (*ExascaleDbStorageVaultId, error) { + parser := resourceids.NewParserFromResourceIdType(&ExascaleDbStorageVaultId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ExascaleDbStorageVaultId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExascaleDbStorageVaultId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.ExascaleDbStorageVaultName, ok = input.Parsed["exascaleDbStorageVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "exascaleDbStorageVaultName", input) + } + + return nil +} + +// ValidateExascaleDbStorageVaultID checks that 'input' can be parsed as a Exascale Db Storage Vault ID +func ValidateExascaleDbStorageVaultID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseExascaleDbStorageVaultID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Exascale Db Storage Vault ID +func (id ExascaleDbStorageVaultId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Oracle.Database/exascaleDbStorageVaults/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ExascaleDbStorageVaultName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Exascale Db Storage Vault ID +func (id ExascaleDbStorageVaultId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticExascaleDbStorageVaults", "exascaleDbStorageVaults", "exascaleDbStorageVaults"), + resourceids.UserSpecifiedSegment("exascaleDbStorageVaultName", "exascaleDbStorageVaultName"), + } +} + +// String returns a human-readable description of this Exascale Db Storage Vault ID +func (id ExascaleDbStorageVaultId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Exascale Db Storage Vault Name: %q", id.ExascaleDbStorageVaultName), + } + return fmt.Sprintf("Exascale Db Storage Vault (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/id_exascaledbstoragevault_test.go b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/id_exascaledbstoragevault_test.go new file mode 100644 index 00000000000..131b226446a --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/id_exascaledbstoragevault_test.go @@ -0,0 +1,282 @@ +package exascaledbstoragevaults + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ExascaleDbStorageVaultId{} + +func TestNewExascaleDbStorageVaultID(t *testing.T) { + id := NewExascaleDbStorageVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "exascaleDbStorageVaultName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.ExascaleDbStorageVaultName != "exascaleDbStorageVaultName" { + t.Fatalf("Expected %q but got %q for Segment 'ExascaleDbStorageVaultName'", id.ExascaleDbStorageVaultName, "exascaleDbStorageVaultName") + } +} + +func TestFormatExascaleDbStorageVaultID(t *testing.T) { + actual := NewExascaleDbStorageVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "exascaleDbStorageVaultName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exascaleDbStorageVaults/exascaleDbStorageVaultName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseExascaleDbStorageVaultID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ExascaleDbStorageVaultId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exascaleDbStorageVaults", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exascaleDbStorageVaults/exascaleDbStorageVaultName", + Expected: &ExascaleDbStorageVaultId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ExascaleDbStorageVaultName: "exascaleDbStorageVaultName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exascaleDbStorageVaults/exascaleDbStorageVaultName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseExascaleDbStorageVaultID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.ExascaleDbStorageVaultName != v.Expected.ExascaleDbStorageVaultName { + t.Fatalf("Expected %q but got %q for ExascaleDbStorageVaultName", v.Expected.ExascaleDbStorageVaultName, actual.ExascaleDbStorageVaultName) + } + + } +} + +func TestParseExascaleDbStorageVaultIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ExascaleDbStorageVaultId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exascaleDbStorageVaults", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/eXaScAlEdBsToRaGeVaUlTs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exascaleDbStorageVaults/exascaleDbStorageVaultName", + Expected: &ExascaleDbStorageVaultId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ExascaleDbStorageVaultName: "exascaleDbStorageVaultName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/exascaleDbStorageVaults/exascaleDbStorageVaultName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/eXaScAlEdBsToRaGeVaUlTs/eXaScAlEdBsToRaGeVaUlTnAmE", + Expected: &ExascaleDbStorageVaultId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + ExascaleDbStorageVaultName: "eXaScAlEdBsToRaGeVaUlTnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/eXaScAlEdBsToRaGeVaUlTs/eXaScAlEdBsToRaGeVaUlTnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseExascaleDbStorageVaultIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.ExascaleDbStorageVaultName != v.Expected.ExascaleDbStorageVaultName { + t.Fatalf("Expected %q but got %q for ExascaleDbStorageVaultName", v.Expected.ExascaleDbStorageVaultName, actual.ExascaleDbStorageVaultName) + } + + } +} + +func TestSegmentsForExascaleDbStorageVaultId(t *testing.T) { + segments := ExascaleDbStorageVaultId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ExascaleDbStorageVaultId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_create.go b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_create.go new file mode 100644 index 00000000000..994cc925bf7 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_create.go @@ -0,0 +1,75 @@ +package exascaledbstoragevaults + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ExascaleDbStorageVault +} + +// Create ... +func (c ExascaleDbStorageVaultsClient) Create(ctx context.Context, id ExascaleDbStorageVaultId, input ExascaleDbStorageVault) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c ExascaleDbStorageVaultsClient) CreateThenPoll(ctx context.Context, id ExascaleDbStorageVaultId, input ExascaleDbStorageVault) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_delete.go b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_delete.go new file mode 100644 index 00000000000..8f37005d392 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_delete.go @@ -0,0 +1,70 @@ +package exascaledbstoragevaults + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c ExascaleDbStorageVaultsClient) Delete(ctx context.Context, id ExascaleDbStorageVaultId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ExascaleDbStorageVaultsClient) DeleteThenPoll(ctx context.Context, id ExascaleDbStorageVaultId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_get.go b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_get.go new file mode 100644 index 00000000000..0e12c268013 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_get.go @@ -0,0 +1,53 @@ +package exascaledbstoragevaults + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ExascaleDbStorageVault +} + +// Get ... +func (c ExascaleDbStorageVaultsClient) Get(ctx context.Context, id ExascaleDbStorageVaultId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ExascaleDbStorageVault + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_listbyresourcegroup.go b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_listbyresourcegroup.go new file mode 100644 index 00000000000..91971acba22 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package exascaledbstoragevaults + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ExascaleDbStorageVault +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []ExascaleDbStorageVault +} + +type ListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByResourceGroup ... +func (c ExascaleDbStorageVaultsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Oracle.Database/exascaleDbStorageVaults", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ExascaleDbStorageVault `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c ExascaleDbStorageVaultsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ExascaleDbStorageVaultOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ExascaleDbStorageVaultsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ExascaleDbStorageVaultOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]ExascaleDbStorageVault, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_listbysubscription.go b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_listbysubscription.go new file mode 100644 index 00000000000..3ea96c53dd3 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_listbysubscription.go @@ -0,0 +1,106 @@ +package exascaledbstoragevaults + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ExascaleDbStorageVault +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []ExascaleDbStorageVault +} + +type ListBySubscriptionCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListBySubscriptionCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListBySubscription ... +func (c ExascaleDbStorageVaultsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Oracle.Database/exascaleDbStorageVaults", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ExascaleDbStorageVault `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c ExascaleDbStorageVaultsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, ExascaleDbStorageVaultOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ExascaleDbStorageVaultsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ExascaleDbStorageVaultOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]ExascaleDbStorageVault, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_update.go b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_update.go new file mode 100644 index 00000000000..ecf4eb84e18 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/method_update.go @@ -0,0 +1,75 @@ +package exascaledbstoragevaults + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ExascaleDbStorageVault +} + +// Update ... +func (c ExascaleDbStorageVaultsClient) Update(ctx context.Context, id ExascaleDbStorageVaultId, input ExascaleDbStorageVaultTagsUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ExascaleDbStorageVaultsClient) UpdateThenPoll(ctx context.Context, id ExascaleDbStorageVaultId, input ExascaleDbStorageVaultTagsUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/model_exascaledbstoragedetails.go b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/model_exascaledbstoragedetails.go new file mode 100644 index 00000000000..961467d76a1 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/model_exascaledbstoragedetails.go @@ -0,0 +1,9 @@ +package exascaledbstoragevaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExascaleDbStorageDetails struct { + AvailableSizeInGbs *int64 `json:"availableSizeInGbs,omitempty"` + TotalSizeInGbs *int64 `json:"totalSizeInGbs,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/model_exascaledbstorageinputdetails.go b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/model_exascaledbstorageinputdetails.go new file mode 100644 index 00000000000..d7bd355f083 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/model_exascaledbstorageinputdetails.go @@ -0,0 +1,8 @@ +package exascaledbstoragevaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExascaleDbStorageInputDetails struct { + TotalSizeInGbs int64 `json:"totalSizeInGbs"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/model_exascaledbstoragevault.go b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/model_exascaledbstoragevault.go new file mode 100644 index 00000000000..66f1a40e733 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/model_exascaledbstoragevault.go @@ -0,0 +1,20 @@ +package exascaledbstoragevaults + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExascaleDbStorageVault struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ExascaleDbStorageVaultProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/model_exascaledbstoragevaultproperties.go b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/model_exascaledbstoragevaultproperties.go new file mode 100644 index 00000000000..17c9bb5ba78 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/model_exascaledbstoragevaultproperties.go @@ -0,0 +1,21 @@ +package exascaledbstoragevaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExascaleDbStorageVaultProperties struct { + AdditionalFlashCacheInPercent *int64 `json:"additionalFlashCacheInPercent,omitempty"` + AttachedShapeAttributes *[]ShapeAttribute `json:"attachedShapeAttributes,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName string `json:"displayName"` + ExadataInfrastructureId *string `json:"exadataInfrastructureId,omitempty"` + HighCapacityDatabaseStorage *ExascaleDbStorageDetails `json:"highCapacityDatabaseStorage,omitempty"` + HighCapacityDatabaseStorageInput ExascaleDbStorageInputDetails `json:"highCapacityDatabaseStorageInput"` + LifecycleDetails *string `json:"lifecycleDetails,omitempty"` + LifecycleState *ExascaleDbStorageVaultLifecycleState `json:"lifecycleState,omitempty"` + OciURL *string `json:"ociUrl,omitempty"` + Ocid *string `json:"ocid,omitempty"` + ProvisioningState *AzureResourceProvisioningState `json:"provisioningState,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + VMClusterCount *int64 `json:"vmClusterCount,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/model_exascaledbstoragevaulttagsupdate.go b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/model_exascaledbstoragevaulttagsupdate.go new file mode 100644 index 00000000000..08352e19cec --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/model_exascaledbstoragevaulttagsupdate.go @@ -0,0 +1,8 @@ +package exascaledbstoragevaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExascaleDbStorageVaultTagsUpdate struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/predicates.go b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/predicates.go new file mode 100644 index 00000000000..98c43be20e8 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/predicates.go @@ -0,0 +1,32 @@ +package exascaledbstoragevaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExascaleDbStorageVaultOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ExascaleDbStorageVaultOperationPredicate) Matches(input ExascaleDbStorageVault) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/version.go b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/version.go similarity index 57% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/version.go rename to resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/version.go index 9ad42a76eba..3bb9f900078 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/version.go +++ b/resource-manager/oracledatabase/2025-09-01/exascaledbstoragevaults/version.go @@ -1,10 +1,10 @@ -package backupprotecteditems +package exascaledbstoragevaults // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2025-02-01" +const defaultApiVersion = "2025-09-01" func userAgent() string { - return "hashicorp/go-azure-sdk/backupprotecteditems/2025-02-01" + return "hashicorp/go-azure-sdk/exascaledbstoragevaults/2025-09-01" } diff --git a/resource-manager/oracledatabase/2025-09-01/flexcomponents/README.md b/resource-manager/oracledatabase/2025-09-01/flexcomponents/README.md new file mode 100644 index 00000000000..a6f391da0b6 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/flexcomponents/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/flexcomponents` Documentation + +The `flexcomponents` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/flexcomponents" +``` + + +### Client Initialization + +```go +client := flexcomponents.NewFlexComponentsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `FlexComponentsClient.Get` + +```go +ctx := context.TODO() +id := flexcomponents.NewFlexComponentID("12345678-1234-9876-4563-123456789012", "locationName", "flexComponentName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `FlexComponentsClient.ListByParent` + +```go +ctx := context.TODO() +id := flexcomponents.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +// alternatively `client.ListByParent(ctx, id, flexcomponents.DefaultListByParentOperationOptions())` can be used to do batched pagination +items, err := client.ListByParentComplete(ctx, id, flexcomponents.DefaultListByParentOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/flexcomponents/client.go b/resource-manager/oracledatabase/2025-09-01/flexcomponents/client.go new file mode 100644 index 00000000000..5e22c09e89e --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/flexcomponents/client.go @@ -0,0 +1,26 @@ +package flexcomponents + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FlexComponentsClient struct { + Client *resourcemanager.Client +} + +func NewFlexComponentsClientWithBaseURI(sdkApi sdkEnv.Api) (*FlexComponentsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "flexcomponents", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating FlexComponentsClient: %+v", err) + } + + return &FlexComponentsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/flexcomponents/constants.go b/resource-manager/oracledatabase/2025-09-01/flexcomponents/constants.go new file mode 100644 index 00000000000..82c5fa49b86 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/flexcomponents/constants.go @@ -0,0 +1,95 @@ +package flexcomponents + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HardwareType string + +const ( + HardwareTypeCELL HardwareType = "CELL" + HardwareTypeCOMPUTE HardwareType = "COMPUTE" +) + +func PossibleValuesForHardwareType() []string { + return []string{ + string(HardwareTypeCELL), + string(HardwareTypeCOMPUTE), + } +} + +func (s *HardwareType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHardwareType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHardwareType(input string) (*HardwareType, error) { + vals := map[string]HardwareType{ + "cell": HardwareTypeCELL, + "compute": HardwareTypeCOMPUTE, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HardwareType(input) + return &out, nil +} + +type SystemShapes string + +const ( + SystemShapesExaDbXS SystemShapes = "ExaDbXS" + SystemShapesExadataPointXNineM SystemShapes = "Exadata.X9M" + SystemShapesExadataPointXOneOneM SystemShapes = "Exadata.X11M" +) + +func PossibleValuesForSystemShapes() []string { + return []string{ + string(SystemShapesExaDbXS), + string(SystemShapesExadataPointXNineM), + string(SystemShapesExadataPointXOneOneM), + } +} + +func (s *SystemShapes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSystemShapes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSystemShapes(input string) (*SystemShapes, error) { + vals := map[string]SystemShapes{ + "exadbxs": SystemShapesExaDbXS, + "exadata.x9m": SystemShapesExadataPointXNineM, + "exadata.x11m": SystemShapesExadataPointXOneOneM, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SystemShapes(input) + return &out, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/flexcomponents/id_flexcomponent.go b/resource-manager/oracledatabase/2025-09-01/flexcomponents/id_flexcomponent.go new file mode 100644 index 00000000000..2718a4a0d4f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/flexcomponents/id_flexcomponent.go @@ -0,0 +1,130 @@ +package flexcomponents + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&FlexComponentId{}) +} + +var _ resourceids.ResourceId = &FlexComponentId{} + +// FlexComponentId is a struct representing the Resource ID for a Flex Component +type FlexComponentId struct { + SubscriptionId string + LocationName string + FlexComponentName string +} + +// NewFlexComponentID returns a new FlexComponentId struct +func NewFlexComponentID(subscriptionId string, locationName string, flexComponentName string) FlexComponentId { + return FlexComponentId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + FlexComponentName: flexComponentName, + } +} + +// ParseFlexComponentID parses 'input' into a FlexComponentId +func ParseFlexComponentID(input string) (*FlexComponentId, error) { + parser := resourceids.NewParserFromResourceIdType(&FlexComponentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := FlexComponentId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseFlexComponentIDInsensitively parses 'input' case-insensitively into a FlexComponentId +// note: this method should only be used for API response data and not user input +func ParseFlexComponentIDInsensitively(input string) (*FlexComponentId, error) { + parser := resourceids.NewParserFromResourceIdType(&FlexComponentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := FlexComponentId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FlexComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.FlexComponentName, ok = input.Parsed["flexComponentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexComponentName", input) + } + + return nil +} + +// ValidateFlexComponentID checks that 'input' can be parsed as a Flex Component ID +func ValidateFlexComponentID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseFlexComponentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Flex Component ID +func (id FlexComponentId) ID() string { + fmtString := "/subscriptions/%s/providers/Oracle.Database/locations/%s/flexComponents/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.FlexComponentName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Flex Component ID +func (id FlexComponentId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticFlexComponents", "flexComponents", "flexComponents"), + resourceids.UserSpecifiedSegment("flexComponentName", "flexComponentName"), + } +} + +// String returns a human-readable description of this Flex Component ID +func (id FlexComponentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Flex Component Name: %q", id.FlexComponentName), + } + return fmt.Sprintf("Flex Component (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/flexcomponents/id_flexcomponent_test.go b/resource-manager/oracledatabase/2025-09-01/flexcomponents/id_flexcomponent_test.go new file mode 100644 index 00000000000..dda6e21e040 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/flexcomponents/id_flexcomponent_test.go @@ -0,0 +1,282 @@ +package flexcomponents + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &FlexComponentId{} + +func TestNewFlexComponentID(t *testing.T) { + id := NewFlexComponentID("12345678-1234-9876-4563-123456789012", "locationName", "flexComponentName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.FlexComponentName != "flexComponentName" { + t.Fatalf("Expected %q but got %q for Segment 'FlexComponentName'", id.FlexComponentName, "flexComponentName") + } +} + +func TestFormatFlexComponentID(t *testing.T) { + actual := NewFlexComponentID("12345678-1234-9876-4563-123456789012", "locationName", "flexComponentName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/flexComponents/flexComponentName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseFlexComponentID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *FlexComponentId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/flexComponents", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/flexComponents/flexComponentName", + Expected: &FlexComponentId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + FlexComponentName: "flexComponentName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/flexComponents/flexComponentName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseFlexComponentID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.FlexComponentName != v.Expected.FlexComponentName { + t.Fatalf("Expected %q but got %q for FlexComponentName", v.Expected.FlexComponentName, actual.FlexComponentName) + } + + } +} + +func TestParseFlexComponentIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *FlexComponentId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/flexComponents", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/fLeXcOmPoNeNtS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/flexComponents/flexComponentName", + Expected: &FlexComponentId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + FlexComponentName: "flexComponentName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/flexComponents/flexComponentName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/fLeXcOmPoNeNtS/fLeXcOmPoNeNtNaMe", + Expected: &FlexComponentId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + FlexComponentName: "fLeXcOmPoNeNtNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/fLeXcOmPoNeNtS/fLeXcOmPoNeNtNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseFlexComponentIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.FlexComponentName != v.Expected.FlexComponentName { + t.Fatalf("Expected %q but got %q for FlexComponentName", v.Expected.FlexComponentName, actual.FlexComponentName) + } + + } +} + +func TestSegmentsForFlexComponentId(t *testing.T) { + segments := FlexComponentId{}.Segments() + if len(segments) == 0 { + t.Fatalf("FlexComponentId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/flexcomponents/id_location.go b/resource-manager/oracledatabase/2025-09-01/flexcomponents/id_location.go new file mode 100644 index 00000000000..f63c2dddd24 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/flexcomponents/id_location.go @@ -0,0 +1,121 @@ +package flexcomponents + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&LocationId{}) +} + +var _ resourceids.ResourceId = &LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + LocationName string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, locationName string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Oracle.Database/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/flexcomponents/id_location_test.go b/resource-manager/oracledatabase/2025-09-01/flexcomponents/id_location_test.go new file mode 100644 index 00000000000..cb912811f0c --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/flexcomponents/id_location_test.go @@ -0,0 +1,237 @@ +package flexcomponents + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &LocationId{} + +func TestNewLocationID(t *testing.T) { + id := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } +} + +func TestFormatLocationID(t *testing.T) { + actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseLocationID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LocationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseLocationID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestParseLocationIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LocationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseLocationIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestSegmentsForLocationId(t *testing.T) { + segments := LocationId{}.Segments() + if len(segments) == 0 { + t.Fatalf("LocationId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/flexcomponents/method_get.go b/resource-manager/oracledatabase/2025-09-01/flexcomponents/method_get.go new file mode 100644 index 00000000000..ac5c483281a --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/flexcomponents/method_get.go @@ -0,0 +1,53 @@ +package flexcomponents + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *FlexComponent +} + +// Get ... +func (c FlexComponentsClient) Get(ctx context.Context, id FlexComponentId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model FlexComponent + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/flexcomponents/method_listbyparent.go b/resource-manager/oracledatabase/2025-09-01/flexcomponents/method_listbyparent.go new file mode 100644 index 00000000000..093ae0bbaf3 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/flexcomponents/method_listbyparent.go @@ -0,0 +1,134 @@ +package flexcomponents + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByParentOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]FlexComponent +} + +type ListByParentCompleteResult struct { + LatestHttpResponse *http.Response + Items []FlexComponent +} + +type ListByParentOperationOptions struct { + Shape *SystemShapes +} + +func DefaultListByParentOperationOptions() ListByParentOperationOptions { + return ListByParentOperationOptions{} +} + +func (o ListByParentOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByParentOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListByParentOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Shape != nil { + out.Append("shape", fmt.Sprintf("%v", *o.Shape)) + } + return &out +} + +type ListByParentCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByParentCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByParent ... +func (c FlexComponentsClient) ListByParent(ctx context.Context, id LocationId, options ListByParentOperationOptions) (result ListByParentOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListByParentCustomPager{}, + Path: fmt.Sprintf("%s/flexComponents", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]FlexComponent `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByParentComplete retrieves all the results into a single object +func (c FlexComponentsClient) ListByParentComplete(ctx context.Context, id LocationId, options ListByParentOperationOptions) (ListByParentCompleteResult, error) { + return c.ListByParentCompleteMatchingPredicate(ctx, id, options, FlexComponentOperationPredicate{}) +} + +// ListByParentCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c FlexComponentsClient) ListByParentCompleteMatchingPredicate(ctx context.Context, id LocationId, options ListByParentOperationOptions, predicate FlexComponentOperationPredicate) (result ListByParentCompleteResult, err error) { + items := make([]FlexComponent, 0) + + resp, err := c.ListByParent(ctx, id, options) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByParentCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/flexcomponents/model_flexcomponent.go b/resource-manager/oracledatabase/2025-09-01/flexcomponents/model_flexcomponent.go new file mode 100644 index 00000000000..4dd141a7e23 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/flexcomponents/model_flexcomponent.go @@ -0,0 +1,16 @@ +package flexcomponents + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FlexComponent struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *FlexComponentProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/flexcomponents/model_flexcomponentproperties.go b/resource-manager/oracledatabase/2025-09-01/flexcomponents/model_flexcomponentproperties.go new file mode 100644 index 00000000000..7721087f203 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/flexcomponents/model_flexcomponentproperties.go @@ -0,0 +1,17 @@ +package flexcomponents + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FlexComponentProperties struct { + AvailableCoreCount *int64 `json:"availableCoreCount,omitempty"` + AvailableDbStorageInGbs *int64 `json:"availableDbStorageInGbs,omitempty"` + AvailableLocalStorageInGbs *int64 `json:"availableLocalStorageInGbs,omitempty"` + AvailableMemoryInGbs *int64 `json:"availableMemoryInGbs,omitempty"` + ComputeModel *string `json:"computeModel,omitempty"` + DescriptionSummary *string `json:"descriptionSummary,omitempty"` + HardwareType *HardwareType `json:"hardwareType,omitempty"` + MinimumCoreCount *int64 `json:"minimumCoreCount,omitempty"` + RuntimeMinimumCoreCount *int64 `json:"runtimeMinimumCoreCount,omitempty"` + Shape *string `json:"shape,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/flexcomponents/predicates.go b/resource-manager/oracledatabase/2025-09-01/flexcomponents/predicates.go new file mode 100644 index 00000000000..78e233e5a87 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/flexcomponents/predicates.go @@ -0,0 +1,27 @@ +package flexcomponents + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FlexComponentOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p FlexComponentOperationPredicate) Matches(input FlexComponent) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/oracledatabase/2025-09-01/flexcomponents/version.go b/resource-manager/oracledatabase/2025-09-01/flexcomponents/version.go new file mode 100644 index 00000000000..d875926e522 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/flexcomponents/version.go @@ -0,0 +1,10 @@ +package flexcomponents + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-09-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/flexcomponents/2025-09-01" +} diff --git a/resource-manager/oracledatabase/2025-09-01/giminorversions/README.md b/resource-manager/oracledatabase/2025-09-01/giminorversions/README.md new file mode 100644 index 00000000000..c8fc1cb62ed --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giminorversions/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/giminorversions` Documentation + +The `giminorversions` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/giminorversions" +``` + + +### Client Initialization + +```go +client := giminorversions.NewGiMinorVersionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `GiMinorVersionsClient.Get` + +```go +ctx := context.TODO() +id := giminorversions.NewGiMinorVersionID("12345678-1234-9876-4563-123456789012", "locationName", "giVersionName", "giMinorVersionName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GiMinorVersionsClient.ListByParent` + +```go +ctx := context.TODO() +id := giminorversions.NewGiVersionID("12345678-1234-9876-4563-123456789012", "locationName", "giVersionName") + +// alternatively `client.ListByParent(ctx, id, giminorversions.DefaultListByParentOperationOptions())` can be used to do batched pagination +items, err := client.ListByParentComplete(ctx, id, giminorversions.DefaultListByParentOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/giminorversions/client.go b/resource-manager/oracledatabase/2025-09-01/giminorversions/client.go new file mode 100644 index 00000000000..1f64461e044 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giminorversions/client.go @@ -0,0 +1,26 @@ +package giminorversions + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GiMinorVersionsClient struct { + Client *resourcemanager.Client +} + +func NewGiMinorVersionsClientWithBaseURI(sdkApi sdkEnv.Api) (*GiMinorVersionsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "giminorversions", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GiMinorVersionsClient: %+v", err) + } + + return &GiMinorVersionsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/giminorversions/constants.go b/resource-manager/oracledatabase/2025-09-01/giminorversions/constants.go new file mode 100644 index 00000000000..e9aa2c0cf24 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giminorversions/constants.go @@ -0,0 +1,51 @@ +package giminorversions + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ShapeFamily string + +const ( + ShapeFamilyEXADATA ShapeFamily = "EXADATA" + ShapeFamilyEXADBXS ShapeFamily = "EXADB_XS" +) + +func PossibleValuesForShapeFamily() []string { + return []string{ + string(ShapeFamilyEXADATA), + string(ShapeFamilyEXADBXS), + } +} + +func (s *ShapeFamily) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseShapeFamily(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseShapeFamily(input string) (*ShapeFamily, error) { + vals := map[string]ShapeFamily{ + "exadata": ShapeFamilyEXADATA, + "exadb_xs": ShapeFamilyEXADBXS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ShapeFamily(input) + return &out, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/giminorversions/id_giminorversion.go b/resource-manager/oracledatabase/2025-09-01/giminorversions/id_giminorversion.go new file mode 100644 index 00000000000..7904ad3161a --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giminorversions/id_giminorversion.go @@ -0,0 +1,139 @@ +package giminorversions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&GiMinorVersionId{}) +} + +var _ resourceids.ResourceId = &GiMinorVersionId{} + +// GiMinorVersionId is a struct representing the Resource ID for a Gi Minor Version +type GiMinorVersionId struct { + SubscriptionId string + LocationName string + GiVersionName string + GiMinorVersionName string +} + +// NewGiMinorVersionID returns a new GiMinorVersionId struct +func NewGiMinorVersionID(subscriptionId string, locationName string, giVersionName string, giMinorVersionName string) GiMinorVersionId { + return GiMinorVersionId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + GiVersionName: giVersionName, + GiMinorVersionName: giMinorVersionName, + } +} + +// ParseGiMinorVersionID parses 'input' into a GiMinorVersionId +func ParseGiMinorVersionID(input string) (*GiMinorVersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&GiMinorVersionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := GiMinorVersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseGiMinorVersionIDInsensitively parses 'input' case-insensitively into a GiMinorVersionId +// note: this method should only be used for API response data and not user input +func ParseGiMinorVersionIDInsensitively(input string) (*GiMinorVersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&GiMinorVersionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := GiMinorVersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GiMinorVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.GiVersionName, ok = input.Parsed["giVersionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "giVersionName", input) + } + + if id.GiMinorVersionName, ok = input.Parsed["giMinorVersionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "giMinorVersionName", input) + } + + return nil +} + +// ValidateGiMinorVersionID checks that 'input' can be parsed as a Gi Minor Version ID +func ValidateGiMinorVersionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseGiMinorVersionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Gi Minor Version ID +func (id GiMinorVersionId) ID() string { + fmtString := "/subscriptions/%s/providers/Oracle.Database/locations/%s/giVersions/%s/giMinorVersions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.GiVersionName, id.GiMinorVersionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Gi Minor Version ID +func (id GiMinorVersionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticGiVersions", "giVersions", "giVersions"), + resourceids.UserSpecifiedSegment("giVersionName", "giVersionName"), + resourceids.StaticSegment("staticGiMinorVersions", "giMinorVersions", "giMinorVersions"), + resourceids.UserSpecifiedSegment("giMinorVersionName", "giMinorVersionName"), + } +} + +// String returns a human-readable description of this Gi Minor Version ID +func (id GiMinorVersionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Gi Version Name: %q", id.GiVersionName), + fmt.Sprintf("Gi Minor Version Name: %q", id.GiMinorVersionName), + } + return fmt.Sprintf("Gi Minor Version (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/giminorversions/id_giminorversion_test.go b/resource-manager/oracledatabase/2025-09-01/giminorversions/id_giminorversion_test.go new file mode 100644 index 00000000000..2ed7abc5b2d --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giminorversions/id_giminorversion_test.go @@ -0,0 +1,327 @@ +package giminorversions + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &GiMinorVersionId{} + +func TestNewGiMinorVersionID(t *testing.T) { + id := NewGiMinorVersionID("12345678-1234-9876-4563-123456789012", "locationName", "giVersionName", "giMinorVersionName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.GiVersionName != "giVersionName" { + t.Fatalf("Expected %q but got %q for Segment 'GiVersionName'", id.GiVersionName, "giVersionName") + } + + if id.GiMinorVersionName != "giMinorVersionName" { + t.Fatalf("Expected %q but got %q for Segment 'GiMinorVersionName'", id.GiMinorVersionName, "giMinorVersionName") + } +} + +func TestFormatGiMinorVersionID(t *testing.T) { + actual := NewGiMinorVersionID("12345678-1234-9876-4563-123456789012", "locationName", "giVersionName", "giMinorVersionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions/giVersionName/giMinorVersions/giMinorVersionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseGiMinorVersionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *GiMinorVersionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions/giVersionName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions/giVersionName/giMinorVersions", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions/giVersionName/giMinorVersions/giMinorVersionName", + Expected: &GiMinorVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + GiVersionName: "giVersionName", + GiMinorVersionName: "giMinorVersionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions/giVersionName/giMinorVersions/giMinorVersionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseGiMinorVersionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.GiVersionName != v.Expected.GiVersionName { + t.Fatalf("Expected %q but got %q for GiVersionName", v.Expected.GiVersionName, actual.GiVersionName) + } + + if actual.GiMinorVersionName != v.Expected.GiMinorVersionName { + t.Fatalf("Expected %q but got %q for GiMinorVersionName", v.Expected.GiMinorVersionName, actual.GiMinorVersionName) + } + + } +} + +func TestParseGiMinorVersionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *GiMinorVersionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/gIvErSiOnS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions/giVersionName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/gIvErSiOnS/gIvErSiOnNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions/giVersionName/giMinorVersions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/gIvErSiOnS/gIvErSiOnNaMe/gImInOrVeRsIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions/giVersionName/giMinorVersions/giMinorVersionName", + Expected: &GiMinorVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + GiVersionName: "giVersionName", + GiMinorVersionName: "giMinorVersionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions/giVersionName/giMinorVersions/giMinorVersionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/gIvErSiOnS/gIvErSiOnNaMe/gImInOrVeRsIoNs/gImInOrVeRsIoNnAmE", + Expected: &GiMinorVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + GiVersionName: "gIvErSiOnNaMe", + GiMinorVersionName: "gImInOrVeRsIoNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/gIvErSiOnS/gIvErSiOnNaMe/gImInOrVeRsIoNs/gImInOrVeRsIoNnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseGiMinorVersionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.GiVersionName != v.Expected.GiVersionName { + t.Fatalf("Expected %q but got %q for GiVersionName", v.Expected.GiVersionName, actual.GiVersionName) + } + + if actual.GiMinorVersionName != v.Expected.GiMinorVersionName { + t.Fatalf("Expected %q but got %q for GiMinorVersionName", v.Expected.GiMinorVersionName, actual.GiMinorVersionName) + } + + } +} + +func TestSegmentsForGiMinorVersionId(t *testing.T) { + segments := GiMinorVersionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("GiMinorVersionId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/giminorversions/id_giversion.go b/resource-manager/oracledatabase/2025-09-01/giminorversions/id_giversion.go new file mode 100644 index 00000000000..643660b4842 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giminorversions/id_giversion.go @@ -0,0 +1,130 @@ +package giminorversions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&GiVersionId{}) +} + +var _ resourceids.ResourceId = &GiVersionId{} + +// GiVersionId is a struct representing the Resource ID for a Gi Version +type GiVersionId struct { + SubscriptionId string + LocationName string + GiVersionName string +} + +// NewGiVersionID returns a new GiVersionId struct +func NewGiVersionID(subscriptionId string, locationName string, giVersionName string) GiVersionId { + return GiVersionId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + GiVersionName: giVersionName, + } +} + +// ParseGiVersionID parses 'input' into a GiVersionId +func ParseGiVersionID(input string) (*GiVersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&GiVersionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := GiVersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseGiVersionIDInsensitively parses 'input' case-insensitively into a GiVersionId +// note: this method should only be used for API response data and not user input +func ParseGiVersionIDInsensitively(input string) (*GiVersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&GiVersionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := GiVersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GiVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.GiVersionName, ok = input.Parsed["giVersionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "giVersionName", input) + } + + return nil +} + +// ValidateGiVersionID checks that 'input' can be parsed as a Gi Version ID +func ValidateGiVersionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseGiVersionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Gi Version ID +func (id GiVersionId) ID() string { + fmtString := "/subscriptions/%s/providers/Oracle.Database/locations/%s/giVersions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.GiVersionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Gi Version ID +func (id GiVersionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticGiVersions", "giVersions", "giVersions"), + resourceids.UserSpecifiedSegment("giVersionName", "giVersionName"), + } +} + +// String returns a human-readable description of this Gi Version ID +func (id GiVersionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Gi Version Name: %q", id.GiVersionName), + } + return fmt.Sprintf("Gi Version (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/giminorversions/id_giversion_test.go b/resource-manager/oracledatabase/2025-09-01/giminorversions/id_giversion_test.go new file mode 100644 index 00000000000..e2b3488aa13 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giminorversions/id_giversion_test.go @@ -0,0 +1,282 @@ +package giminorversions + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &GiVersionId{} + +func TestNewGiVersionID(t *testing.T) { + id := NewGiVersionID("12345678-1234-9876-4563-123456789012", "locationName", "giVersionName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.GiVersionName != "giVersionName" { + t.Fatalf("Expected %q but got %q for Segment 'GiVersionName'", id.GiVersionName, "giVersionName") + } +} + +func TestFormatGiVersionID(t *testing.T) { + actual := NewGiVersionID("12345678-1234-9876-4563-123456789012", "locationName", "giVersionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions/giVersionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseGiVersionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *GiVersionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions/giVersionName", + Expected: &GiVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + GiVersionName: "giVersionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions/giVersionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseGiVersionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.GiVersionName != v.Expected.GiVersionName { + t.Fatalf("Expected %q but got %q for GiVersionName", v.Expected.GiVersionName, actual.GiVersionName) + } + + } +} + +func TestParseGiVersionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *GiVersionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/gIvErSiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions/giVersionName", + Expected: &GiVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + GiVersionName: "giVersionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions/giVersionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/gIvErSiOnS/gIvErSiOnNaMe", + Expected: &GiVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + GiVersionName: "gIvErSiOnNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/gIvErSiOnS/gIvErSiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseGiVersionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.GiVersionName != v.Expected.GiVersionName { + t.Fatalf("Expected %q but got %q for GiVersionName", v.Expected.GiVersionName, actual.GiVersionName) + } + + } +} + +func TestSegmentsForGiVersionId(t *testing.T) { + segments := GiVersionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("GiVersionId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/giminorversions/method_get.go b/resource-manager/oracledatabase/2025-09-01/giminorversions/method_get.go new file mode 100644 index 00000000000..67100ecfaac --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giminorversions/method_get.go @@ -0,0 +1,53 @@ +package giminorversions + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GiMinorVersion +} + +// Get ... +func (c GiMinorVersionsClient) Get(ctx context.Context, id GiMinorVersionId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model GiMinorVersion + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/giminorversions/method_listbyparent.go b/resource-manager/oracledatabase/2025-09-01/giminorversions/method_listbyparent.go new file mode 100644 index 00000000000..889d9e5d09e --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giminorversions/method_listbyparent.go @@ -0,0 +1,138 @@ +package giminorversions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByParentOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GiMinorVersion +} + +type ListByParentCompleteResult struct { + LatestHttpResponse *http.Response + Items []GiMinorVersion +} + +type ListByParentOperationOptions struct { + ShapeFamily *ShapeFamily + Zone *string +} + +func DefaultListByParentOperationOptions() ListByParentOperationOptions { + return ListByParentOperationOptions{} +} + +func (o ListByParentOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByParentOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListByParentOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ShapeFamily != nil { + out.Append("shapeFamily", fmt.Sprintf("%v", *o.ShapeFamily)) + } + if o.Zone != nil { + out.Append("zone", fmt.Sprintf("%v", *o.Zone)) + } + return &out +} + +type ListByParentCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByParentCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByParent ... +func (c GiMinorVersionsClient) ListByParent(ctx context.Context, id GiVersionId, options ListByParentOperationOptions) (result ListByParentOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListByParentCustomPager{}, + Path: fmt.Sprintf("%s/giMinorVersions", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]GiMinorVersion `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByParentComplete retrieves all the results into a single object +func (c GiMinorVersionsClient) ListByParentComplete(ctx context.Context, id GiVersionId, options ListByParentOperationOptions) (ListByParentCompleteResult, error) { + return c.ListByParentCompleteMatchingPredicate(ctx, id, options, GiMinorVersionOperationPredicate{}) +} + +// ListByParentCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GiMinorVersionsClient) ListByParentCompleteMatchingPredicate(ctx context.Context, id GiVersionId, options ListByParentOperationOptions, predicate GiMinorVersionOperationPredicate) (result ListByParentCompleteResult, err error) { + items := make([]GiMinorVersion, 0) + + resp, err := c.ListByParent(ctx, id, options) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByParentCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/giminorversions/model_giminorversion.go b/resource-manager/oracledatabase/2025-09-01/giminorversions/model_giminorversion.go new file mode 100644 index 00000000000..27554cfd60f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giminorversions/model_giminorversion.go @@ -0,0 +1,16 @@ +package giminorversions + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GiMinorVersion struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *GiMinorVersionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/giminorversions/model_giminorversionproperties.go b/resource-manager/oracledatabase/2025-09-01/giminorversions/model_giminorversionproperties.go new file mode 100644 index 00000000000..9cc722413f3 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giminorversions/model_giminorversionproperties.go @@ -0,0 +1,9 @@ +package giminorversions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GiMinorVersionProperties struct { + GridImageOcid *string `json:"gridImageOcid,omitempty"` + Version string `json:"version"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/giminorversions/predicates.go b/resource-manager/oracledatabase/2025-09-01/giminorversions/predicates.go new file mode 100644 index 00000000000..6ba146a0cf5 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giminorversions/predicates.go @@ -0,0 +1,27 @@ +package giminorversions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GiMinorVersionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p GiMinorVersionOperationPredicate) Matches(input GiMinorVersion) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/oracledatabase/2025-09-01/giminorversions/version.go b/resource-manager/oracledatabase/2025-09-01/giminorversions/version.go new file mode 100644 index 00000000000..8084d7b673f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giminorversions/version.go @@ -0,0 +1,10 @@ +package giminorversions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-09-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/giminorversions/2025-09-01" +} diff --git a/resource-manager/oracledatabase/2025-09-01/giversions/README.md b/resource-manager/oracledatabase/2025-09-01/giversions/README.md new file mode 100644 index 00000000000..aab85dab2c1 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giversions/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/giversions` Documentation + +The `giversions` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/giversions" +``` + + +### Client Initialization + +```go +client := giversions.NewGiVersionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `GiVersionsClient.Get` + +```go +ctx := context.TODO() +id := giversions.NewGiVersionID("12345678-1234-9876-4563-123456789012", "locationName", "giVersionName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GiVersionsClient.ListByLocation` + +```go +ctx := context.TODO() +id := giversions.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +// alternatively `client.ListByLocation(ctx, id, giversions.DefaultListByLocationOperationOptions())` can be used to do batched pagination +items, err := client.ListByLocationComplete(ctx, id, giversions.DefaultListByLocationOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/giversions/client.go b/resource-manager/oracledatabase/2025-09-01/giversions/client.go new file mode 100644 index 00000000000..a1da948c692 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giversions/client.go @@ -0,0 +1,26 @@ +package giversions + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GiVersionsClient struct { + Client *resourcemanager.Client +} + +func NewGiVersionsClientWithBaseURI(sdkApi sdkEnv.Api) (*GiVersionsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "giversions", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GiVersionsClient: %+v", err) + } + + return &GiVersionsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/giversions/constants.go b/resource-manager/oracledatabase/2025-09-01/giversions/constants.go new file mode 100644 index 00000000000..4f371108b5e --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giversions/constants.go @@ -0,0 +1,54 @@ +package giversions + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SystemShapes string + +const ( + SystemShapesExaDbXS SystemShapes = "ExaDbXS" + SystemShapesExadataPointXNineM SystemShapes = "Exadata.X9M" + SystemShapesExadataPointXOneOneM SystemShapes = "Exadata.X11M" +) + +func PossibleValuesForSystemShapes() []string { + return []string{ + string(SystemShapesExaDbXS), + string(SystemShapesExadataPointXNineM), + string(SystemShapesExadataPointXOneOneM), + } +} + +func (s *SystemShapes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSystemShapes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSystemShapes(input string) (*SystemShapes, error) { + vals := map[string]SystemShapes{ + "exadbxs": SystemShapesExaDbXS, + "exadata.x9m": SystemShapesExadataPointXNineM, + "exadata.x11m": SystemShapesExadataPointXOneOneM, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SystemShapes(input) + return &out, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/giversions/id_giversion.go b/resource-manager/oracledatabase/2025-09-01/giversions/id_giversion.go new file mode 100644 index 00000000000..8661556d4b3 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giversions/id_giversion.go @@ -0,0 +1,130 @@ +package giversions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&GiVersionId{}) +} + +var _ resourceids.ResourceId = &GiVersionId{} + +// GiVersionId is a struct representing the Resource ID for a Gi Version +type GiVersionId struct { + SubscriptionId string + LocationName string + GiVersionName string +} + +// NewGiVersionID returns a new GiVersionId struct +func NewGiVersionID(subscriptionId string, locationName string, giVersionName string) GiVersionId { + return GiVersionId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + GiVersionName: giVersionName, + } +} + +// ParseGiVersionID parses 'input' into a GiVersionId +func ParseGiVersionID(input string) (*GiVersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&GiVersionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := GiVersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseGiVersionIDInsensitively parses 'input' case-insensitively into a GiVersionId +// note: this method should only be used for API response data and not user input +func ParseGiVersionIDInsensitively(input string) (*GiVersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&GiVersionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := GiVersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GiVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.GiVersionName, ok = input.Parsed["giVersionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "giVersionName", input) + } + + return nil +} + +// ValidateGiVersionID checks that 'input' can be parsed as a Gi Version ID +func ValidateGiVersionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseGiVersionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Gi Version ID +func (id GiVersionId) ID() string { + fmtString := "/subscriptions/%s/providers/Oracle.Database/locations/%s/giVersions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.GiVersionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Gi Version ID +func (id GiVersionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticGiVersions", "giVersions", "giVersions"), + resourceids.UserSpecifiedSegment("giVersionName", "giVersionName"), + } +} + +// String returns a human-readable description of this Gi Version ID +func (id GiVersionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Gi Version Name: %q", id.GiVersionName), + } + return fmt.Sprintf("Gi Version (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/giversions/id_giversion_test.go b/resource-manager/oracledatabase/2025-09-01/giversions/id_giversion_test.go new file mode 100644 index 00000000000..1490fd1ac68 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giversions/id_giversion_test.go @@ -0,0 +1,282 @@ +package giversions + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &GiVersionId{} + +func TestNewGiVersionID(t *testing.T) { + id := NewGiVersionID("12345678-1234-9876-4563-123456789012", "locationName", "giVersionName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.GiVersionName != "giVersionName" { + t.Fatalf("Expected %q but got %q for Segment 'GiVersionName'", id.GiVersionName, "giVersionName") + } +} + +func TestFormatGiVersionID(t *testing.T) { + actual := NewGiVersionID("12345678-1234-9876-4563-123456789012", "locationName", "giVersionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions/giVersionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseGiVersionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *GiVersionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions/giVersionName", + Expected: &GiVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + GiVersionName: "giVersionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions/giVersionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseGiVersionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.GiVersionName != v.Expected.GiVersionName { + t.Fatalf("Expected %q but got %q for GiVersionName", v.Expected.GiVersionName, actual.GiVersionName) + } + + } +} + +func TestParseGiVersionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *GiVersionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/gIvErSiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions/giVersionName", + Expected: &GiVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + GiVersionName: "giVersionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/giVersions/giVersionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/gIvErSiOnS/gIvErSiOnNaMe", + Expected: &GiVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + GiVersionName: "gIvErSiOnNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/gIvErSiOnS/gIvErSiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseGiVersionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.GiVersionName != v.Expected.GiVersionName { + t.Fatalf("Expected %q but got %q for GiVersionName", v.Expected.GiVersionName, actual.GiVersionName) + } + + } +} + +func TestSegmentsForGiVersionId(t *testing.T) { + segments := GiVersionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("GiVersionId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/giversions/id_location.go b/resource-manager/oracledatabase/2025-09-01/giversions/id_location.go new file mode 100644 index 00000000000..b69caafd254 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giversions/id_location.go @@ -0,0 +1,121 @@ +package giversions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&LocationId{}) +} + +var _ resourceids.ResourceId = &LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + LocationName string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, locationName string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Oracle.Database/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/giversions/id_location_test.go b/resource-manager/oracledatabase/2025-09-01/giversions/id_location_test.go new file mode 100644 index 00000000000..81c9af4e051 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giversions/id_location_test.go @@ -0,0 +1,237 @@ +package giversions + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &LocationId{} + +func TestNewLocationID(t *testing.T) { + id := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } +} + +func TestFormatLocationID(t *testing.T) { + actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseLocationID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LocationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseLocationID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestParseLocationIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LocationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseLocationIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestSegmentsForLocationId(t *testing.T) { + segments := LocationId{}.Segments() + if len(segments) == 0 { + t.Fatalf("LocationId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/giversions/method_get.go b/resource-manager/oracledatabase/2025-09-01/giversions/method_get.go new file mode 100644 index 00000000000..57e20ced3e6 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giversions/method_get.go @@ -0,0 +1,53 @@ +package giversions + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GiVersion +} + +// Get ... +func (c GiVersionsClient) Get(ctx context.Context, id GiVersionId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model GiVersion + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/giversions/method_listbylocation.go b/resource-manager/oracledatabase/2025-09-01/giversions/method_listbylocation.go new file mode 100644 index 00000000000..1cccccb257d --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giversions/method_listbylocation.go @@ -0,0 +1,142 @@ +package giversions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByLocationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]GiVersion +} + +type ListByLocationCompleteResult struct { + LatestHttpResponse *http.Response + Items []GiVersion +} + +type ListByLocationOperationOptions struct { + Shape *SystemShapes + ShapeAttribute *string + Zone *string +} + +func DefaultListByLocationOperationOptions() ListByLocationOperationOptions { + return ListByLocationOperationOptions{} +} + +func (o ListByLocationOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByLocationOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListByLocationOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Shape != nil { + out.Append("shape", fmt.Sprintf("%v", *o.Shape)) + } + if o.ShapeAttribute != nil { + out.Append("shapeAttribute", fmt.Sprintf("%v", *o.ShapeAttribute)) + } + if o.Zone != nil { + out.Append("zone", fmt.Sprintf("%v", *o.Zone)) + } + return &out +} + +type ListByLocationCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByLocationCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByLocation ... +func (c GiVersionsClient) ListByLocation(ctx context.Context, id LocationId, options ListByLocationOperationOptions) (result ListByLocationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListByLocationCustomPager{}, + Path: fmt.Sprintf("%s/giVersions", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]GiVersion `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByLocationComplete retrieves all the results into a single object +func (c GiVersionsClient) ListByLocationComplete(ctx context.Context, id LocationId, options ListByLocationOperationOptions) (ListByLocationCompleteResult, error) { + return c.ListByLocationCompleteMatchingPredicate(ctx, id, options, GiVersionOperationPredicate{}) +} + +// ListByLocationCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GiVersionsClient) ListByLocationCompleteMatchingPredicate(ctx context.Context, id LocationId, options ListByLocationOperationOptions, predicate GiVersionOperationPredicate) (result ListByLocationCompleteResult, err error) { + items := make([]GiVersion, 0) + + resp, err := c.ListByLocation(ctx, id, options) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByLocationCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/giversions/model_giversion.go b/resource-manager/oracledatabase/2025-09-01/giversions/model_giversion.go new file mode 100644 index 00000000000..a088d6eabc4 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giversions/model_giversion.go @@ -0,0 +1,16 @@ +package giversions + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GiVersion struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *GiVersionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/giversions/model_giversionproperties.go b/resource-manager/oracledatabase/2025-09-01/giversions/model_giversionproperties.go new file mode 100644 index 00000000000..0a54f3aaee2 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giversions/model_giversionproperties.go @@ -0,0 +1,8 @@ +package giversions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GiVersionProperties struct { + Version string `json:"version"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/giversions/predicates.go b/resource-manager/oracledatabase/2025-09-01/giversions/predicates.go new file mode 100644 index 00000000000..1ffcef5ca0e --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giversions/predicates.go @@ -0,0 +1,27 @@ +package giversions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GiVersionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p GiVersionOperationPredicate) Matches(input GiVersion) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/oracledatabase/2025-09-01/giversions/version.go b/resource-manager/oracledatabase/2025-09-01/giversions/version.go new file mode 100644 index 00000000000..49bcb2d94dc --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/giversions/version.go @@ -0,0 +1,10 @@ +package giversions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-09-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/giversions/2025-09-01" +} diff --git a/resource-manager/oracledatabase/2025-09-01/networkanchors/README.md b/resource-manager/oracledatabase/2025-09-01/networkanchors/README.md new file mode 100644 index 00000000000..c9b8b77a957 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/networkanchors/README.md @@ -0,0 +1,117 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/networkanchors` Documentation + +The `networkanchors` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/networkanchors" +``` + + +### Client Initialization + +```go +client := networkanchors.NewNetworkAnchorsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `NetworkAnchorsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := networkanchors.NewNetworkAnchorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "networkAnchorName") + +payload := networkanchors.NetworkAnchor{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `NetworkAnchorsClient.Delete` + +```go +ctx := context.TODO() +id := networkanchors.NewNetworkAnchorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "networkAnchorName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `NetworkAnchorsClient.Get` + +```go +ctx := context.TODO() +id := networkanchors.NewNetworkAnchorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "networkAnchorName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NetworkAnchorsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NetworkAnchorsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NetworkAnchorsClient.Update` + +```go +ctx := context.TODO() +id := networkanchors.NewNetworkAnchorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "networkAnchorName") + +payload := networkanchors.NetworkAnchorUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/networkanchors/client.go b/resource-manager/oracledatabase/2025-09-01/networkanchors/client.go new file mode 100644 index 00000000000..c6092c09774 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/networkanchors/client.go @@ -0,0 +1,26 @@ +package networkanchors + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkAnchorsClient struct { + Client *resourcemanager.Client +} + +func NewNetworkAnchorsClientWithBaseURI(sdkApi sdkEnv.Api) (*NetworkAnchorsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "networkanchors", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating NetworkAnchorsClient: %+v", err) + } + + return &NetworkAnchorsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/networkanchors/constants.go b/resource-manager/oracledatabase/2025-09-01/networkanchors/constants.go new file mode 100644 index 00000000000..30d0fea0442 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/networkanchors/constants.go @@ -0,0 +1,57 @@ +package networkanchors + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureResourceProvisioningState string + +const ( + AzureResourceProvisioningStateCanceled AzureResourceProvisioningState = "Canceled" + AzureResourceProvisioningStateFailed AzureResourceProvisioningState = "Failed" + AzureResourceProvisioningStateProvisioning AzureResourceProvisioningState = "Provisioning" + AzureResourceProvisioningStateSucceeded AzureResourceProvisioningState = "Succeeded" +) + +func PossibleValuesForAzureResourceProvisioningState() []string { + return []string{ + string(AzureResourceProvisioningStateCanceled), + string(AzureResourceProvisioningStateFailed), + string(AzureResourceProvisioningStateProvisioning), + string(AzureResourceProvisioningStateSucceeded), + } +} + +func (s *AzureResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAzureResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAzureResourceProvisioningState(input string) (*AzureResourceProvisioningState, error) { + vals := map[string]AzureResourceProvisioningState{ + "canceled": AzureResourceProvisioningStateCanceled, + "failed": AzureResourceProvisioningStateFailed, + "provisioning": AzureResourceProvisioningStateProvisioning, + "succeeded": AzureResourceProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AzureResourceProvisioningState(input) + return &out, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/networkanchors/id_networkanchor.go b/resource-manager/oracledatabase/2025-09-01/networkanchors/id_networkanchor.go new file mode 100644 index 00000000000..c645f150c4f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/networkanchors/id_networkanchor.go @@ -0,0 +1,130 @@ +package networkanchors + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&NetworkAnchorId{}) +} + +var _ resourceids.ResourceId = &NetworkAnchorId{} + +// NetworkAnchorId is a struct representing the Resource ID for a Network Anchor +type NetworkAnchorId struct { + SubscriptionId string + ResourceGroupName string + NetworkAnchorName string +} + +// NewNetworkAnchorID returns a new NetworkAnchorId struct +func NewNetworkAnchorID(subscriptionId string, resourceGroupName string, networkAnchorName string) NetworkAnchorId { + return NetworkAnchorId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NetworkAnchorName: networkAnchorName, + } +} + +// ParseNetworkAnchorID parses 'input' into a NetworkAnchorId +func ParseNetworkAnchorID(input string) (*NetworkAnchorId, error) { + parser := resourceids.NewParserFromResourceIdType(&NetworkAnchorId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := NetworkAnchorId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseNetworkAnchorIDInsensitively parses 'input' case-insensitively into a NetworkAnchorId +// note: this method should only be used for API response data and not user input +func ParseNetworkAnchorIDInsensitively(input string) (*NetworkAnchorId, error) { + parser := resourceids.NewParserFromResourceIdType(&NetworkAnchorId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := NetworkAnchorId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NetworkAnchorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.NetworkAnchorName, ok = input.Parsed["networkAnchorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkAnchorName", input) + } + + return nil +} + +// ValidateNetworkAnchorID checks that 'input' can be parsed as a Network Anchor ID +func ValidateNetworkAnchorID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNetworkAnchorID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Network Anchor ID +func (id NetworkAnchorId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Oracle.Database/networkAnchors/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetworkAnchorName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Network Anchor ID +func (id NetworkAnchorId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticNetworkAnchors", "networkAnchors", "networkAnchors"), + resourceids.UserSpecifiedSegment("networkAnchorName", "networkAnchorName"), + } +} + +// String returns a human-readable description of this Network Anchor ID +func (id NetworkAnchorId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Network Anchor Name: %q", id.NetworkAnchorName), + } + return fmt.Sprintf("Network Anchor (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/id_vault_test.go b/resource-manager/oracledatabase/2025-09-01/networkanchors/id_networkanchor_test.go similarity index 70% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/id_vault_test.go rename to resource-manager/oracledatabase/2025-09-01/networkanchors/id_networkanchor_test.go index 65fcd52324e..1f5d73769af 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/id_vault_test.go +++ b/resource-manager/oracledatabase/2025-09-01/networkanchors/id_networkanchor_test.go @@ -1,4 +1,4 @@ -package backupprotectioncontainers +package networkanchors import ( "testing" @@ -9,10 +9,10 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -var _ resourceids.ResourceId = &VaultId{} +var _ resourceids.ResourceId = &NetworkAnchorId{} -func TestNewVaultID(t *testing.T) { - id := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") +func TestNewNetworkAnchorID(t *testing.T) { + id := NewNetworkAnchorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "networkAnchorName") if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") @@ -22,24 +22,24 @@ func TestNewVaultID(t *testing.T) { t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") } - if id.VaultName != "vaultName" { - t.Fatalf("Expected %q but got %q for Segment 'VaultName'", id.VaultName, "vaultName") + if id.NetworkAnchorName != "networkAnchorName" { + t.Fatalf("Expected %q but got %q for Segment 'NetworkAnchorName'", id.NetworkAnchorName, "networkAnchorName") } } -func TestFormatVaultID(t *testing.T) { - actual := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName" +func TestFormatNetworkAnchorID(t *testing.T) { + actual := NewNetworkAnchorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "networkAnchorName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/networkAnchors/networkAnchorName" if actual != expected { t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) } } -func TestParseVaultID(t *testing.T) { +func TestParseNetworkAnchorID(t *testing.T) { testData := []struct { Input string Error bool - Expected *VaultId + Expected *NetworkAnchorId }{ { // Incomplete URI @@ -73,33 +73,33 @@ func TestParseVaultID(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/networkAnchors", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Expected: &VaultId{ + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/networkAnchors/networkAnchorName", + Expected: &NetworkAnchorId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroupName: "example-resource-group", - VaultName: "vaultName", + NetworkAnchorName: "networkAnchorName", }, }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/networkAnchors/networkAnchorName/extra", Error: true, }, } for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ParseVaultID(v.Input) + actual, err := ParseNetworkAnchorID(v.Input) if err != nil { if v.Error { continue @@ -119,18 +119,18 @@ func TestParseVaultID(t *testing.T) { t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) } - if actual.VaultName != v.Expected.VaultName { - t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) + if actual.NetworkAnchorName != v.Expected.NetworkAnchorName { + t.Fatalf("Expected %q but got %q for NetworkAnchorName", v.Expected.NetworkAnchorName, actual.NetworkAnchorName) } } } -func TestParseVaultIDInsensitively(t *testing.T) { +func TestParseNetworkAnchorIDInsensitively(t *testing.T) { testData := []struct { Input string Error bool - Expected *VaultId + Expected *NetworkAnchorId }{ { // Incomplete URI @@ -189,57 +189,57 @@ func TestParseVaultIDInsensitively(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/networkAnchors", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/nEtWoRkAnChOrS", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Expected: &VaultId{ + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/networkAnchors/networkAnchorName", + Expected: &NetworkAnchorId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroupName: "example-resource-group", - VaultName: "vaultName", + NetworkAnchorName: "networkAnchorName", }, }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/networkAnchors/networkAnchorName/extra", Error: true, }, { // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe", - Expected: &VaultId{ + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/nEtWoRkAnChOrS/nEtWoRkAnChOrNaMe", + Expected: &NetworkAnchorId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - VaultName: "vAuLtNaMe", + NetworkAnchorName: "nEtWoRkAnChOrNaMe", }, }, { // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/extra", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/nEtWoRkAnChOrS/nEtWoRkAnChOrNaMe/extra", Error: true, }, } for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ParseVaultIDInsensitively(v.Input) + actual, err := ParseNetworkAnchorIDInsensitively(v.Input) if err != nil { if v.Error { continue @@ -259,17 +259,17 @@ func TestParseVaultIDInsensitively(t *testing.T) { t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) } - if actual.VaultName != v.Expected.VaultName { - t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) + if actual.NetworkAnchorName != v.Expected.NetworkAnchorName { + t.Fatalf("Expected %q but got %q for NetworkAnchorName", v.Expected.NetworkAnchorName, actual.NetworkAnchorName) } } } -func TestSegmentsForVaultId(t *testing.T) { - segments := VaultId{}.Segments() +func TestSegmentsForNetworkAnchorId(t *testing.T) { + segments := NetworkAnchorId{}.Segments() if len(segments) == 0 { - t.Fatalf("VaultId has no segments") + t.Fatalf("NetworkAnchorId has no segments") } uniqueNames := make(map[string]struct{}, 0) diff --git a/resource-manager/oracledatabase/2025-09-01/networkanchors/method_createorupdate.go b/resource-manager/oracledatabase/2025-09-01/networkanchors/method_createorupdate.go new file mode 100644 index 00000000000..341533c02cd --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/networkanchors/method_createorupdate.go @@ -0,0 +1,75 @@ +package networkanchors + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *NetworkAnchor +} + +// CreateOrUpdate ... +func (c NetworkAnchorsClient) CreateOrUpdate(ctx context.Context, id NetworkAnchorId, input NetworkAnchor) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c NetworkAnchorsClient) CreateOrUpdateThenPoll(ctx context.Context, id NetworkAnchorId, input NetworkAnchor) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/networkanchors/method_delete.go b/resource-manager/oracledatabase/2025-09-01/networkanchors/method_delete.go new file mode 100644 index 00000000000..0dd3f59c91d --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/networkanchors/method_delete.go @@ -0,0 +1,70 @@ +package networkanchors + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c NetworkAnchorsClient) Delete(ctx context.Context, id NetworkAnchorId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c NetworkAnchorsClient) DeleteThenPoll(ctx context.Context, id NetworkAnchorId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/networkanchors/method_get.go b/resource-manager/oracledatabase/2025-09-01/networkanchors/method_get.go new file mode 100644 index 00000000000..7a423b56efb --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/networkanchors/method_get.go @@ -0,0 +1,53 @@ +package networkanchors + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *NetworkAnchor +} + +// Get ... +func (c NetworkAnchorsClient) Get(ctx context.Context, id NetworkAnchorId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model NetworkAnchor + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/networkanchors/method_listbyresourcegroup.go b/resource-manager/oracledatabase/2025-09-01/networkanchors/method_listbyresourcegroup.go new file mode 100644 index 00000000000..d8f76e8c582 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/networkanchors/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package networkanchors + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]NetworkAnchor +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []NetworkAnchor +} + +type ListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByResourceGroup ... +func (c NetworkAnchorsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Oracle.Database/networkAnchors", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]NetworkAnchor `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c NetworkAnchorsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, NetworkAnchorOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c NetworkAnchorsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate NetworkAnchorOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]NetworkAnchor, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/networkanchors/method_listbysubscription.go b/resource-manager/oracledatabase/2025-09-01/networkanchors/method_listbysubscription.go new file mode 100644 index 00000000000..df98dec3c3f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/networkanchors/method_listbysubscription.go @@ -0,0 +1,106 @@ +package networkanchors + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]NetworkAnchor +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []NetworkAnchor +} + +type ListBySubscriptionCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListBySubscriptionCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListBySubscription ... +func (c NetworkAnchorsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Oracle.Database/networkAnchors", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]NetworkAnchor `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c NetworkAnchorsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, NetworkAnchorOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c NetworkAnchorsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate NetworkAnchorOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]NetworkAnchor, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/networkanchors/method_update.go b/resource-manager/oracledatabase/2025-09-01/networkanchors/method_update.go new file mode 100644 index 00000000000..fcd00cfc40e --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/networkanchors/method_update.go @@ -0,0 +1,75 @@ +package networkanchors + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *NetworkAnchor +} + +// Update ... +func (c NetworkAnchorsClient) Update(ctx context.Context, id NetworkAnchorId, input NetworkAnchorUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c NetworkAnchorsClient) UpdateThenPoll(ctx context.Context, id NetworkAnchorId, input NetworkAnchorUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/networkanchors/model_dnsforwardingrule.go b/resource-manager/oracledatabase/2025-09-01/networkanchors/model_dnsforwardingrule.go new file mode 100644 index 00000000000..beef191307c --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/networkanchors/model_dnsforwardingrule.go @@ -0,0 +1,9 @@ +package networkanchors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnsForwardingRule struct { + DomainNames string `json:"domainNames"` + ForwardingIPAddress string `json:"forwardingIpAddress"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/networkanchors/model_networkanchor.go b/resource-manager/oracledatabase/2025-09-01/networkanchors/model_networkanchor.go new file mode 100644 index 00000000000..ad397b998fc --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/networkanchors/model_networkanchor.go @@ -0,0 +1,20 @@ +package networkanchors + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkAnchor struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *NetworkAnchorProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/networkanchors/model_networkanchorproperties.go b/resource-manager/oracledatabase/2025-09-01/networkanchors/model_networkanchorproperties.go new file mode 100644 index 00000000000..a9192b56658 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/networkanchors/model_networkanchorproperties.go @@ -0,0 +1,26 @@ +package networkanchors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkAnchorProperties struct { + CidrBlock *string `json:"cidrBlock,omitempty"` + DnsForwardingEndpointIPAddress *string `json:"dnsForwardingEndpointIpAddress,omitempty"` + DnsForwardingEndpointNsgRulesURL *string `json:"dnsForwardingEndpointNsgRulesUrl,omitempty"` + DnsForwardingRules *[]DnsForwardingRule `json:"dnsForwardingRules,omitempty"` + DnsForwardingRulesURL *string `json:"dnsForwardingRulesUrl,omitempty"` + DnsListeningEndpointAllowedCidrs *string `json:"dnsListeningEndpointAllowedCidrs,omitempty"` + DnsListeningEndpointIPAddress *string `json:"dnsListeningEndpointIpAddress,omitempty"` + DnsListeningEndpointNsgRulesURL *string `json:"dnsListeningEndpointNsgRulesUrl,omitempty"` + IsOracleDnsForwardingEndpointEnabled *bool `json:"isOracleDnsForwardingEndpointEnabled,omitempty"` + IsOracleDnsListeningEndpointEnabled *bool `json:"isOracleDnsListeningEndpointEnabled,omitempty"` + IsOracleToAzureDnsZoneSyncEnabled *bool `json:"isOracleToAzureDnsZoneSyncEnabled,omitempty"` + OciBackupCidrBlock *string `json:"ociBackupCidrBlock,omitempty"` + OciSubnetId *string `json:"ociSubnetId,omitempty"` + OciVcnDnsLabel *string `json:"ociVcnDnsLabel,omitempty"` + OciVcnId *string `json:"ociVcnId,omitempty"` + ProvisioningState *AzureResourceProvisioningState `json:"provisioningState,omitempty"` + ResourceAnchorId string `json:"resourceAnchorId"` + SubnetId string `json:"subnetId"` + VnetId *string `json:"vnetId,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/networkanchors/model_networkanchorupdate.go b/resource-manager/oracledatabase/2025-09-01/networkanchors/model_networkanchorupdate.go new file mode 100644 index 00000000000..f15260af594 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/networkanchors/model_networkanchorupdate.go @@ -0,0 +1,14 @@ +package networkanchors + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkAnchorUpdate struct { + Properties *NetworkAnchorUpdateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/networkanchors/model_networkanchorupdateproperties.go b/resource-manager/oracledatabase/2025-09-01/networkanchors/model_networkanchorupdateproperties.go new file mode 100644 index 00000000000..089a927d193 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/networkanchors/model_networkanchorupdateproperties.go @@ -0,0 +1,11 @@ +package networkanchors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkAnchorUpdateProperties struct { + IsOracleDnsForwardingEndpointEnabled *bool `json:"isOracleDnsForwardingEndpointEnabled,omitempty"` + IsOracleDnsListeningEndpointEnabled *bool `json:"isOracleDnsListeningEndpointEnabled,omitempty"` + IsOracleToAzureDnsZoneSyncEnabled *bool `json:"isOracleToAzureDnsZoneSyncEnabled,omitempty"` + OciBackupCidrBlock *string `json:"ociBackupCidrBlock,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/networkanchors/predicates.go b/resource-manager/oracledatabase/2025-09-01/networkanchors/predicates.go new file mode 100644 index 00000000000..032da60d910 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/networkanchors/predicates.go @@ -0,0 +1,32 @@ +package networkanchors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkAnchorOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p NetworkAnchorOperationPredicate) Matches(input NetworkAnchor) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/oracledatabase/2025-09-01/networkanchors/version.go b/resource-manager/oracledatabase/2025-09-01/networkanchors/version.go new file mode 100644 index 00000000000..7f800f77fb1 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/networkanchors/version.go @@ -0,0 +1,10 @@ +package networkanchors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-09-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/networkanchors/2025-09-01" +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/README.md b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/README.md new file mode 100644 index 00000000000..8ee271e3d78 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/README.md @@ -0,0 +1,153 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions` Documentation + +The `oraclesubscriptions` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions" +``` + + +### Client Initialization + +```go +client := oraclesubscriptions.NewOracleSubscriptionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `OracleSubscriptionsClient.AddAzureSubscriptions` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +payload := oraclesubscriptions.AzureSubscriptions{ + // ... +} + + +if err := client.AddAzureSubscriptionsThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `OracleSubscriptionsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +payload := oraclesubscriptions.OracleSubscription{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `OracleSubscriptionsClient.Delete` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `OracleSubscriptionsClient.Get` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `OracleSubscriptionsClient.ListActivationLinks` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +if err := client.ListActivationLinksThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `OracleSubscriptionsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `OracleSubscriptionsClient.ListCloudAccountDetails` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +if err := client.ListCloudAccountDetailsThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `OracleSubscriptionsClient.ListSaasSubscriptionDetails` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +if err := client.ListSaasSubscriptionDetailsThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `OracleSubscriptionsClient.Update` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +payload := oraclesubscriptions.OracleSubscriptionUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/client.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/client.go new file mode 100644 index 00000000000..d8c2438e5a2 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/client.go @@ -0,0 +1,26 @@ +package oraclesubscriptions + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OracleSubscriptionsClient struct { + Client *resourcemanager.Client +} + +func NewOracleSubscriptionsClientWithBaseURI(sdkApi sdkEnv.Api) (*OracleSubscriptionsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "oraclesubscriptions", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating OracleSubscriptionsClient: %+v", err) + } + + return &OracleSubscriptionsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/constants.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/constants.go new file mode 100644 index 00000000000..c13ecd3a48e --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/constants.go @@ -0,0 +1,183 @@ +package oraclesubscriptions + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AddSubscriptionOperationState string + +const ( + AddSubscriptionOperationStateFailed AddSubscriptionOperationState = "Failed" + AddSubscriptionOperationStateSucceeded AddSubscriptionOperationState = "Succeeded" + AddSubscriptionOperationStateUpdating AddSubscriptionOperationState = "Updating" +) + +func PossibleValuesForAddSubscriptionOperationState() []string { + return []string{ + string(AddSubscriptionOperationStateFailed), + string(AddSubscriptionOperationStateSucceeded), + string(AddSubscriptionOperationStateUpdating), + } +} + +func (s *AddSubscriptionOperationState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAddSubscriptionOperationState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAddSubscriptionOperationState(input string) (*AddSubscriptionOperationState, error) { + vals := map[string]AddSubscriptionOperationState{ + "failed": AddSubscriptionOperationStateFailed, + "succeeded": AddSubscriptionOperationStateSucceeded, + "updating": AddSubscriptionOperationStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AddSubscriptionOperationState(input) + return &out, nil +} + +type CloudAccountProvisioningState string + +const ( + CloudAccountProvisioningStateAvailable CloudAccountProvisioningState = "Available" + CloudAccountProvisioningStatePending CloudAccountProvisioningState = "Pending" + CloudAccountProvisioningStateProvisioning CloudAccountProvisioningState = "Provisioning" +) + +func PossibleValuesForCloudAccountProvisioningState() []string { + return []string{ + string(CloudAccountProvisioningStateAvailable), + string(CloudAccountProvisioningStatePending), + string(CloudAccountProvisioningStateProvisioning), + } +} + +func (s *CloudAccountProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCloudAccountProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCloudAccountProvisioningState(input string) (*CloudAccountProvisioningState, error) { + vals := map[string]CloudAccountProvisioningState{ + "available": CloudAccountProvisioningStateAvailable, + "pending": CloudAccountProvisioningStatePending, + "provisioning": CloudAccountProvisioningStateProvisioning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CloudAccountProvisioningState(input) + return &out, nil +} + +type Intent string + +const ( + IntentReset Intent = "Reset" + IntentRetain Intent = "Retain" +) + +func PossibleValuesForIntent() []string { + return []string{ + string(IntentReset), + string(IntentRetain), + } +} + +func (s *Intent) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIntent(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIntent(input string) (*Intent, error) { + vals := map[string]Intent{ + "reset": IntentReset, + "retain": IntentRetain, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Intent(input) + return &out, nil +} + +type OracleSubscriptionProvisioningState string + +const ( + OracleSubscriptionProvisioningStateCanceled OracleSubscriptionProvisioningState = "Canceled" + OracleSubscriptionProvisioningStateFailed OracleSubscriptionProvisioningState = "Failed" + OracleSubscriptionProvisioningStateSucceeded OracleSubscriptionProvisioningState = "Succeeded" +) + +func PossibleValuesForOracleSubscriptionProvisioningState() []string { + return []string{ + string(OracleSubscriptionProvisioningStateCanceled), + string(OracleSubscriptionProvisioningStateFailed), + string(OracleSubscriptionProvisioningStateSucceeded), + } +} + +func (s *OracleSubscriptionProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOracleSubscriptionProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOracleSubscriptionProvisioningState(input string) (*OracleSubscriptionProvisioningState, error) { + vals := map[string]OracleSubscriptionProvisioningState{ + "canceled": OracleSubscriptionProvisioningStateCanceled, + "failed": OracleSubscriptionProvisioningStateFailed, + "succeeded": OracleSubscriptionProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OracleSubscriptionProvisioningState(input) + return &out, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_addazuresubscriptions.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_addazuresubscriptions.go new file mode 100644 index 00000000000..8b020812679 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_addazuresubscriptions.go @@ -0,0 +1,74 @@ +package oraclesubscriptions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AddAzureSubscriptionsOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// AddAzureSubscriptions ... +func (c OracleSubscriptionsClient) AddAzureSubscriptions(ctx context.Context, id commonids.SubscriptionId, input AzureSubscriptions) (result AddAzureSubscriptionsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Oracle.Database/oracleSubscriptions/default/addAzureSubscriptions", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// AddAzureSubscriptionsThenPoll performs AddAzureSubscriptions then polls until it's completed +func (c OracleSubscriptionsClient) AddAzureSubscriptionsThenPoll(ctx context.Context, id commonids.SubscriptionId, input AzureSubscriptions) error { + result, err := c.AddAzureSubscriptions(ctx, id, input) + if err != nil { + return fmt.Errorf("performing AddAzureSubscriptions: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AddAzureSubscriptions: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_createorupdate.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_createorupdate.go new file mode 100644 index 00000000000..e40bd87996d --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_createorupdate.go @@ -0,0 +1,76 @@ +package oraclesubscriptions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *OracleSubscription +} + +// CreateOrUpdate ... +func (c OracleSubscriptionsClient) CreateOrUpdate(ctx context.Context, id commonids.SubscriptionId, input OracleSubscription) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/providers/Oracle.Database/oracleSubscriptions/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c OracleSubscriptionsClient) CreateOrUpdateThenPoll(ctx context.Context, id commonids.SubscriptionId, input OracleSubscription) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_delete.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_delete.go new file mode 100644 index 00000000000..3db5d26b956 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_delete.go @@ -0,0 +1,71 @@ +package oraclesubscriptions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c OracleSubscriptionsClient) Delete(ctx context.Context, id commonids.SubscriptionId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/providers/Oracle.Database/oracleSubscriptions/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c OracleSubscriptionsClient) DeleteThenPoll(ctx context.Context, id commonids.SubscriptionId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_get.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_get.go new file mode 100644 index 00000000000..9a0b6985637 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_get.go @@ -0,0 +1,55 @@ +package oraclesubscriptions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OracleSubscription +} + +// Get ... +func (c OracleSubscriptionsClient) Get(ctx context.Context, id commonids.SubscriptionId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Oracle.Database/oracleSubscriptions/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model OracleSubscription + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_listactivationlinks.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_listactivationlinks.go new file mode 100644 index 00000000000..2b8c6c5f589 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_listactivationlinks.go @@ -0,0 +1,72 @@ +package oraclesubscriptions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListActivationLinksOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ActivationLinks +} + +// ListActivationLinks ... +func (c OracleSubscriptionsClient) ListActivationLinks(ctx context.Context, id commonids.SubscriptionId) (result ListActivationLinksOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Oracle.Database/oracleSubscriptions/default/listActivationLinks", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ListActivationLinksThenPoll performs ListActivationLinks then polls until it's completed +func (c OracleSubscriptionsClient) ListActivationLinksThenPoll(ctx context.Context, id commonids.SubscriptionId) error { + result, err := c.ListActivationLinks(ctx, id) + if err != nil { + return fmt.Errorf("performing ListActivationLinks: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ListActivationLinks: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_listbysubscription.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_listbysubscription.go new file mode 100644 index 00000000000..0f79ddbf1f1 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_listbysubscription.go @@ -0,0 +1,106 @@ +package oraclesubscriptions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]OracleSubscription +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []OracleSubscription +} + +type ListBySubscriptionCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListBySubscriptionCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListBySubscription ... +func (c OracleSubscriptionsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Oracle.Database/oracleSubscriptions", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]OracleSubscription `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c OracleSubscriptionsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, OracleSubscriptionOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c OracleSubscriptionsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate OracleSubscriptionOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]OracleSubscription, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_listcloudaccountdetails.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_listcloudaccountdetails.go new file mode 100644 index 00000000000..82e0fe4398f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_listcloudaccountdetails.go @@ -0,0 +1,72 @@ +package oraclesubscriptions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListCloudAccountDetailsOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *CloudAccountDetails +} + +// ListCloudAccountDetails ... +func (c OracleSubscriptionsClient) ListCloudAccountDetails(ctx context.Context, id commonids.SubscriptionId) (result ListCloudAccountDetailsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Oracle.Database/oracleSubscriptions/default/listCloudAccountDetails", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ListCloudAccountDetailsThenPoll performs ListCloudAccountDetails then polls until it's completed +func (c OracleSubscriptionsClient) ListCloudAccountDetailsThenPoll(ctx context.Context, id commonids.SubscriptionId) error { + result, err := c.ListCloudAccountDetails(ctx, id) + if err != nil { + return fmt.Errorf("performing ListCloudAccountDetails: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ListCloudAccountDetails: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_listsaassubscriptiondetails.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_listsaassubscriptiondetails.go new file mode 100644 index 00000000000..38a211cf773 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_listsaassubscriptiondetails.go @@ -0,0 +1,72 @@ +package oraclesubscriptions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSaasSubscriptionDetailsOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *SaasSubscriptionDetails +} + +// ListSaasSubscriptionDetails ... +func (c OracleSubscriptionsClient) ListSaasSubscriptionDetails(ctx context.Context, id commonids.SubscriptionId) (result ListSaasSubscriptionDetailsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Oracle.Database/oracleSubscriptions/default/listSaasSubscriptionDetails", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ListSaasSubscriptionDetailsThenPoll performs ListSaasSubscriptionDetails then polls until it's completed +func (c OracleSubscriptionsClient) ListSaasSubscriptionDetailsThenPoll(ctx context.Context, id commonids.SubscriptionId) error { + result, err := c.ListSaasSubscriptionDetails(ctx, id) + if err != nil { + return fmt.Errorf("performing ListSaasSubscriptionDetails: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ListSaasSubscriptionDetails: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_update.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_update.go new file mode 100644 index 00000000000..d21b8bc8dd5 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/method_update.go @@ -0,0 +1,76 @@ +package oraclesubscriptions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *OracleSubscription +} + +// Update ... +func (c OracleSubscriptionsClient) Update(ctx context.Context, id commonids.SubscriptionId, input OracleSubscriptionUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: fmt.Sprintf("%s/providers/Oracle.Database/oracleSubscriptions/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c OracleSubscriptionsClient) UpdateThenPoll(ctx context.Context, id commonids.SubscriptionId, input OracleSubscriptionUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_activationlinks.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_activationlinks.go new file mode 100644 index 00000000000..45a6005a46b --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_activationlinks.go @@ -0,0 +1,9 @@ +package oraclesubscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ActivationLinks struct { + ExistingCloudAccountActivationLink *string `json:"existingCloudAccountActivationLink,omitempty"` + NewCloudAccountActivationLink *string `json:"newCloudAccountActivationLink,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_azuresubscriptions.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_azuresubscriptions.go new file mode 100644 index 00000000000..d847d9891cb --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_azuresubscriptions.go @@ -0,0 +1,8 @@ +package oraclesubscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureSubscriptions struct { + AzureSubscriptionIds []string `json:"azureSubscriptionIds"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_cloudaccountdetails.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_cloudaccountdetails.go new file mode 100644 index 00000000000..684d25dd96a --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_cloudaccountdetails.go @@ -0,0 +1,9 @@ +package oraclesubscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudAccountDetails struct { + CloudAccountHomeRegion *string `json:"cloudAccountHomeRegion,omitempty"` + CloudAccountName *string `json:"cloudAccountName,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_oraclesubscription.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_oraclesubscription.go new file mode 100644 index 00000000000..f7128fc11f5 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_oraclesubscription.go @@ -0,0 +1,17 @@ +package oraclesubscriptions + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OracleSubscription struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties *OracleSubscriptionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_oraclesubscriptionproperties.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_oraclesubscriptionproperties.go new file mode 100644 index 00000000000..90b625b317c --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_oraclesubscriptionproperties.go @@ -0,0 +1,17 @@ +package oraclesubscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OracleSubscriptionProperties struct { + AddSubscriptionOperationState *AddSubscriptionOperationState `json:"addSubscriptionOperationState,omitempty"` + AzureSubscriptionIds *[]string `json:"azureSubscriptionIds,omitempty"` + CloudAccountId *string `json:"cloudAccountId,omitempty"` + CloudAccountState *CloudAccountProvisioningState `json:"cloudAccountState,omitempty"` + Intent *Intent `json:"intent,omitempty"` + LastOperationStatusDetail *string `json:"lastOperationStatusDetail,omitempty"` + ProductCode *string `json:"productCode,omitempty"` + ProvisioningState *OracleSubscriptionProvisioningState `json:"provisioningState,omitempty"` + SaasSubscriptionId *string `json:"saasSubscriptionId,omitempty"` + TermUnit *string `json:"termUnit,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_oraclesubscriptionupdate.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_oraclesubscriptionupdate.go new file mode 100644 index 00000000000..c95a9cd5426 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_oraclesubscriptionupdate.go @@ -0,0 +1,9 @@ +package oraclesubscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OracleSubscriptionUpdate struct { + Plan *PlanUpdate `json:"plan,omitempty"` + Properties *OracleSubscriptionUpdateProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_oraclesubscriptionupdateproperties.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_oraclesubscriptionupdateproperties.go new file mode 100644 index 00000000000..d60eeb53821 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_oraclesubscriptionupdateproperties.go @@ -0,0 +1,9 @@ +package oraclesubscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OracleSubscriptionUpdateProperties struct { + Intent *Intent `json:"intent,omitempty"` + ProductCode *string `json:"productCode,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_plan.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_plan.go new file mode 100644 index 00000000000..a34f477722e --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_plan.go @@ -0,0 +1,12 @@ +package oraclesubscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Plan struct { + Name string `json:"name"` + Product string `json:"product"` + PromotionCode *string `json:"promotionCode,omitempty"` + Publisher string `json:"publisher"` + Version *string `json:"version,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_planupdate.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_planupdate.go new file mode 100644 index 00000000000..e44262bea92 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_planupdate.go @@ -0,0 +1,12 @@ +package oraclesubscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PlanUpdate struct { + Name *string `json:"name,omitempty"` + Product *string `json:"product,omitempty"` + PromotionCode *string `json:"promotionCode,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_saassubscriptiondetails.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_saassubscriptiondetails.go new file mode 100644 index 00000000000..ac942a9834c --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/model_saassubscriptiondetails.go @@ -0,0 +1,37 @@ +package oraclesubscriptions + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SaasSubscriptionDetails struct { + Id *string `json:"id,omitempty"` + IsAutoRenew *bool `json:"isAutoRenew,omitempty"` + IsFreeTrial *bool `json:"isFreeTrial,omitempty"` + OfferId *string `json:"offerId,omitempty"` + PlanId *string `json:"planId,omitempty"` + PublisherId *string `json:"publisherId,omitempty"` + PurchaserEmailId *string `json:"purchaserEmailId,omitempty"` + PurchaserTenantId *string `json:"purchaserTenantId,omitempty"` + SaasSubscriptionStatus *string `json:"saasSubscriptionStatus,omitempty"` + SubscriptionName *string `json:"subscriptionName,omitempty"` + TermUnit *string `json:"termUnit,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` +} + +func (o *SaasSubscriptionDetails) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *SaasSubscriptionDetails) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/predicates.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/predicates.go new file mode 100644 index 00000000000..c59c4fe93bc --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/predicates.go @@ -0,0 +1,27 @@ +package oraclesubscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OracleSubscriptionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p OracleSubscriptionOperationPredicate) Matches(input OracleSubscription) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/version.go b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/version.go new file mode 100644 index 00000000000..893fe1722af --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/oraclesubscriptions/version.go @@ -0,0 +1,10 @@ +package oraclesubscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-09-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/oraclesubscriptions/2025-09-01" +} diff --git a/resource-manager/oracledatabase/2025-09-01/resourceanchors/README.md b/resource-manager/oracledatabase/2025-09-01/resourceanchors/README.md new file mode 100644 index 00000000000..73357037d91 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/resourceanchors/README.md @@ -0,0 +1,117 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/resourceanchors` Documentation + +The `resourceanchors` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/resourceanchors" +``` + + +### Client Initialization + +```go +client := resourceanchors.NewResourceAnchorsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ResourceAnchorsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := resourceanchors.NewResourceAnchorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceAnchorName") + +payload := resourceanchors.ResourceAnchor{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ResourceAnchorsClient.Delete` + +```go +ctx := context.TODO() +id := resourceanchors.NewResourceAnchorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceAnchorName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ResourceAnchorsClient.Get` + +```go +ctx := context.TODO() +id := resourceanchors.NewResourceAnchorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceAnchorName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ResourceAnchorsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ResourceAnchorsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ResourceAnchorsClient.Update` + +```go +ctx := context.TODO() +id := resourceanchors.NewResourceAnchorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceAnchorName") + +payload := resourceanchors.ResourceAnchorUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/resourceanchors/client.go b/resource-manager/oracledatabase/2025-09-01/resourceanchors/client.go new file mode 100644 index 00000000000..9903497d62d --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/resourceanchors/client.go @@ -0,0 +1,26 @@ +package resourceanchors + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceAnchorsClient struct { + Client *resourcemanager.Client +} + +func NewResourceAnchorsClientWithBaseURI(sdkApi sdkEnv.Api) (*ResourceAnchorsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "resourceanchors", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ResourceAnchorsClient: %+v", err) + } + + return &ResourceAnchorsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/resourceanchors/constants.go b/resource-manager/oracledatabase/2025-09-01/resourceanchors/constants.go new file mode 100644 index 00000000000..81a59c957b8 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/resourceanchors/constants.go @@ -0,0 +1,57 @@ +package resourceanchors + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureResourceProvisioningState string + +const ( + AzureResourceProvisioningStateCanceled AzureResourceProvisioningState = "Canceled" + AzureResourceProvisioningStateFailed AzureResourceProvisioningState = "Failed" + AzureResourceProvisioningStateProvisioning AzureResourceProvisioningState = "Provisioning" + AzureResourceProvisioningStateSucceeded AzureResourceProvisioningState = "Succeeded" +) + +func PossibleValuesForAzureResourceProvisioningState() []string { + return []string{ + string(AzureResourceProvisioningStateCanceled), + string(AzureResourceProvisioningStateFailed), + string(AzureResourceProvisioningStateProvisioning), + string(AzureResourceProvisioningStateSucceeded), + } +} + +func (s *AzureResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAzureResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAzureResourceProvisioningState(input string) (*AzureResourceProvisioningState, error) { + vals := map[string]AzureResourceProvisioningState{ + "canceled": AzureResourceProvisioningStateCanceled, + "failed": AzureResourceProvisioningStateFailed, + "provisioning": AzureResourceProvisioningStateProvisioning, + "succeeded": AzureResourceProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AzureResourceProvisioningState(input) + return &out, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/resourceanchors/id_resourceanchor.go b/resource-manager/oracledatabase/2025-09-01/resourceanchors/id_resourceanchor.go new file mode 100644 index 00000000000..fd3dab56bc5 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/resourceanchors/id_resourceanchor.go @@ -0,0 +1,130 @@ +package resourceanchors + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&ResourceAnchorId{}) +} + +var _ resourceids.ResourceId = &ResourceAnchorId{} + +// ResourceAnchorId is a struct representing the Resource ID for a Resource Anchor +type ResourceAnchorId struct { + SubscriptionId string + ResourceGroupName string + ResourceAnchorName string +} + +// NewResourceAnchorID returns a new ResourceAnchorId struct +func NewResourceAnchorID(subscriptionId string, resourceGroupName string, resourceAnchorName string) ResourceAnchorId { + return ResourceAnchorId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceAnchorName: resourceAnchorName, + } +} + +// ParseResourceAnchorID parses 'input' into a ResourceAnchorId +func ParseResourceAnchorID(input string) (*ResourceAnchorId, error) { + parser := resourceids.NewParserFromResourceIdType(&ResourceAnchorId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ResourceAnchorId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseResourceAnchorIDInsensitively parses 'input' case-insensitively into a ResourceAnchorId +// note: this method should only be used for API response data and not user input +func ParseResourceAnchorIDInsensitively(input string) (*ResourceAnchorId, error) { + parser := resourceids.NewParserFromResourceIdType(&ResourceAnchorId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ResourceAnchorId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ResourceAnchorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.ResourceAnchorName, ok = input.Parsed["resourceAnchorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceAnchorName", input) + } + + return nil +} + +// ValidateResourceAnchorID checks that 'input' can be parsed as a Resource Anchor ID +func ValidateResourceAnchorID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseResourceAnchorID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Resource Anchor ID +func (id ResourceAnchorId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Oracle.Database/resourceAnchors/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceAnchorName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Resource Anchor ID +func (id ResourceAnchorId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticResourceAnchors", "resourceAnchors", "resourceAnchors"), + resourceids.UserSpecifiedSegment("resourceAnchorName", "resourceAnchorName"), + } +} + +// String returns a human-readable description of this Resource Anchor ID +func (id ResourceAnchorId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Resource Anchor Name: %q", id.ResourceAnchorName), + } + return fmt.Sprintf("Resource Anchor (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/resourceanchors/id_resourceanchor_test.go b/resource-manager/oracledatabase/2025-09-01/resourceanchors/id_resourceanchor_test.go new file mode 100644 index 00000000000..199f4bcbfd4 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/resourceanchors/id_resourceanchor_test.go @@ -0,0 +1,282 @@ +package resourceanchors + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ResourceAnchorId{} + +func TestNewResourceAnchorID(t *testing.T) { + id := NewResourceAnchorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceAnchorName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.ResourceAnchorName != "resourceAnchorName" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceAnchorName'", id.ResourceAnchorName, "resourceAnchorName") + } +} + +func TestFormatResourceAnchorID(t *testing.T) { + actual := NewResourceAnchorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceAnchorName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/resourceAnchors/resourceAnchorName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseResourceAnchorID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ResourceAnchorId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/resourceAnchors", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/resourceAnchors/resourceAnchorName", + Expected: &ResourceAnchorId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ResourceAnchorName: "resourceAnchorName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/resourceAnchors/resourceAnchorName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseResourceAnchorID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.ResourceAnchorName != v.Expected.ResourceAnchorName { + t.Fatalf("Expected %q but got %q for ResourceAnchorName", v.Expected.ResourceAnchorName, actual.ResourceAnchorName) + } + + } +} + +func TestParseResourceAnchorIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ResourceAnchorId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/resourceAnchors", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/rEsOuRcEaNcHoRs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/resourceAnchors/resourceAnchorName", + Expected: &ResourceAnchorId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ResourceAnchorName: "resourceAnchorName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/resourceAnchors/resourceAnchorName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/rEsOuRcEaNcHoRs/rEsOuRcEaNcHoRnAmE", + Expected: &ResourceAnchorId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + ResourceAnchorName: "rEsOuRcEaNcHoRnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/rEsOuRcEaNcHoRs/rEsOuRcEaNcHoRnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseResourceAnchorIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.ResourceAnchorName != v.Expected.ResourceAnchorName { + t.Fatalf("Expected %q but got %q for ResourceAnchorName", v.Expected.ResourceAnchorName, actual.ResourceAnchorName) + } + + } +} + +func TestSegmentsForResourceAnchorId(t *testing.T) { + segments := ResourceAnchorId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ResourceAnchorId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/resourceanchors/method_createorupdate.go b/resource-manager/oracledatabase/2025-09-01/resourceanchors/method_createorupdate.go new file mode 100644 index 00000000000..2c7e89a7ea1 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/resourceanchors/method_createorupdate.go @@ -0,0 +1,75 @@ +package resourceanchors + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ResourceAnchor +} + +// CreateOrUpdate ... +func (c ResourceAnchorsClient) CreateOrUpdate(ctx context.Context, id ResourceAnchorId, input ResourceAnchor) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ResourceAnchorsClient) CreateOrUpdateThenPoll(ctx context.Context, id ResourceAnchorId, input ResourceAnchor) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/resourceanchors/method_delete.go b/resource-manager/oracledatabase/2025-09-01/resourceanchors/method_delete.go new file mode 100644 index 00000000000..6a38786a46d --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/resourceanchors/method_delete.go @@ -0,0 +1,70 @@ +package resourceanchors + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c ResourceAnchorsClient) Delete(ctx context.Context, id ResourceAnchorId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ResourceAnchorsClient) DeleteThenPoll(ctx context.Context, id ResourceAnchorId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/resourceanchors/method_get.go b/resource-manager/oracledatabase/2025-09-01/resourceanchors/method_get.go new file mode 100644 index 00000000000..4ece128e440 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/resourceanchors/method_get.go @@ -0,0 +1,53 @@ +package resourceanchors + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ResourceAnchor +} + +// Get ... +func (c ResourceAnchorsClient) Get(ctx context.Context, id ResourceAnchorId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ResourceAnchor + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/resourceanchors/method_listbyresourcegroup.go b/resource-manager/oracledatabase/2025-09-01/resourceanchors/method_listbyresourcegroup.go new file mode 100644 index 00000000000..510648b93e4 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/resourceanchors/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package resourceanchors + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ResourceAnchor +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []ResourceAnchor +} + +type ListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByResourceGroup ... +func (c ResourceAnchorsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Oracle.Database/resourceAnchors", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ResourceAnchor `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c ResourceAnchorsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ResourceAnchorOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ResourceAnchorsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ResourceAnchorOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]ResourceAnchor, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/resourceanchors/method_listbysubscription.go b/resource-manager/oracledatabase/2025-09-01/resourceanchors/method_listbysubscription.go new file mode 100644 index 00000000000..5052208dd04 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/resourceanchors/method_listbysubscription.go @@ -0,0 +1,106 @@ +package resourceanchors + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ResourceAnchor +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []ResourceAnchor +} + +type ListBySubscriptionCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListBySubscriptionCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListBySubscription ... +func (c ResourceAnchorsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Oracle.Database/resourceAnchors", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ResourceAnchor `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c ResourceAnchorsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, ResourceAnchorOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ResourceAnchorsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ResourceAnchorOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]ResourceAnchor, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/resourceanchors/method_update.go b/resource-manager/oracledatabase/2025-09-01/resourceanchors/method_update.go new file mode 100644 index 00000000000..7fbd87577be --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/resourceanchors/method_update.go @@ -0,0 +1,75 @@ +package resourceanchors + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ResourceAnchor +} + +// Update ... +func (c ResourceAnchorsClient) Update(ctx context.Context, id ResourceAnchorId, input ResourceAnchorUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ResourceAnchorsClient) UpdateThenPoll(ctx context.Context, id ResourceAnchorId, input ResourceAnchorUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/resourceanchors/model_resourceanchor.go b/resource-manager/oracledatabase/2025-09-01/resourceanchors/model_resourceanchor.go new file mode 100644 index 00000000000..2f9e5ddfefb --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/resourceanchors/model_resourceanchor.go @@ -0,0 +1,18 @@ +package resourceanchors + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceAnchor struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ResourceAnchorProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/resourceanchors/model_resourceanchorproperties.go b/resource-manager/oracledatabase/2025-09-01/resourceanchors/model_resourceanchorproperties.go new file mode 100644 index 00000000000..4d8ab44d854 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/resourceanchors/model_resourceanchorproperties.go @@ -0,0 +1,9 @@ +package resourceanchors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceAnchorProperties struct { + LinkedCompartmentId *string `json:"linkedCompartmentId,omitempty"` + ProvisioningState *AzureResourceProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/resourceanchors/model_resourceanchorupdate.go b/resource-manager/oracledatabase/2025-09-01/resourceanchors/model_resourceanchorupdate.go new file mode 100644 index 00000000000..dc211a6f7dd --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/resourceanchors/model_resourceanchorupdate.go @@ -0,0 +1,8 @@ +package resourceanchors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceAnchorUpdate struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/resourceanchors/predicates.go b/resource-manager/oracledatabase/2025-09-01/resourceanchors/predicates.go new file mode 100644 index 00000000000..4bc2eca1a6f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/resourceanchors/predicates.go @@ -0,0 +1,32 @@ +package resourceanchors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceAnchorOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ResourceAnchorOperationPredicate) Matches(input ResourceAnchor) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/oracledatabase/2025-09-01/resourceanchors/version.go b/resource-manager/oracledatabase/2025-09-01/resourceanchors/version.go new file mode 100644 index 00000000000..215e1895841 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/resourceanchors/version.go @@ -0,0 +1,10 @@ +package resourceanchors + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-09-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/resourceanchors/2025-09-01" +} diff --git a/resource-manager/oracledatabase/2025-09-01/systemversions/README.md b/resource-manager/oracledatabase/2025-09-01/systemversions/README.md new file mode 100644 index 00000000000..a78d959b08a --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/systemversions/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/systemversions` Documentation + +The `systemversions` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/systemversions" +``` + + +### Client Initialization + +```go +client := systemversions.NewSystemVersionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SystemVersionsClient.Get` + +```go +ctx := context.TODO() +id := systemversions.NewSystemVersionID("12345678-1234-9876-4563-123456789012", "locationName", "systemVersionName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SystemVersionsClient.ListByLocation` + +```go +ctx := context.TODO() +id := systemversions.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +// alternatively `client.ListByLocation(ctx, id)` can be used to do batched pagination +items, err := client.ListByLocationComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/systemversions/client.go b/resource-manager/oracledatabase/2025-09-01/systemversions/client.go new file mode 100644 index 00000000000..d040a83694f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/systemversions/client.go @@ -0,0 +1,26 @@ +package systemversions + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SystemVersionsClient struct { + Client *resourcemanager.Client +} + +func NewSystemVersionsClientWithBaseURI(sdkApi sdkEnv.Api) (*SystemVersionsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "systemversions", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SystemVersionsClient: %+v", err) + } + + return &SystemVersionsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/systemversions/id_location.go b/resource-manager/oracledatabase/2025-09-01/systemversions/id_location.go new file mode 100644 index 00000000000..c56f67cb2c2 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/systemversions/id_location.go @@ -0,0 +1,121 @@ +package systemversions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&LocationId{}) +} + +var _ resourceids.ResourceId = &LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + LocationName string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, locationName string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Oracle.Database/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/systemversions/id_location_test.go b/resource-manager/oracledatabase/2025-09-01/systemversions/id_location_test.go new file mode 100644 index 00000000000..d1aba084163 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/systemversions/id_location_test.go @@ -0,0 +1,237 @@ +package systemversions + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &LocationId{} + +func TestNewLocationID(t *testing.T) { + id := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } +} + +func TestFormatLocationID(t *testing.T) { + actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseLocationID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LocationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseLocationID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestParseLocationIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LocationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseLocationIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestSegmentsForLocationId(t *testing.T) { + segments := LocationId{}.Segments() + if len(segments) == 0 { + t.Fatalf("LocationId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/systemversions/id_systemversion.go b/resource-manager/oracledatabase/2025-09-01/systemversions/id_systemversion.go new file mode 100644 index 00000000000..b28b393451b --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/systemversions/id_systemversion.go @@ -0,0 +1,130 @@ +package systemversions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&SystemVersionId{}) +} + +var _ resourceids.ResourceId = &SystemVersionId{} + +// SystemVersionId is a struct representing the Resource ID for a System Version +type SystemVersionId struct { + SubscriptionId string + LocationName string + SystemVersionName string +} + +// NewSystemVersionID returns a new SystemVersionId struct +func NewSystemVersionID(subscriptionId string, locationName string, systemVersionName string) SystemVersionId { + return SystemVersionId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + SystemVersionName: systemVersionName, + } +} + +// ParseSystemVersionID parses 'input' into a SystemVersionId +func ParseSystemVersionID(input string) (*SystemVersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&SystemVersionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SystemVersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseSystemVersionIDInsensitively parses 'input' case-insensitively into a SystemVersionId +// note: this method should only be used for API response data and not user input +func ParseSystemVersionIDInsensitively(input string) (*SystemVersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&SystemVersionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SystemVersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SystemVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.SystemVersionName, ok = input.Parsed["systemVersionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "systemVersionName", input) + } + + return nil +} + +// ValidateSystemVersionID checks that 'input' can be parsed as a System Version ID +func ValidateSystemVersionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSystemVersionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted System Version ID +func (id SystemVersionId) ID() string { + fmtString := "/subscriptions/%s/providers/Oracle.Database/locations/%s/systemVersions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.SystemVersionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this System Version ID +func (id SystemVersionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticSystemVersions", "systemVersions", "systemVersions"), + resourceids.UserSpecifiedSegment("systemVersionName", "systemVersionName"), + } +} + +// String returns a human-readable description of this System Version ID +func (id SystemVersionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("System Version Name: %q", id.SystemVersionName), + } + return fmt.Sprintf("System Version (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/systemversions/id_systemversion_test.go b/resource-manager/oracledatabase/2025-09-01/systemversions/id_systemversion_test.go new file mode 100644 index 00000000000..6d1f11a4163 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/systemversions/id_systemversion_test.go @@ -0,0 +1,282 @@ +package systemversions + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &SystemVersionId{} + +func TestNewSystemVersionID(t *testing.T) { + id := NewSystemVersionID("12345678-1234-9876-4563-123456789012", "locationName", "systemVersionName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.SystemVersionName != "systemVersionName" { + t.Fatalf("Expected %q but got %q for Segment 'SystemVersionName'", id.SystemVersionName, "systemVersionName") + } +} + +func TestFormatSystemVersionID(t *testing.T) { + actual := NewSystemVersionID("12345678-1234-9876-4563-123456789012", "locationName", "systemVersionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/systemVersions/systemVersionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseSystemVersionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *SystemVersionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/systemVersions", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/systemVersions/systemVersionName", + Expected: &SystemVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + SystemVersionName: "systemVersionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/systemVersions/systemVersionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseSystemVersionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.SystemVersionName != v.Expected.SystemVersionName { + t.Fatalf("Expected %q but got %q for SystemVersionName", v.Expected.SystemVersionName, actual.SystemVersionName) + } + + } +} + +func TestParseSystemVersionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *SystemVersionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/systemVersions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/sYsTeMvErSiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/systemVersions/systemVersionName", + Expected: &SystemVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + SystemVersionName: "systemVersionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Oracle.Database/locations/locationName/systemVersions/systemVersionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/sYsTeMvErSiOnS/sYsTeMvErSiOnNaMe", + Expected: &SystemVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + SystemVersionName: "sYsTeMvErSiOnNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/oRaClE.DaTaBaSe/lOcAtIoNs/lOcAtIoNnAmE/sYsTeMvErSiOnS/sYsTeMvErSiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseSystemVersionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + if actual.SystemVersionName != v.Expected.SystemVersionName { + t.Fatalf("Expected %q but got %q for SystemVersionName", v.Expected.SystemVersionName, actual.SystemVersionName) + } + + } +} + +func TestSegmentsForSystemVersionId(t *testing.T) { + segments := SystemVersionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("SystemVersionId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/systemversions/method_get.go b/resource-manager/oracledatabase/2025-09-01/systemversions/method_get.go new file mode 100644 index 00000000000..5c8b878c570 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/systemversions/method_get.go @@ -0,0 +1,53 @@ +package systemversions + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SystemVersion +} + +// Get ... +func (c SystemVersionsClient) Get(ctx context.Context, id SystemVersionId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model SystemVersion + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/systemversions/method_listbylocation.go b/resource-manager/oracledatabase/2025-09-01/systemversions/method_listbylocation.go new file mode 100644 index 00000000000..f1250239c6d --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/systemversions/method_listbylocation.go @@ -0,0 +1,105 @@ +package systemversions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByLocationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SystemVersion +} + +type ListByLocationCompleteResult struct { + LatestHttpResponse *http.Response + Items []SystemVersion +} + +type ListByLocationCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByLocationCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByLocation ... +func (c SystemVersionsClient) ListByLocation(ctx context.Context, id LocationId) (result ListByLocationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByLocationCustomPager{}, + Path: fmt.Sprintf("%s/systemVersions", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]SystemVersion `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByLocationComplete retrieves all the results into a single object +func (c SystemVersionsClient) ListByLocationComplete(ctx context.Context, id LocationId) (ListByLocationCompleteResult, error) { + return c.ListByLocationCompleteMatchingPredicate(ctx, id, SystemVersionOperationPredicate{}) +} + +// ListByLocationCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SystemVersionsClient) ListByLocationCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate SystemVersionOperationPredicate) (result ListByLocationCompleteResult, err error) { + items := make([]SystemVersion, 0) + + resp, err := c.ListByLocation(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByLocationCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/systemversions/model_systemversion.go b/resource-manager/oracledatabase/2025-09-01/systemversions/model_systemversion.go new file mode 100644 index 00000000000..dc4bb7d6d35 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/systemversions/model_systemversion.go @@ -0,0 +1,16 @@ +package systemversions + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SystemVersion struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SystemVersionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/systemversions/model_systemversionproperties.go b/resource-manager/oracledatabase/2025-09-01/systemversions/model_systemversionproperties.go new file mode 100644 index 00000000000..2684d8672ad --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/systemversions/model_systemversionproperties.go @@ -0,0 +1,8 @@ +package systemversions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SystemVersionProperties struct { + SystemVersion string `json:"systemVersion"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/systemversions/predicates.go b/resource-manager/oracledatabase/2025-09-01/systemversions/predicates.go new file mode 100644 index 00000000000..d2d884b970c --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/systemversions/predicates.go @@ -0,0 +1,27 @@ +package systemversions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SystemVersionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p SystemVersionOperationPredicate) Matches(input SystemVersion) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/oracledatabase/2025-09-01/systemversions/version.go b/resource-manager/oracledatabase/2025-09-01/systemversions/version.go new file mode 100644 index 00000000000..919bb4f7970 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/systemversions/version.go @@ -0,0 +1,10 @@ +package systemversions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-09-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/systemversions/2025-09-01" +} diff --git a/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/README.md b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/README.md new file mode 100644 index 00000000000..7685133adc8 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses` Documentation + +The `virtualnetworkaddresses` SDK allows for interaction with Azure Resource Manager `oracledatabase` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses" +``` + + +### Client Initialization + +```go +client := virtualnetworkaddresses.NewVirtualNetworkAddressesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualNetworkAddressesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualnetworkaddresses.NewVirtualNetworkAddressID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName", "virtualNetworkAddressName") + +payload := virtualnetworkaddresses.VirtualNetworkAddress{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualNetworkAddressesClient.Delete` + +```go +ctx := context.TODO() +id := virtualnetworkaddresses.NewVirtualNetworkAddressID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName", "virtualNetworkAddressName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualNetworkAddressesClient.Get` + +```go +ctx := context.TODO() +id := virtualnetworkaddresses.NewVirtualNetworkAddressID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName", "virtualNetworkAddressName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualNetworkAddressesClient.ListByParent` + +```go +ctx := context.TODO() +id := virtualnetworkaddresses.NewCloudVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName") + +// alternatively `client.ListByParent(ctx, id)` can be used to do batched pagination +items, err := client.ListByParentComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/client.go b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/client.go new file mode 100644 index 00000000000..9255f195dc4 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/client.go @@ -0,0 +1,26 @@ +package virtualnetworkaddresses + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkAddressesClient struct { + Client *resourcemanager.Client +} + +func NewVirtualNetworkAddressesClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualNetworkAddressesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "virtualnetworkaddresses", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualNetworkAddressesClient: %+v", err) + } + + return &VirtualNetworkAddressesClient{ + Client: client, + }, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/constants.go b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/constants.go new file mode 100644 index 00000000000..67d5e6fa561 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/constants.go @@ -0,0 +1,107 @@ +package virtualnetworkaddresses + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureResourceProvisioningState string + +const ( + AzureResourceProvisioningStateCanceled AzureResourceProvisioningState = "Canceled" + AzureResourceProvisioningStateFailed AzureResourceProvisioningState = "Failed" + AzureResourceProvisioningStateProvisioning AzureResourceProvisioningState = "Provisioning" + AzureResourceProvisioningStateSucceeded AzureResourceProvisioningState = "Succeeded" +) + +func PossibleValuesForAzureResourceProvisioningState() []string { + return []string{ + string(AzureResourceProvisioningStateCanceled), + string(AzureResourceProvisioningStateFailed), + string(AzureResourceProvisioningStateProvisioning), + string(AzureResourceProvisioningStateSucceeded), + } +} + +func (s *AzureResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAzureResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAzureResourceProvisioningState(input string) (*AzureResourceProvisioningState, error) { + vals := map[string]AzureResourceProvisioningState{ + "canceled": AzureResourceProvisioningStateCanceled, + "failed": AzureResourceProvisioningStateFailed, + "provisioning": AzureResourceProvisioningStateProvisioning, + "succeeded": AzureResourceProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AzureResourceProvisioningState(input) + return &out, nil +} + +type VirtualNetworkAddressLifecycleState string + +const ( + VirtualNetworkAddressLifecycleStateAvailable VirtualNetworkAddressLifecycleState = "Available" + VirtualNetworkAddressLifecycleStateFailed VirtualNetworkAddressLifecycleState = "Failed" + VirtualNetworkAddressLifecycleStateProvisioning VirtualNetworkAddressLifecycleState = "Provisioning" + VirtualNetworkAddressLifecycleStateTerminated VirtualNetworkAddressLifecycleState = "Terminated" + VirtualNetworkAddressLifecycleStateTerminating VirtualNetworkAddressLifecycleState = "Terminating" +) + +func PossibleValuesForVirtualNetworkAddressLifecycleState() []string { + return []string{ + string(VirtualNetworkAddressLifecycleStateAvailable), + string(VirtualNetworkAddressLifecycleStateFailed), + string(VirtualNetworkAddressLifecycleStateProvisioning), + string(VirtualNetworkAddressLifecycleStateTerminated), + string(VirtualNetworkAddressLifecycleStateTerminating), + } +} + +func (s *VirtualNetworkAddressLifecycleState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualNetworkAddressLifecycleState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualNetworkAddressLifecycleState(input string) (*VirtualNetworkAddressLifecycleState, error) { + vals := map[string]VirtualNetworkAddressLifecycleState{ + "available": VirtualNetworkAddressLifecycleStateAvailable, + "failed": VirtualNetworkAddressLifecycleStateFailed, + "provisioning": VirtualNetworkAddressLifecycleStateProvisioning, + "terminated": VirtualNetworkAddressLifecycleStateTerminated, + "terminating": VirtualNetworkAddressLifecycleStateTerminating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualNetworkAddressLifecycleState(input) + return &out, nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/id_cloudvmcluster.go b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/id_cloudvmcluster.go new file mode 100644 index 00000000000..2d263230224 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/id_cloudvmcluster.go @@ -0,0 +1,130 @@ +package virtualnetworkaddresses + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&CloudVMClusterId{}) +} + +var _ resourceids.ResourceId = &CloudVMClusterId{} + +// CloudVMClusterId is a struct representing the Resource ID for a Cloud VM Cluster +type CloudVMClusterId struct { + SubscriptionId string + ResourceGroupName string + CloudVmClusterName string +} + +// NewCloudVMClusterID returns a new CloudVMClusterId struct +func NewCloudVMClusterID(subscriptionId string, resourceGroupName string, cloudVmClusterName string) CloudVMClusterId { + return CloudVMClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CloudVmClusterName: cloudVmClusterName, + } +} + +// ParseCloudVMClusterID parses 'input' into a CloudVMClusterId +func ParseCloudVMClusterID(input string) (*CloudVMClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(&CloudVMClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CloudVMClusterId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCloudVMClusterIDInsensitively parses 'input' case-insensitively into a CloudVMClusterId +// note: this method should only be used for API response data and not user input +func ParseCloudVMClusterIDInsensitively(input string) (*CloudVMClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(&CloudVMClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CloudVMClusterId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CloudVMClusterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.CloudVmClusterName, ok = input.Parsed["cloudVmClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudVmClusterName", input) + } + + return nil +} + +// ValidateCloudVMClusterID checks that 'input' can be parsed as a Cloud VM Cluster ID +func ValidateCloudVMClusterID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseCloudVMClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cloud VM Cluster ID +func (id CloudVMClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Oracle.Database/cloudVmClusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CloudVmClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cloud VM Cluster ID +func (id CloudVMClusterId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticCloudVmClusters", "cloudVmClusters", "cloudVmClusters"), + resourceids.UserSpecifiedSegment("cloudVmClusterName", "cloudVmClusterName"), + } +} + +// String returns a human-readable description of this Cloud VM Cluster ID +func (id CloudVMClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cloud Vm Cluster Name: %q", id.CloudVmClusterName), + } + return fmt.Sprintf("Cloud VM Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/id_cloudvmcluster_test.go b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/id_cloudvmcluster_test.go new file mode 100644 index 00000000000..f953cf0fa76 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/id_cloudvmcluster_test.go @@ -0,0 +1,282 @@ +package virtualnetworkaddresses + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &CloudVMClusterId{} + +func TestNewCloudVMClusterID(t *testing.T) { + id := NewCloudVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.CloudVmClusterName != "cloudVmClusterName" { + t.Fatalf("Expected %q but got %q for Segment 'CloudVmClusterName'", id.CloudVmClusterName, "cloudVmClusterName") + } +} + +func TestFormatCloudVMClusterID(t *testing.T) { + actual := NewCloudVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseCloudVMClusterID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CloudVMClusterId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName", + Expected: &CloudVMClusterId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CloudVmClusterName: "cloudVmClusterName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCloudVMClusterID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.CloudVmClusterName != v.Expected.CloudVmClusterName { + t.Fatalf("Expected %q but got %q for CloudVmClusterName", v.Expected.CloudVmClusterName, actual.CloudVmClusterName) + } + + } +} + +func TestParseCloudVMClusterIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CloudVMClusterId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdVmClUsTeRs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName", + Expected: &CloudVMClusterId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CloudVmClusterName: "cloudVmClusterName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdVmClUsTeRs/cLoUdVmClUsTeRnAmE", + Expected: &CloudVMClusterId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + CloudVmClusterName: "cLoUdVmClUsTeRnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdVmClUsTeRs/cLoUdVmClUsTeRnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCloudVMClusterIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.CloudVmClusterName != v.Expected.CloudVmClusterName { + t.Fatalf("Expected %q but got %q for CloudVmClusterName", v.Expected.CloudVmClusterName, actual.CloudVmClusterName) + } + + } +} + +func TestSegmentsForCloudVMClusterId(t *testing.T) { + segments := CloudVMClusterId{}.Segments() + if len(segments) == 0 { + t.Fatalf("CloudVMClusterId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/id_virtualnetworkaddress.go b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/id_virtualnetworkaddress.go new file mode 100644 index 00000000000..d2e41ecac8f --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/id_virtualnetworkaddress.go @@ -0,0 +1,139 @@ +package virtualnetworkaddresses + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&VirtualNetworkAddressId{}) +} + +var _ resourceids.ResourceId = &VirtualNetworkAddressId{} + +// VirtualNetworkAddressId is a struct representing the Resource ID for a Virtual Network Address +type VirtualNetworkAddressId struct { + SubscriptionId string + ResourceGroupName string + CloudVmClusterName string + VirtualNetworkAddressName string +} + +// NewVirtualNetworkAddressID returns a new VirtualNetworkAddressId struct +func NewVirtualNetworkAddressID(subscriptionId string, resourceGroupName string, cloudVmClusterName string, virtualNetworkAddressName string) VirtualNetworkAddressId { + return VirtualNetworkAddressId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CloudVmClusterName: cloudVmClusterName, + VirtualNetworkAddressName: virtualNetworkAddressName, + } +} + +// ParseVirtualNetworkAddressID parses 'input' into a VirtualNetworkAddressId +func ParseVirtualNetworkAddressID(input string) (*VirtualNetworkAddressId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualNetworkAddressId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualNetworkAddressId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualNetworkAddressIDInsensitively parses 'input' case-insensitively into a VirtualNetworkAddressId +// note: this method should only be used for API response data and not user input +func ParseVirtualNetworkAddressIDInsensitively(input string) (*VirtualNetworkAddressId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualNetworkAddressId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualNetworkAddressId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkAddressId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.CloudVmClusterName, ok = input.Parsed["cloudVmClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudVmClusterName", input) + } + + if id.VirtualNetworkAddressName, ok = input.Parsed["virtualNetworkAddressName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkAddressName", input) + } + + return nil +} + +// ValidateVirtualNetworkAddressID checks that 'input' can be parsed as a Virtual Network Address ID +func ValidateVirtualNetworkAddressID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVirtualNetworkAddressID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Network Address ID +func (id VirtualNetworkAddressId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Oracle.Database/cloudVmClusters/%s/virtualNetworkAddresses/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CloudVmClusterName, id.VirtualNetworkAddressName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Network Address ID +func (id VirtualNetworkAddressId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticOracleDatabase", "Oracle.Database", "Oracle.Database"), + resourceids.StaticSegment("staticCloudVmClusters", "cloudVmClusters", "cloudVmClusters"), + resourceids.UserSpecifiedSegment("cloudVmClusterName", "cloudVmClusterName"), + resourceids.StaticSegment("staticVirtualNetworkAddresses", "virtualNetworkAddresses", "virtualNetworkAddresses"), + resourceids.UserSpecifiedSegment("virtualNetworkAddressName", "virtualNetworkAddressName"), + } +} + +// String returns a human-readable description of this Virtual Network Address ID +func (id VirtualNetworkAddressId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cloud Vm Cluster Name: %q", id.CloudVmClusterName), + fmt.Sprintf("Virtual Network Address Name: %q", id.VirtualNetworkAddressName), + } + return fmt.Sprintf("Virtual Network Address (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/id_virtualnetworkaddress_test.go b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/id_virtualnetworkaddress_test.go new file mode 100644 index 00000000000..a20d63f2961 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/id_virtualnetworkaddress_test.go @@ -0,0 +1,327 @@ +package virtualnetworkaddresses + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &VirtualNetworkAddressId{} + +func TestNewVirtualNetworkAddressID(t *testing.T) { + id := NewVirtualNetworkAddressID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName", "virtualNetworkAddressName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.CloudVmClusterName != "cloudVmClusterName" { + t.Fatalf("Expected %q but got %q for Segment 'CloudVmClusterName'", id.CloudVmClusterName, "cloudVmClusterName") + } + + if id.VirtualNetworkAddressName != "virtualNetworkAddressName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualNetworkAddressName'", id.VirtualNetworkAddressName, "virtualNetworkAddressName") + } +} + +func TestFormatVirtualNetworkAddressID(t *testing.T) { + actual := NewVirtualNetworkAddressID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterName", "virtualNetworkAddressName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName/virtualNetworkAddresses/virtualNetworkAddressName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualNetworkAddressID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualNetworkAddressId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName/virtualNetworkAddresses", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName/virtualNetworkAddresses/virtualNetworkAddressName", + Expected: &VirtualNetworkAddressId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CloudVmClusterName: "cloudVmClusterName", + VirtualNetworkAddressName: "virtualNetworkAddressName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName/virtualNetworkAddresses/virtualNetworkAddressName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualNetworkAddressID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.CloudVmClusterName != v.Expected.CloudVmClusterName { + t.Fatalf("Expected %q but got %q for CloudVmClusterName", v.Expected.CloudVmClusterName, actual.CloudVmClusterName) + } + + if actual.VirtualNetworkAddressName != v.Expected.VirtualNetworkAddressName { + t.Fatalf("Expected %q but got %q for VirtualNetworkAddressName", v.Expected.VirtualNetworkAddressName, actual.VirtualNetworkAddressName) + } + + } +} + +func TestParseVirtualNetworkAddressIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualNetworkAddressId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdVmClUsTeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdVmClUsTeRs/cLoUdVmClUsTeRnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName/virtualNetworkAddresses", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdVmClUsTeRs/cLoUdVmClUsTeRnAmE/vIrTuAlNeTwOrKaDdReSsEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName/virtualNetworkAddresses/virtualNetworkAddressName", + Expected: &VirtualNetworkAddressId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CloudVmClusterName: "cloudVmClusterName", + VirtualNetworkAddressName: "virtualNetworkAddressName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Oracle.Database/cloudVmClusters/cloudVmClusterName/virtualNetworkAddresses/virtualNetworkAddressName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdVmClUsTeRs/cLoUdVmClUsTeRnAmE/vIrTuAlNeTwOrKaDdReSsEs/vIrTuAlNeTwOrKaDdReSsNaMe", + Expected: &VirtualNetworkAddressId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + CloudVmClusterName: "cLoUdVmClUsTeRnAmE", + VirtualNetworkAddressName: "vIrTuAlNeTwOrKaDdReSsNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/oRaClE.DaTaBaSe/cLoUdVmClUsTeRs/cLoUdVmClUsTeRnAmE/vIrTuAlNeTwOrKaDdReSsEs/vIrTuAlNeTwOrKaDdReSsNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualNetworkAddressIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.CloudVmClusterName != v.Expected.CloudVmClusterName { + t.Fatalf("Expected %q but got %q for CloudVmClusterName", v.Expected.CloudVmClusterName, actual.CloudVmClusterName) + } + + if actual.VirtualNetworkAddressName != v.Expected.VirtualNetworkAddressName { + t.Fatalf("Expected %q but got %q for VirtualNetworkAddressName", v.Expected.VirtualNetworkAddressName, actual.VirtualNetworkAddressName) + } + + } +} + +func TestSegmentsForVirtualNetworkAddressId(t *testing.T) { + segments := VirtualNetworkAddressId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualNetworkAddressId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/method_createorupdate.go b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/method_createorupdate.go new file mode 100644 index 00000000000..dd9d12a988d --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/method_createorupdate.go @@ -0,0 +1,75 @@ +package virtualnetworkaddresses + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualNetworkAddress +} + +// CreateOrUpdate ... +func (c VirtualNetworkAddressesClient) CreateOrUpdate(ctx context.Context, id VirtualNetworkAddressId, input VirtualNetworkAddress) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c VirtualNetworkAddressesClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualNetworkAddressId, input VirtualNetworkAddress) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/method_delete.go b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/method_delete.go new file mode 100644 index 00000000000..0cbd45c9648 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/method_delete.go @@ -0,0 +1,70 @@ +package virtualnetworkaddresses + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c VirtualNetworkAddressesClient) Delete(ctx context.Context, id VirtualNetworkAddressId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VirtualNetworkAddressesClient) DeleteThenPoll(ctx context.Context, id VirtualNetworkAddressId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/method_get.go b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/method_get.go new file mode 100644 index 00000000000..7d79f265d19 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/method_get.go @@ -0,0 +1,53 @@ +package virtualnetworkaddresses + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualNetworkAddress +} + +// Get ... +func (c VirtualNetworkAddressesClient) Get(ctx context.Context, id VirtualNetworkAddressId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model VirtualNetworkAddress + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/method_listbyparent.go b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/method_listbyparent.go new file mode 100644 index 00000000000..5d9d615971a --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/method_listbyparent.go @@ -0,0 +1,105 @@ +package virtualnetworkaddresses + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByParentOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualNetworkAddress +} + +type ListByParentCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualNetworkAddress +} + +type ListByParentCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByParentCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByParent ... +func (c VirtualNetworkAddressesClient) ListByParent(ctx context.Context, id CloudVMClusterId) (result ListByParentOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByParentCustomPager{}, + Path: fmt.Sprintf("%s/virtualNetworkAddresses", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]VirtualNetworkAddress `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByParentComplete retrieves all the results into a single object +func (c VirtualNetworkAddressesClient) ListByParentComplete(ctx context.Context, id CloudVMClusterId) (ListByParentCompleteResult, error) { + return c.ListByParentCompleteMatchingPredicate(ctx, id, VirtualNetworkAddressOperationPredicate{}) +} + +// ListByParentCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualNetworkAddressesClient) ListByParentCompleteMatchingPredicate(ctx context.Context, id CloudVMClusterId, predicate VirtualNetworkAddressOperationPredicate) (result ListByParentCompleteResult, err error) { + items := make([]VirtualNetworkAddress, 0) + + resp, err := c.ListByParent(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByParentCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/model_virtualnetworkaddress.go b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/model_virtualnetworkaddress.go new file mode 100644 index 00000000000..2451c7ae562 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/model_virtualnetworkaddress.go @@ -0,0 +1,16 @@ +package virtualnetworkaddresses + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkAddress struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VirtualNetworkAddressProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/model_virtualnetworkaddressproperties.go b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/model_virtualnetworkaddressproperties.go new file mode 100644 index 00000000000..807d373de87 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/model_virtualnetworkaddressproperties.go @@ -0,0 +1,33 @@ +package virtualnetworkaddresses + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkAddressProperties struct { + Domain *string `json:"domain,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + LifecycleDetails *string `json:"lifecycleDetails,omitempty"` + LifecycleState *VirtualNetworkAddressLifecycleState `json:"lifecycleState,omitempty"` + Ocid *string `json:"ocid,omitempty"` + ProvisioningState *AzureResourceProvisioningState `json:"provisioningState,omitempty"` + TimeAssigned *string `json:"timeAssigned,omitempty"` + VMOcid *string `json:"vmOcid,omitempty"` +} + +func (o *VirtualNetworkAddressProperties) GetTimeAssignedAsTime() (*time.Time, error) { + if o.TimeAssigned == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeAssigned, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualNetworkAddressProperties) SetTimeAssignedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeAssigned = &formatted +} diff --git a/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/predicates.go b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/predicates.go new file mode 100644 index 00000000000..c0416c10a31 --- /dev/null +++ b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/predicates.go @@ -0,0 +1,27 @@ +package virtualnetworkaddresses + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkAddressOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p VirtualNetworkAddressOperationPredicate) Matches(input VirtualNetworkAddress) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/version.go b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/version.go similarity index 57% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/version.go rename to resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/version.go index 56b77c5eb20..ef6921e8433 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/version.go +++ b/resource-manager/oracledatabase/2025-09-01/virtualnetworkaddresses/version.go @@ -1,10 +1,10 @@ -package backupprotectableitems +package virtualnetworkaddresses // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2025-02-01" +const defaultApiVersion = "2025-09-01" func userAgent() string { - return "hashicorp/go-azure-sdk/backupprotectableitems/2025-02-01" + return "hashicorp/go-azure-sdk/virtualnetworkaddresses/2025-09-01" } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupengines/model_backupenginebaseresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupengines/model_backupenginebaseresource.go index 6dff3b7f9a6..1b64e6aeb3c 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupengines/model_backupenginebaseresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/backupengines/model_backupenginebaseresource.go @@ -3,31 +3,35 @@ package backupengines import ( "encoding/json" "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" ) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type BackupEngineBaseResource struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties BackupEngineBase `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties BackupEngineBase `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } var _ json.Unmarshaler = &BackupEngineBaseResource{} func (s *BackupEngineBaseResource) UnmarshalJSON(bytes []byte) error { var decoded struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -37,6 +41,7 @@ func (s *BackupEngineBaseResource) UnmarshalJSON(bytes []byte) error { s.Id = decoded.Id s.Location = decoded.Location s.Name = decoded.Name + s.SystemData = decoded.SystemData s.Tags = decoded.Tags s.Type = decoded.Type diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupjobs/model_jobresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupjobs/model_jobresource.go index fd6239c0f29..2e30de358ac 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupjobs/model_jobresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/backupjobs/model_jobresource.go @@ -3,31 +3,35 @@ package backupjobs import ( "encoding/json" "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" ) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type JobResource struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties Job `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties Job `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } var _ json.Unmarshaler = &JobResource{} func (s *JobResource) UnmarshalJSON(bytes []byte) error { var decoded struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -37,6 +41,7 @@ func (s *JobResource) UnmarshalJSON(bytes []byte) error { s.Id = decoded.Id s.Location = decoded.Location s.Name = decoded.Name + s.SystemData = decoded.SystemData s.Tags = decoded.Tags s.Type = decoded.Type diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backuppolicies/model_protectionpolicyresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/backuppolicies/model_protectionpolicyresource.go index 07eb0540555..ff02acf53a0 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backuppolicies/model_protectionpolicyresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/backuppolicies/model_protectionpolicyresource.go @@ -3,31 +3,35 @@ package backuppolicies import ( "encoding/json" "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" ) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProtectionPolicyResource struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties ProtectionPolicy `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties ProtectionPolicy `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } var _ json.Unmarshaler = &ProtectionPolicyResource{} func (s *ProtectionPolicyResource) UnmarshalJSON(bytes []byte) error { var decoded struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -37,6 +41,7 @@ func (s *ProtectionPolicyResource) UnmarshalJSON(bytes []byte) error { s.Id = decoded.Id s.Location = decoded.Location s.Name = decoded.Name + s.SystemData = decoded.SystemData s.Tags = decoded.Tags s.Type = decoded.Type diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/README.md deleted file mode 100644 index df469c5957c..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems` Documentation - -The `backupprotectableitems` SDK allows for interaction with Azure Resource Manager `recoveryservicesbackup` (API Version `2025-02-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems" -``` - - -### Client Initialization - -```go -client := backupprotectableitems.NewBackupProtectableItemsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `BackupProtectableItemsClient.List` - -```go -ctx := context.TODO() -id := backupprotectableitems.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") - -// alternatively `client.List(ctx, id, backupprotectableitems.DefaultListOperationOptions())` can be used to do batched pagination -items, err := client.ListComplete(ctx, id, backupprotectableitems.DefaultListOperationOptions()) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/constants.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/constants.go deleted file mode 100644 index f26199c385d..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/constants.go +++ /dev/null @@ -1,107 +0,0 @@ -package backupprotectableitems - -import ( - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AzureFileShareType string - -const ( - AzureFileShareTypeInvalid AzureFileShareType = "Invalid" - AzureFileShareTypeXSMB AzureFileShareType = "XSMB" - AzureFileShareTypeXSync AzureFileShareType = "XSync" -) - -func PossibleValuesForAzureFileShareType() []string { - return []string{ - string(AzureFileShareTypeInvalid), - string(AzureFileShareTypeXSMB), - string(AzureFileShareTypeXSync), - } -} - -func parseAzureFileShareType(input string) (*AzureFileShareType, error) { - vals := map[string]AzureFileShareType{ - "invalid": AzureFileShareTypeInvalid, - "xsmb": AzureFileShareTypeXSMB, - "xsync": AzureFileShareTypeXSync, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AzureFileShareType(input) - return &out, nil -} - -type InquiryStatus string - -const ( - InquiryStatusFailed InquiryStatus = "Failed" - InquiryStatusInvalid InquiryStatus = "Invalid" - InquiryStatusSuccess InquiryStatus = "Success" -) - -func PossibleValuesForInquiryStatus() []string { - return []string{ - string(InquiryStatusFailed), - string(InquiryStatusInvalid), - string(InquiryStatusSuccess), - } -} - -func parseInquiryStatus(input string) (*InquiryStatus, error) { - vals := map[string]InquiryStatus{ - "failed": InquiryStatusFailed, - "invalid": InquiryStatusInvalid, - "success": InquiryStatusSuccess, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := InquiryStatus(input) - return &out, nil -} - -type ProtectionStatus string - -const ( - ProtectionStatusInvalid ProtectionStatus = "Invalid" - ProtectionStatusNotProtected ProtectionStatus = "NotProtected" - ProtectionStatusProtected ProtectionStatus = "Protected" - ProtectionStatusProtecting ProtectionStatus = "Protecting" - ProtectionStatusProtectionFailed ProtectionStatus = "ProtectionFailed" -) - -func PossibleValuesForProtectionStatus() []string { - return []string{ - string(ProtectionStatusInvalid), - string(ProtectionStatusNotProtected), - string(ProtectionStatusProtected), - string(ProtectionStatusProtecting), - string(ProtectionStatusProtectionFailed), - } -} - -func parseProtectionStatus(input string) (*ProtectionStatus, error) { - vals := map[string]ProtectionStatus{ - "invalid": ProtectionStatusInvalid, - "notprotected": ProtectionStatusNotProtected, - "protected": ProtectionStatusProtected, - "protecting": ProtectionStatusProtecting, - "protectionfailed": ProtectionStatusProtectionFailed, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProtectionStatus(input) - return &out, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/id_vault.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/id_vault.go deleted file mode 100644 index 852c43e2bad..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/id_vault.go +++ /dev/null @@ -1,130 +0,0 @@ -package backupprotectableitems - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -func init() { - recaser.RegisterResourceId(&VaultId{}) -} - -var _ resourceids.ResourceId = &VaultId{} - -// VaultId is a struct representing the Resource ID for a Vault -type VaultId struct { - SubscriptionId string - ResourceGroupName string - VaultName string -} - -// NewVaultID returns a new VaultId struct -func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { - return VaultId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - VaultName: vaultName, - } -} - -// ParseVaultID parses 'input' into a VaultId -func ParseVaultID(input string) (*VaultId, error) { - parser := resourceids.NewParserFromResourceIdType(&VaultId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VaultId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseVaultIDInsensitively parses 'input' case-insensitively into a VaultId -// note: this method should only be used for API response data and not user input -func ParseVaultIDInsensitively(input string) (*VaultId, error) { - parser := resourceids.NewParserFromResourceIdType(&VaultId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VaultId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *VaultId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) - } - - if id.VaultName, ok = input.Parsed["vaultName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) - } - - return nil -} - -// ValidateVaultID checks that 'input' can be parsed as a Vault ID -func ValidateVaultID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseVaultID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Vault ID -func (id VaultId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Vault ID -func (id VaultId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), - resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("vaultName", "vaultName"), - } -} - -// String returns a human-readable description of this Vault ID -func (id VaultId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Vault Name: %q", id.VaultName), - } - return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/method_list_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/method_list_autorest.go deleted file mode 100644 index 7e33743e477..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/method_list_autorest.go +++ /dev/null @@ -1,215 +0,0 @@ -package backupprotectableitems - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]WorkloadProtectableItemResource - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []WorkloadProtectableItemResource -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListOperationOptions struct { - Filter *string -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - return out -} - -// List ... -func (c BackupProtectableItemsClient) List(ctx context.Context, id VaultId, options ListOperationOptions) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotectableitems.BackupProtectableItemsClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotectableitems.BackupProtectableItemsClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotectableitems.BackupProtectableItemsClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c BackupProtectableItemsClient) preparerForList(ctx context.Context, id VaultId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/backupProtectableItems", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c BackupProtectableItemsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c BackupProtectableItemsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []WorkloadProtectableItemResource `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotectableitems.BackupProtectableItemsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotectableitems.BackupProtectableItemsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotectableitems.BackupProtectableItemsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c BackupProtectableItemsClient) ListComplete(ctx context.Context, id VaultId, options ListOperationOptions) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, options, WorkloadProtectableItemResourceOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c BackupProtectableItemsClient) ListCompleteMatchingPredicate(ctx context.Context, id VaultId, options ListOperationOptions, predicate WorkloadProtectableItemResourceOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]WorkloadProtectableItemResource, 0) - - page, err := c.List(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_distributednodesinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_distributednodesinfo.go deleted file mode 100644 index 6e96dfe461c..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_distributednodesinfo.go +++ /dev/null @@ -1,11 +0,0 @@ -package backupprotectableitems - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DistributedNodesInfo struct { - ErrorDetail *ErrorDetail `json:"errorDetail,omitempty"` - NodeName *string `json:"nodeName,omitempty"` - SourceResourceId *string `json:"sourceResourceId,omitempty"` - Status *string `json:"status,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_errordetail.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_errordetail.go deleted file mode 100644 index 1c3fd85652e..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_errordetail.go +++ /dev/null @@ -1,10 +0,0 @@ -package backupprotectableitems - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ErrorDetail struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Recommendations *[]string `json:"recommendations,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/predicates.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/predicates.go deleted file mode 100644 index 464f22ae33b..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/predicates.go +++ /dev/null @@ -1,37 +0,0 @@ -package backupprotectableitems - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type WorkloadProtectableItemResourceOperationPredicate struct { - ETag *string - Id *string - Location *string - Name *string - Type *string -} - -func (p WorkloadProtectableItemResourceOperationPredicate) Matches(input WorkloadProtectableItemResource) bool { - - if p.ETag != nil && (input.ETag == nil || *p.ETag != *input.ETag) { - return false - } - - if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { - return false - } - - if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { - return false - } - - if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/README.md deleted file mode 100644 index 2cfb2a75ee4..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems` Documentation - -The `backupprotecteditems` SDK allows for interaction with Azure Resource Manager `recoveryservicesbackup` (API Version `2025-02-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems" -``` - - -### Client Initialization - -```go -client := backupprotecteditems.NewBackupProtectedItemsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `BackupProtectedItemsClient.List` - -```go -ctx := context.TODO() -id := backupprotecteditems.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") - -// alternatively `client.List(ctx, id, backupprotecteditems.DefaultListOperationOptions())` can be used to do batched pagination -items, err := client.ListComplete(ctx, id, backupprotecteditems.DefaultListOperationOptions()) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/constants.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/constants.go deleted file mode 100644 index 27b26f2b761..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/constants.go +++ /dev/null @@ -1,389 +0,0 @@ -package backupprotecteditems - -import ( - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BackupManagementType string - -const ( - BackupManagementTypeAzureBackupServer BackupManagementType = "AzureBackupServer" - BackupManagementTypeAzureIaasVM BackupManagementType = "AzureIaasVM" - BackupManagementTypeAzureSql BackupManagementType = "AzureSql" - BackupManagementTypeAzureStorage BackupManagementType = "AzureStorage" - BackupManagementTypeAzureWorkload BackupManagementType = "AzureWorkload" - BackupManagementTypeDPM BackupManagementType = "DPM" - BackupManagementTypeDefaultBackup BackupManagementType = "DefaultBackup" - BackupManagementTypeInvalid BackupManagementType = "Invalid" - BackupManagementTypeMAB BackupManagementType = "MAB" -) - -func PossibleValuesForBackupManagementType() []string { - return []string{ - string(BackupManagementTypeAzureBackupServer), - string(BackupManagementTypeAzureIaasVM), - string(BackupManagementTypeAzureSql), - string(BackupManagementTypeAzureStorage), - string(BackupManagementTypeAzureWorkload), - string(BackupManagementTypeDPM), - string(BackupManagementTypeDefaultBackup), - string(BackupManagementTypeInvalid), - string(BackupManagementTypeMAB), - } -} - -func parseBackupManagementType(input string) (*BackupManagementType, error) { - vals := map[string]BackupManagementType{ - "azurebackupserver": BackupManagementTypeAzureBackupServer, - "azureiaasvm": BackupManagementTypeAzureIaasVM, - "azuresql": BackupManagementTypeAzureSql, - "azurestorage": BackupManagementTypeAzureStorage, - "azureworkload": BackupManagementTypeAzureWorkload, - "dpm": BackupManagementTypeDPM, - "defaultbackup": BackupManagementTypeDefaultBackup, - "invalid": BackupManagementTypeInvalid, - "mab": BackupManagementTypeMAB, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := BackupManagementType(input) - return &out, nil -} - -type CreateMode string - -const ( - CreateModeDefault CreateMode = "Default" - CreateModeInvalid CreateMode = "Invalid" - CreateModeRecover CreateMode = "Recover" -) - -func PossibleValuesForCreateMode() []string { - return []string{ - string(CreateModeDefault), - string(CreateModeInvalid), - string(CreateModeRecover), - } -} - -func parseCreateMode(input string) (*CreateMode, error) { - vals := map[string]CreateMode{ - "default": CreateModeDefault, - "invalid": CreateModeInvalid, - "recover": CreateModeRecover, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CreateMode(input) - return &out, nil -} - -type DataSourceType string - -const ( - DataSourceTypeAzureFileShare DataSourceType = "AzureFileShare" - DataSourceTypeAzureSqlDb DataSourceType = "AzureSqlDb" - DataSourceTypeClient DataSourceType = "Client" - DataSourceTypeExchange DataSourceType = "Exchange" - DataSourceTypeFileFolder DataSourceType = "FileFolder" - DataSourceTypeGenericDataSource DataSourceType = "GenericDataSource" - DataSourceTypeInvalid DataSourceType = "Invalid" - DataSourceTypeSAPAseDatabase DataSourceType = "SAPAseDatabase" - DataSourceTypeSAPHanaDBInstance DataSourceType = "SAPHanaDBInstance" - DataSourceTypeSAPHanaDatabase DataSourceType = "SAPHanaDatabase" - DataSourceTypeSQLDB DataSourceType = "SQLDB" - DataSourceTypeSQLDataBase DataSourceType = "SQLDataBase" - DataSourceTypeSharepoint DataSourceType = "Sharepoint" - DataSourceTypeSystemState DataSourceType = "SystemState" - DataSourceTypeVM DataSourceType = "VM" - DataSourceTypeVMwareVM DataSourceType = "VMwareVM" -) - -func PossibleValuesForDataSourceType() []string { - return []string{ - string(DataSourceTypeAzureFileShare), - string(DataSourceTypeAzureSqlDb), - string(DataSourceTypeClient), - string(DataSourceTypeExchange), - string(DataSourceTypeFileFolder), - string(DataSourceTypeGenericDataSource), - string(DataSourceTypeInvalid), - string(DataSourceTypeSAPAseDatabase), - string(DataSourceTypeSAPHanaDBInstance), - string(DataSourceTypeSAPHanaDatabase), - string(DataSourceTypeSQLDB), - string(DataSourceTypeSQLDataBase), - string(DataSourceTypeSharepoint), - string(DataSourceTypeSystemState), - string(DataSourceTypeVM), - string(DataSourceTypeVMwareVM), - } -} - -func parseDataSourceType(input string) (*DataSourceType, error) { - vals := map[string]DataSourceType{ - "azurefileshare": DataSourceTypeAzureFileShare, - "azuresqldb": DataSourceTypeAzureSqlDb, - "client": DataSourceTypeClient, - "exchange": DataSourceTypeExchange, - "filefolder": DataSourceTypeFileFolder, - "genericdatasource": DataSourceTypeGenericDataSource, - "invalid": DataSourceTypeInvalid, - "sapasedatabase": DataSourceTypeSAPAseDatabase, - "saphanadbinstance": DataSourceTypeSAPHanaDBInstance, - "saphanadatabase": DataSourceTypeSAPHanaDatabase, - "sqldb": DataSourceTypeSQLDB, - "sqldatabase": DataSourceTypeSQLDataBase, - "sharepoint": DataSourceTypeSharepoint, - "systemstate": DataSourceTypeSystemState, - "vm": DataSourceTypeVM, - "vmwarevm": DataSourceTypeVMwareVM, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := DataSourceType(input) - return &out, nil -} - -type HealthStatus string - -const ( - HealthStatusActionRequired HealthStatus = "ActionRequired" - HealthStatusActionSuggested HealthStatus = "ActionSuggested" - HealthStatusInvalid HealthStatus = "Invalid" - HealthStatusPassed HealthStatus = "Passed" -) - -func PossibleValuesForHealthStatus() []string { - return []string{ - string(HealthStatusActionRequired), - string(HealthStatusActionSuggested), - string(HealthStatusInvalid), - string(HealthStatusPassed), - } -} - -func parseHealthStatus(input string) (*HealthStatus, error) { - vals := map[string]HealthStatus{ - "actionrequired": HealthStatusActionRequired, - "actionsuggested": HealthStatusActionSuggested, - "invalid": HealthStatusInvalid, - "passed": HealthStatusPassed, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := HealthStatus(input) - return &out, nil -} - -type LastBackupStatus string - -const ( - LastBackupStatusHealthy LastBackupStatus = "Healthy" - LastBackupStatusIRPending LastBackupStatus = "IRPending" - LastBackupStatusInvalid LastBackupStatus = "Invalid" - LastBackupStatusUnhealthy LastBackupStatus = "Unhealthy" -) - -func PossibleValuesForLastBackupStatus() []string { - return []string{ - string(LastBackupStatusHealthy), - string(LastBackupStatusIRPending), - string(LastBackupStatusInvalid), - string(LastBackupStatusUnhealthy), - } -} - -func parseLastBackupStatus(input string) (*LastBackupStatus, error) { - vals := map[string]LastBackupStatus{ - "healthy": LastBackupStatusHealthy, - "irpending": LastBackupStatusIRPending, - "invalid": LastBackupStatusInvalid, - "unhealthy": LastBackupStatusUnhealthy, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := LastBackupStatus(input) - return &out, nil -} - -type ProtectedItemHealthStatus string - -const ( - ProtectedItemHealthStatusHealthy ProtectedItemHealthStatus = "Healthy" - ProtectedItemHealthStatusIRPending ProtectedItemHealthStatus = "IRPending" - ProtectedItemHealthStatusInvalid ProtectedItemHealthStatus = "Invalid" - ProtectedItemHealthStatusNotReachable ProtectedItemHealthStatus = "NotReachable" - ProtectedItemHealthStatusUnhealthy ProtectedItemHealthStatus = "Unhealthy" -) - -func PossibleValuesForProtectedItemHealthStatus() []string { - return []string{ - string(ProtectedItemHealthStatusHealthy), - string(ProtectedItemHealthStatusIRPending), - string(ProtectedItemHealthStatusInvalid), - string(ProtectedItemHealthStatusNotReachable), - string(ProtectedItemHealthStatusUnhealthy), - } -} - -func parseProtectedItemHealthStatus(input string) (*ProtectedItemHealthStatus, error) { - vals := map[string]ProtectedItemHealthStatus{ - "healthy": ProtectedItemHealthStatusHealthy, - "irpending": ProtectedItemHealthStatusIRPending, - "invalid": ProtectedItemHealthStatusInvalid, - "notreachable": ProtectedItemHealthStatusNotReachable, - "unhealthy": ProtectedItemHealthStatusUnhealthy, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProtectedItemHealthStatus(input) - return &out, nil -} - -type ProtectedItemState string - -const ( - ProtectedItemStateBackupsSuspended ProtectedItemState = "BackupsSuspended" - ProtectedItemStateIRPending ProtectedItemState = "IRPending" - ProtectedItemStateInvalid ProtectedItemState = "Invalid" - ProtectedItemStateProtected ProtectedItemState = "Protected" - ProtectedItemStateProtectionError ProtectedItemState = "ProtectionError" - ProtectedItemStateProtectionPaused ProtectedItemState = "ProtectionPaused" - ProtectedItemStateProtectionStopped ProtectedItemState = "ProtectionStopped" -) - -func PossibleValuesForProtectedItemState() []string { - return []string{ - string(ProtectedItemStateBackupsSuspended), - string(ProtectedItemStateIRPending), - string(ProtectedItemStateInvalid), - string(ProtectedItemStateProtected), - string(ProtectedItemStateProtectionError), - string(ProtectedItemStateProtectionPaused), - string(ProtectedItemStateProtectionStopped), - } -} - -func parseProtectedItemState(input string) (*ProtectedItemState, error) { - vals := map[string]ProtectedItemState{ - "backupssuspended": ProtectedItemStateBackupsSuspended, - "irpending": ProtectedItemStateIRPending, - "invalid": ProtectedItemStateInvalid, - "protected": ProtectedItemStateProtected, - "protectionerror": ProtectedItemStateProtectionError, - "protectionpaused": ProtectedItemStateProtectionPaused, - "protectionstopped": ProtectedItemStateProtectionStopped, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProtectedItemState(input) - return &out, nil -} - -type ProtectionState string - -const ( - ProtectionStateBackupsSuspended ProtectionState = "BackupsSuspended" - ProtectionStateIRPending ProtectionState = "IRPending" - ProtectionStateInvalid ProtectionState = "Invalid" - ProtectionStateProtected ProtectionState = "Protected" - ProtectionStateProtectionError ProtectionState = "ProtectionError" - ProtectionStateProtectionPaused ProtectionState = "ProtectionPaused" - ProtectionStateProtectionStopped ProtectionState = "ProtectionStopped" -) - -func PossibleValuesForProtectionState() []string { - return []string{ - string(ProtectionStateBackupsSuspended), - string(ProtectionStateIRPending), - string(ProtectionStateInvalid), - string(ProtectionStateProtected), - string(ProtectionStateProtectionError), - string(ProtectionStateProtectionPaused), - string(ProtectionStateProtectionStopped), - } -} - -func parseProtectionState(input string) (*ProtectionState, error) { - vals := map[string]ProtectionState{ - "backupssuspended": ProtectionStateBackupsSuspended, - "irpending": ProtectionStateIRPending, - "invalid": ProtectionStateInvalid, - "protected": ProtectionStateProtected, - "protectionerror": ProtectionStateProtectionError, - "protectionpaused": ProtectionStateProtectionPaused, - "protectionstopped": ProtectionStateProtectionStopped, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProtectionState(input) - return &out, nil -} - -type ResourceHealthStatus string - -const ( - ResourceHealthStatusHealthy ResourceHealthStatus = "Healthy" - ResourceHealthStatusInvalid ResourceHealthStatus = "Invalid" - ResourceHealthStatusPersistentDegraded ResourceHealthStatus = "PersistentDegraded" - ResourceHealthStatusPersistentUnhealthy ResourceHealthStatus = "PersistentUnhealthy" - ResourceHealthStatusTransientDegraded ResourceHealthStatus = "TransientDegraded" - ResourceHealthStatusTransientUnhealthy ResourceHealthStatus = "TransientUnhealthy" -) - -func PossibleValuesForResourceHealthStatus() []string { - return []string{ - string(ResourceHealthStatusHealthy), - string(ResourceHealthStatusInvalid), - string(ResourceHealthStatusPersistentDegraded), - string(ResourceHealthStatusPersistentUnhealthy), - string(ResourceHealthStatusTransientDegraded), - string(ResourceHealthStatusTransientUnhealthy), - } -} - -func parseResourceHealthStatus(input string) (*ResourceHealthStatus, error) { - vals := map[string]ResourceHealthStatus{ - "healthy": ResourceHealthStatusHealthy, - "invalid": ResourceHealthStatusInvalid, - "persistentdegraded": ResourceHealthStatusPersistentDegraded, - "persistentunhealthy": ResourceHealthStatusPersistentUnhealthy, - "transientdegraded": ResourceHealthStatusTransientDegraded, - "transientunhealthy": ResourceHealthStatusTransientUnhealthy, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ResourceHealthStatus(input) - return &out, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/id_vault.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/id_vault.go deleted file mode 100644 index 9bab4f55a09..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/id_vault.go +++ /dev/null @@ -1,130 +0,0 @@ -package backupprotecteditems - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -func init() { - recaser.RegisterResourceId(&VaultId{}) -} - -var _ resourceids.ResourceId = &VaultId{} - -// VaultId is a struct representing the Resource ID for a Vault -type VaultId struct { - SubscriptionId string - ResourceGroupName string - VaultName string -} - -// NewVaultID returns a new VaultId struct -func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { - return VaultId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - VaultName: vaultName, - } -} - -// ParseVaultID parses 'input' into a VaultId -func ParseVaultID(input string) (*VaultId, error) { - parser := resourceids.NewParserFromResourceIdType(&VaultId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VaultId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseVaultIDInsensitively parses 'input' case-insensitively into a VaultId -// note: this method should only be used for API response data and not user input -func ParseVaultIDInsensitively(input string) (*VaultId, error) { - parser := resourceids.NewParserFromResourceIdType(&VaultId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VaultId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *VaultId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) - } - - if id.VaultName, ok = input.Parsed["vaultName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) - } - - return nil -} - -// ValidateVaultID checks that 'input' can be parsed as a Vault ID -func ValidateVaultID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseVaultID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Vault ID -func (id VaultId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Vault ID -func (id VaultId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), - resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("vaultName", "vaultName"), - } -} - -// String returns a human-readable description of this Vault ID -func (id VaultId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Vault Name: %q", id.VaultName), - } - return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/method_list_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/method_list_autorest.go deleted file mode 100644 index 5b5c8cd79c1..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/method_list_autorest.go +++ /dev/null @@ -1,215 +0,0 @@ -package backupprotecteditems - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]ProtectedItemResource - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []ProtectedItemResource -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListOperationOptions struct { - Filter *string -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - return out -} - -// List ... -func (c BackupProtectedItemsClient) List(ctx context.Context, id VaultId, options ListOperationOptions) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotecteditems.BackupProtectedItemsClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotecteditems.BackupProtectedItemsClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotecteditems.BackupProtectedItemsClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c BackupProtectedItemsClient) preparerForList(ctx context.Context, id VaultId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/backupProtectedItems", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c BackupProtectedItemsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c BackupProtectedItemsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []ProtectedItemResource `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotecteditems.BackupProtectedItemsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotecteditems.BackupProtectedItemsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotecteditems.BackupProtectedItemsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c BackupProtectedItemsClient) ListComplete(ctx context.Context, id VaultId, options ListOperationOptions) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, options, ProtectedItemResourceOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c BackupProtectedItemsClient) ListCompleteMatchingPredicate(ctx context.Context, id VaultId, options ListOperationOptions, predicate ProtectedItemResourceOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]ProtectedItemResource, 0) - - page, err := c.List(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_errordetail.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_errordetail.go deleted file mode 100644 index c55cc388bf9..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_errordetail.go +++ /dev/null @@ -1,10 +0,0 @@ -package backupprotecteditems - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ErrorDetail struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Recommendations *[]string `json:"recommendations,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/README.md deleted file mode 100644 index 426a8feb379..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers` Documentation - -The `backupprotectioncontainers` SDK allows for interaction with Azure Resource Manager `recoveryservicesbackup` (API Version `2025-02-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers" -``` - - -### Client Initialization - -```go -client := backupprotectioncontainers.NewBackupProtectionContainersClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `BackupProtectionContainersClient.List` - -```go -ctx := context.TODO() -id := backupprotectioncontainers.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") - -// alternatively `client.List(ctx, id, backupprotectioncontainers.DefaultListOperationOptions())` can be used to do batched pagination -items, err := client.ListComplete(ctx, id, backupprotectioncontainers.DefaultListOperationOptions()) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/client.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/client.go deleted file mode 100644 index 80d302c783e..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package backupprotectioncontainers - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BackupProtectionContainersClient struct { - Client autorest.Client - baseUri string -} - -func NewBackupProtectionContainersClientWithBaseURI(endpoint string) BackupProtectionContainersClient { - return BackupProtectionContainersClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/constants.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/constants.go deleted file mode 100644 index 8ba82bb550d..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/constants.go +++ /dev/null @@ -1,335 +0,0 @@ -package backupprotectioncontainers - -import ( - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AcquireStorageAccountLock string - -const ( - AcquireStorageAccountLockAcquire AcquireStorageAccountLock = "Acquire" - AcquireStorageAccountLockNotAcquire AcquireStorageAccountLock = "NotAcquire" -) - -func PossibleValuesForAcquireStorageAccountLock() []string { - return []string{ - string(AcquireStorageAccountLockAcquire), - string(AcquireStorageAccountLockNotAcquire), - } -} - -func parseAcquireStorageAccountLock(input string) (*AcquireStorageAccountLock, error) { - vals := map[string]AcquireStorageAccountLock{ - "acquire": AcquireStorageAccountLockAcquire, - "notacquire": AcquireStorageAccountLockNotAcquire, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AcquireStorageAccountLock(input) - return &out, nil -} - -type BackupItemType string - -const ( - BackupItemTypeAzureFileShare BackupItemType = "AzureFileShare" - BackupItemTypeAzureSqlDb BackupItemType = "AzureSqlDb" - BackupItemTypeClient BackupItemType = "Client" - BackupItemTypeExchange BackupItemType = "Exchange" - BackupItemTypeFileFolder BackupItemType = "FileFolder" - BackupItemTypeGenericDataSource BackupItemType = "GenericDataSource" - BackupItemTypeInvalid BackupItemType = "Invalid" - BackupItemTypeSAPAseDatabase BackupItemType = "SAPAseDatabase" - BackupItemTypeSAPHanaDBInstance BackupItemType = "SAPHanaDBInstance" - BackupItemTypeSAPHanaDatabase BackupItemType = "SAPHanaDatabase" - BackupItemTypeSQLDB BackupItemType = "SQLDB" - BackupItemTypeSQLDataBase BackupItemType = "SQLDataBase" - BackupItemTypeSharepoint BackupItemType = "Sharepoint" - BackupItemTypeSystemState BackupItemType = "SystemState" - BackupItemTypeVM BackupItemType = "VM" - BackupItemTypeVMwareVM BackupItemType = "VMwareVM" -) - -func PossibleValuesForBackupItemType() []string { - return []string{ - string(BackupItemTypeAzureFileShare), - string(BackupItemTypeAzureSqlDb), - string(BackupItemTypeClient), - string(BackupItemTypeExchange), - string(BackupItemTypeFileFolder), - string(BackupItemTypeGenericDataSource), - string(BackupItemTypeInvalid), - string(BackupItemTypeSAPAseDatabase), - string(BackupItemTypeSAPHanaDBInstance), - string(BackupItemTypeSAPHanaDatabase), - string(BackupItemTypeSQLDB), - string(BackupItemTypeSQLDataBase), - string(BackupItemTypeSharepoint), - string(BackupItemTypeSystemState), - string(BackupItemTypeVM), - string(BackupItemTypeVMwareVM), - } -} - -func parseBackupItemType(input string) (*BackupItemType, error) { - vals := map[string]BackupItemType{ - "azurefileshare": BackupItemTypeAzureFileShare, - "azuresqldb": BackupItemTypeAzureSqlDb, - "client": BackupItemTypeClient, - "exchange": BackupItemTypeExchange, - "filefolder": BackupItemTypeFileFolder, - "genericdatasource": BackupItemTypeGenericDataSource, - "invalid": BackupItemTypeInvalid, - "sapasedatabase": BackupItemTypeSAPAseDatabase, - "saphanadbinstance": BackupItemTypeSAPHanaDBInstance, - "saphanadatabase": BackupItemTypeSAPHanaDatabase, - "sqldb": BackupItemTypeSQLDB, - "sqldatabase": BackupItemTypeSQLDataBase, - "sharepoint": BackupItemTypeSharepoint, - "systemstate": BackupItemTypeSystemState, - "vm": BackupItemTypeVM, - "vmwarevm": BackupItemTypeVMwareVM, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := BackupItemType(input) - return &out, nil -} - -type BackupManagementType string - -const ( - BackupManagementTypeAzureBackupServer BackupManagementType = "AzureBackupServer" - BackupManagementTypeAzureIaasVM BackupManagementType = "AzureIaasVM" - BackupManagementTypeAzureSql BackupManagementType = "AzureSql" - BackupManagementTypeAzureStorage BackupManagementType = "AzureStorage" - BackupManagementTypeAzureWorkload BackupManagementType = "AzureWorkload" - BackupManagementTypeDPM BackupManagementType = "DPM" - BackupManagementTypeDefaultBackup BackupManagementType = "DefaultBackup" - BackupManagementTypeInvalid BackupManagementType = "Invalid" - BackupManagementTypeMAB BackupManagementType = "MAB" -) - -func PossibleValuesForBackupManagementType() []string { - return []string{ - string(BackupManagementTypeAzureBackupServer), - string(BackupManagementTypeAzureIaasVM), - string(BackupManagementTypeAzureSql), - string(BackupManagementTypeAzureStorage), - string(BackupManagementTypeAzureWorkload), - string(BackupManagementTypeDPM), - string(BackupManagementTypeDefaultBackup), - string(BackupManagementTypeInvalid), - string(BackupManagementTypeMAB), - } -} - -func parseBackupManagementType(input string) (*BackupManagementType, error) { - vals := map[string]BackupManagementType{ - "azurebackupserver": BackupManagementTypeAzureBackupServer, - "azureiaasvm": BackupManagementTypeAzureIaasVM, - "azuresql": BackupManagementTypeAzureSql, - "azurestorage": BackupManagementTypeAzureStorage, - "azureworkload": BackupManagementTypeAzureWorkload, - "dpm": BackupManagementTypeDPM, - "defaultbackup": BackupManagementTypeDefaultBackup, - "invalid": BackupManagementTypeInvalid, - "mab": BackupManagementTypeMAB, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := BackupManagementType(input) - return &out, nil -} - -type OperationType string - -const ( - OperationTypeInvalid OperationType = "Invalid" - OperationTypeRegister OperationType = "Register" - OperationTypeRehydrate OperationType = "Rehydrate" - OperationTypeReregister OperationType = "Reregister" -) - -func PossibleValuesForOperationType() []string { - return []string{ - string(OperationTypeInvalid), - string(OperationTypeRegister), - string(OperationTypeRehydrate), - string(OperationTypeReregister), - } -} - -func parseOperationType(input string) (*OperationType, error) { - vals := map[string]OperationType{ - "invalid": OperationTypeInvalid, - "register": OperationTypeRegister, - "rehydrate": OperationTypeRehydrate, - "reregister": OperationTypeReregister, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := OperationType(input) - return &out, nil -} - -type ProtectableContainerType string - -const ( - ProtectableContainerTypeAzureBackupServerContainer ProtectableContainerType = "AzureBackupServerContainer" - ProtectableContainerTypeAzureSqlContainer ProtectableContainerType = "AzureSqlContainer" - ProtectableContainerTypeAzureWorkloadContainer ProtectableContainerType = "AzureWorkloadContainer" - ProtectableContainerTypeCluster ProtectableContainerType = "Cluster" - ProtectableContainerTypeDPMContainer ProtectableContainerType = "DPMContainer" - ProtectableContainerTypeGenericContainer ProtectableContainerType = "GenericContainer" - ProtectableContainerTypeIaasVMContainer ProtectableContainerType = "IaasVMContainer" - ProtectableContainerTypeIaasVMServiceContainer ProtectableContainerType = "IaasVMServiceContainer" - ProtectableContainerTypeInvalid ProtectableContainerType = "Invalid" - ProtectableContainerTypeMABContainer ProtectableContainerType = "MABContainer" - ProtectableContainerTypeMicrosoftPointClassicComputeVirtualMachines ProtectableContainerType = "Microsoft.ClassicCompute/virtualMachines" - ProtectableContainerTypeMicrosoftPointComputeVirtualMachines ProtectableContainerType = "Microsoft.Compute/virtualMachines" - ProtectableContainerTypeSQLAGWorkLoadContainer ProtectableContainerType = "SQLAGWorkLoadContainer" - ProtectableContainerTypeStorageContainer ProtectableContainerType = "StorageContainer" - ProtectableContainerTypeUnknown ProtectableContainerType = "Unknown" - ProtectableContainerTypeVCenter ProtectableContainerType = "VCenter" - ProtectableContainerTypeVMAppContainer ProtectableContainerType = "VMAppContainer" - ProtectableContainerTypeWindows ProtectableContainerType = "Windows" -) - -func PossibleValuesForProtectableContainerType() []string { - return []string{ - string(ProtectableContainerTypeAzureBackupServerContainer), - string(ProtectableContainerTypeAzureSqlContainer), - string(ProtectableContainerTypeAzureWorkloadContainer), - string(ProtectableContainerTypeCluster), - string(ProtectableContainerTypeDPMContainer), - string(ProtectableContainerTypeGenericContainer), - string(ProtectableContainerTypeIaasVMContainer), - string(ProtectableContainerTypeIaasVMServiceContainer), - string(ProtectableContainerTypeInvalid), - string(ProtectableContainerTypeMABContainer), - string(ProtectableContainerTypeMicrosoftPointClassicComputeVirtualMachines), - string(ProtectableContainerTypeMicrosoftPointComputeVirtualMachines), - string(ProtectableContainerTypeSQLAGWorkLoadContainer), - string(ProtectableContainerTypeStorageContainer), - string(ProtectableContainerTypeUnknown), - string(ProtectableContainerTypeVCenter), - string(ProtectableContainerTypeVMAppContainer), - string(ProtectableContainerTypeWindows), - } -} - -func parseProtectableContainerType(input string) (*ProtectableContainerType, error) { - vals := map[string]ProtectableContainerType{ - "azurebackupservercontainer": ProtectableContainerTypeAzureBackupServerContainer, - "azuresqlcontainer": ProtectableContainerTypeAzureSqlContainer, - "azureworkloadcontainer": ProtectableContainerTypeAzureWorkloadContainer, - "cluster": ProtectableContainerTypeCluster, - "dpmcontainer": ProtectableContainerTypeDPMContainer, - "genericcontainer": ProtectableContainerTypeGenericContainer, - "iaasvmcontainer": ProtectableContainerTypeIaasVMContainer, - "iaasvmservicecontainer": ProtectableContainerTypeIaasVMServiceContainer, - "invalid": ProtectableContainerTypeInvalid, - "mabcontainer": ProtectableContainerTypeMABContainer, - "microsoft.classiccompute/virtualmachines": ProtectableContainerTypeMicrosoftPointClassicComputeVirtualMachines, - "microsoft.compute/virtualmachines": ProtectableContainerTypeMicrosoftPointComputeVirtualMachines, - "sqlagworkloadcontainer": ProtectableContainerTypeSQLAGWorkLoadContainer, - "storagecontainer": ProtectableContainerTypeStorageContainer, - "unknown": ProtectableContainerTypeUnknown, - "vcenter": ProtectableContainerTypeVCenter, - "vmappcontainer": ProtectableContainerTypeVMAppContainer, - "windows": ProtectableContainerTypeWindows, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProtectableContainerType(input) - return &out, nil -} - -type WorkloadType string - -const ( - WorkloadTypeAzureFileShare WorkloadType = "AzureFileShare" - WorkloadTypeAzureSqlDb WorkloadType = "AzureSqlDb" - WorkloadTypeClient WorkloadType = "Client" - WorkloadTypeExchange WorkloadType = "Exchange" - WorkloadTypeFileFolder WorkloadType = "FileFolder" - WorkloadTypeGenericDataSource WorkloadType = "GenericDataSource" - WorkloadTypeInvalid WorkloadType = "Invalid" - WorkloadTypeSAPAseDatabase WorkloadType = "SAPAseDatabase" - WorkloadTypeSAPHanaDBInstance WorkloadType = "SAPHanaDBInstance" - WorkloadTypeSAPHanaDatabase WorkloadType = "SAPHanaDatabase" - WorkloadTypeSQLDB WorkloadType = "SQLDB" - WorkloadTypeSQLDataBase WorkloadType = "SQLDataBase" - WorkloadTypeSharepoint WorkloadType = "Sharepoint" - WorkloadTypeSystemState WorkloadType = "SystemState" - WorkloadTypeVM WorkloadType = "VM" - WorkloadTypeVMwareVM WorkloadType = "VMwareVM" -) - -func PossibleValuesForWorkloadType() []string { - return []string{ - string(WorkloadTypeAzureFileShare), - string(WorkloadTypeAzureSqlDb), - string(WorkloadTypeClient), - string(WorkloadTypeExchange), - string(WorkloadTypeFileFolder), - string(WorkloadTypeGenericDataSource), - string(WorkloadTypeInvalid), - string(WorkloadTypeSAPAseDatabase), - string(WorkloadTypeSAPHanaDBInstance), - string(WorkloadTypeSAPHanaDatabase), - string(WorkloadTypeSQLDB), - string(WorkloadTypeSQLDataBase), - string(WorkloadTypeSharepoint), - string(WorkloadTypeSystemState), - string(WorkloadTypeVM), - string(WorkloadTypeVMwareVM), - } -} - -func parseWorkloadType(input string) (*WorkloadType, error) { - vals := map[string]WorkloadType{ - "azurefileshare": WorkloadTypeAzureFileShare, - "azuresqldb": WorkloadTypeAzureSqlDb, - "client": WorkloadTypeClient, - "exchange": WorkloadTypeExchange, - "filefolder": WorkloadTypeFileFolder, - "genericdatasource": WorkloadTypeGenericDataSource, - "invalid": WorkloadTypeInvalid, - "sapasedatabase": WorkloadTypeSAPAseDatabase, - "saphanadbinstance": WorkloadTypeSAPHanaDBInstance, - "saphanadatabase": WorkloadTypeSAPHanaDatabase, - "sqldb": WorkloadTypeSQLDB, - "sqldatabase": WorkloadTypeSQLDataBase, - "sharepoint": WorkloadTypeSharepoint, - "systemstate": WorkloadTypeSystemState, - "vm": WorkloadTypeVM, - "vmwarevm": WorkloadTypeVMwareVM, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := WorkloadType(input) - return &out, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/method_list_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/method_list_autorest.go deleted file mode 100644 index 2395d76d2f4..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/method_list_autorest.go +++ /dev/null @@ -1,215 +0,0 @@ -package backupprotectioncontainers - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]ProtectionContainerResource - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []ProtectionContainerResource -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListOperationOptions struct { - Filter *string -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - return out -} - -// List ... -func (c BackupProtectionContainersClient) List(ctx context.Context, id VaultId, options ListOperationOptions) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotectioncontainers.BackupProtectionContainersClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotectioncontainers.BackupProtectionContainersClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotectioncontainers.BackupProtectionContainersClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c BackupProtectionContainersClient) preparerForList(ctx context.Context, id VaultId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/backupProtectionContainers", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c BackupProtectionContainersClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c BackupProtectionContainersClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []ProtectionContainerResource `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotectioncontainers.BackupProtectionContainersClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotectioncontainers.BackupProtectionContainersClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotectioncontainers.BackupProtectionContainersClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c BackupProtectionContainersClient) ListComplete(ctx context.Context, id VaultId, options ListOperationOptions) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, options, ProtectionContainerResourceOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c BackupProtectionContainersClient) ListCompleteMatchingPredicate(ctx context.Context, id VaultId, options ListOperationOptions, predicate ProtectionContainerResourceOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]ProtectionContainerResource, 0) - - page, err := c.List(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azurebackupservercontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azurebackupservercontainer.go deleted file mode 100644 index 5da198a1293..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azurebackupservercontainer.go +++ /dev/null @@ -1,67 +0,0 @@ -package backupprotectioncontainers - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ProtectionContainer = AzureBackupServerContainer{} - -type AzureBackupServerContainer struct { - CanReRegister *bool `json:"canReRegister,omitempty"` - ContainerId *string `json:"containerId,omitempty"` - DpmAgentVersion *string `json:"dpmAgentVersion,omitempty"` - DpmServers *[]string `json:"dpmServers,omitempty"` - ExtendedInfo *DPMContainerExtendedInfo `json:"extendedInfo,omitempty"` - ProtectedItemCount *int64 `json:"protectedItemCount,omitempty"` - ProtectionStatus *string `json:"protectionStatus,omitempty"` - UpgradeAvailable *bool `json:"upgradeAvailable,omitempty"` - - // Fields inherited from ProtectionContainer - - BackupManagementType *BackupManagementType `json:"backupManagementType,omitempty"` - ContainerType ProtectableContainerType `json:"containerType"` - FriendlyName *string `json:"friendlyName,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - ProtectableObjectType *string `json:"protectableObjectType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` -} - -func (s AzureBackupServerContainer) ProtectionContainer() BaseProtectionContainerImpl { - return BaseProtectionContainerImpl{ - BackupManagementType: s.BackupManagementType, - ContainerType: s.ContainerType, - FriendlyName: s.FriendlyName, - HealthStatus: s.HealthStatus, - ProtectableObjectType: s.ProtectableObjectType, - RegistrationStatus: s.RegistrationStatus, - } -} - -var _ json.Marshaler = AzureBackupServerContainer{} - -func (s AzureBackupServerContainer) MarshalJSON() ([]byte, error) { - type wrapper AzureBackupServerContainer - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AzureBackupServerContainer: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AzureBackupServerContainer: %+v", err) - } - - decoded["containerType"] = "AzureBackupServerContainer" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AzureBackupServerContainer: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azureiaasclassiccomputevmcontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azureiaasclassiccomputevmcontainer.go deleted file mode 100644 index aff827df4c1..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azureiaasclassiccomputevmcontainer.go +++ /dev/null @@ -1,62 +0,0 @@ -package backupprotectioncontainers - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ProtectionContainer = AzureIaaSClassicComputeVMContainer{} - -type AzureIaaSClassicComputeVMContainer struct { - ResourceGroup *string `json:"resourceGroup,omitempty"` - VirtualMachineId *string `json:"virtualMachineId,omitempty"` - VirtualMachineVersion *string `json:"virtualMachineVersion,omitempty"` - - // Fields inherited from ProtectionContainer - - BackupManagementType *BackupManagementType `json:"backupManagementType,omitempty"` - ContainerType ProtectableContainerType `json:"containerType"` - FriendlyName *string `json:"friendlyName,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - ProtectableObjectType *string `json:"protectableObjectType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` -} - -func (s AzureIaaSClassicComputeVMContainer) ProtectionContainer() BaseProtectionContainerImpl { - return BaseProtectionContainerImpl{ - BackupManagementType: s.BackupManagementType, - ContainerType: s.ContainerType, - FriendlyName: s.FriendlyName, - HealthStatus: s.HealthStatus, - ProtectableObjectType: s.ProtectableObjectType, - RegistrationStatus: s.RegistrationStatus, - } -} - -var _ json.Marshaler = AzureIaaSClassicComputeVMContainer{} - -func (s AzureIaaSClassicComputeVMContainer) MarshalJSON() ([]byte, error) { - type wrapper AzureIaaSClassicComputeVMContainer - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AzureIaaSClassicComputeVMContainer: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AzureIaaSClassicComputeVMContainer: %+v", err) - } - - decoded["containerType"] = "Microsoft.ClassicCompute/virtualMachines" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AzureIaaSClassicComputeVMContainer: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azureiaascomputevmcontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azureiaascomputevmcontainer.go deleted file mode 100644 index cd56e5eb1bf..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azureiaascomputevmcontainer.go +++ /dev/null @@ -1,62 +0,0 @@ -package backupprotectioncontainers - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ProtectionContainer = AzureIaaSComputeVMContainer{} - -type AzureIaaSComputeVMContainer struct { - ResourceGroup *string `json:"resourceGroup,omitempty"` - VirtualMachineId *string `json:"virtualMachineId,omitempty"` - VirtualMachineVersion *string `json:"virtualMachineVersion,omitempty"` - - // Fields inherited from ProtectionContainer - - BackupManagementType *BackupManagementType `json:"backupManagementType,omitempty"` - ContainerType ProtectableContainerType `json:"containerType"` - FriendlyName *string `json:"friendlyName,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - ProtectableObjectType *string `json:"protectableObjectType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` -} - -func (s AzureIaaSComputeVMContainer) ProtectionContainer() BaseProtectionContainerImpl { - return BaseProtectionContainerImpl{ - BackupManagementType: s.BackupManagementType, - ContainerType: s.ContainerType, - FriendlyName: s.FriendlyName, - HealthStatus: s.HealthStatus, - ProtectableObjectType: s.ProtectableObjectType, - RegistrationStatus: s.RegistrationStatus, - } -} - -var _ json.Marshaler = AzureIaaSComputeVMContainer{} - -func (s AzureIaaSComputeVMContainer) MarshalJSON() ([]byte, error) { - type wrapper AzureIaaSComputeVMContainer - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AzureIaaSComputeVMContainer: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AzureIaaSComputeVMContainer: %+v", err) - } - - decoded["containerType"] = "Microsoft.Compute/virtualMachines" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AzureIaaSComputeVMContainer: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azuresqlagworkloadcontainerprotectioncontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azuresqlagworkloadcontainerprotectioncontainer.go deleted file mode 100644 index ed722014f5c..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azuresqlagworkloadcontainerprotectioncontainer.go +++ /dev/null @@ -1,64 +0,0 @@ -package backupprotectioncontainers - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ProtectionContainer = AzureSQLAGWorkloadContainerProtectionContainer{} - -type AzureSQLAGWorkloadContainerProtectionContainer struct { - ExtendedInfo *AzureWorkloadContainerExtendedInfo `json:"extendedInfo,omitempty"` - LastUpdatedTime *string `json:"lastUpdatedTime,omitempty"` - OperationType *OperationType `json:"operationType,omitempty"` - SourceResourceId *string `json:"sourceResourceId,omitempty"` - WorkloadType *WorkloadType `json:"workloadType,omitempty"` - - // Fields inherited from ProtectionContainer - - BackupManagementType *BackupManagementType `json:"backupManagementType,omitempty"` - ContainerType ProtectableContainerType `json:"containerType"` - FriendlyName *string `json:"friendlyName,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - ProtectableObjectType *string `json:"protectableObjectType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` -} - -func (s AzureSQLAGWorkloadContainerProtectionContainer) ProtectionContainer() BaseProtectionContainerImpl { - return BaseProtectionContainerImpl{ - BackupManagementType: s.BackupManagementType, - ContainerType: s.ContainerType, - FriendlyName: s.FriendlyName, - HealthStatus: s.HealthStatus, - ProtectableObjectType: s.ProtectableObjectType, - RegistrationStatus: s.RegistrationStatus, - } -} - -var _ json.Marshaler = AzureSQLAGWorkloadContainerProtectionContainer{} - -func (s AzureSQLAGWorkloadContainerProtectionContainer) MarshalJSON() ([]byte, error) { - type wrapper AzureSQLAGWorkloadContainerProtectionContainer - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AzureSQLAGWorkloadContainerProtectionContainer: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AzureSQLAGWorkloadContainerProtectionContainer: %+v", err) - } - - decoded["containerType"] = "SQLAGWorkLoadContainer" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AzureSQLAGWorkloadContainerProtectionContainer: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azuresqlcontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azuresqlcontainer.go deleted file mode 100644 index 2bd62aa48a1..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azuresqlcontainer.go +++ /dev/null @@ -1,59 +0,0 @@ -package backupprotectioncontainers - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ProtectionContainer = AzureSqlContainer{} - -type AzureSqlContainer struct { - - // Fields inherited from ProtectionContainer - - BackupManagementType *BackupManagementType `json:"backupManagementType,omitempty"` - ContainerType ProtectableContainerType `json:"containerType"` - FriendlyName *string `json:"friendlyName,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - ProtectableObjectType *string `json:"protectableObjectType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` -} - -func (s AzureSqlContainer) ProtectionContainer() BaseProtectionContainerImpl { - return BaseProtectionContainerImpl{ - BackupManagementType: s.BackupManagementType, - ContainerType: s.ContainerType, - FriendlyName: s.FriendlyName, - HealthStatus: s.HealthStatus, - ProtectableObjectType: s.ProtectableObjectType, - RegistrationStatus: s.RegistrationStatus, - } -} - -var _ json.Marshaler = AzureSqlContainer{} - -func (s AzureSqlContainer) MarshalJSON() ([]byte, error) { - type wrapper AzureSqlContainer - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AzureSqlContainer: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AzureSqlContainer: %+v", err) - } - - decoded["containerType"] = "AzureSqlContainer" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AzureSqlContainer: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azurestoragecontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azurestoragecontainer.go deleted file mode 100644 index 8d92c7777af..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azurestoragecontainer.go +++ /dev/null @@ -1,65 +0,0 @@ -package backupprotectioncontainers - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ProtectionContainer = AzureStorageContainer{} - -type AzureStorageContainer struct { - AcquireStorageAccountLock *AcquireStorageAccountLock `json:"acquireStorageAccountLock,omitempty"` - OperationType *OperationType `json:"operationType,omitempty"` - ProtectedItemCount *int64 `json:"protectedItemCount,omitempty"` - ResourceGroup *string `json:"resourceGroup,omitempty"` - SourceResourceId *string `json:"sourceResourceId,omitempty"` - StorageAccountVersion *string `json:"storageAccountVersion,omitempty"` - - // Fields inherited from ProtectionContainer - - BackupManagementType *BackupManagementType `json:"backupManagementType,omitempty"` - ContainerType ProtectableContainerType `json:"containerType"` - FriendlyName *string `json:"friendlyName,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - ProtectableObjectType *string `json:"protectableObjectType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` -} - -func (s AzureStorageContainer) ProtectionContainer() BaseProtectionContainerImpl { - return BaseProtectionContainerImpl{ - BackupManagementType: s.BackupManagementType, - ContainerType: s.ContainerType, - FriendlyName: s.FriendlyName, - HealthStatus: s.HealthStatus, - ProtectableObjectType: s.ProtectableObjectType, - RegistrationStatus: s.RegistrationStatus, - } -} - -var _ json.Marshaler = AzureStorageContainer{} - -func (s AzureStorageContainer) MarshalJSON() ([]byte, error) { - type wrapper AzureStorageContainer - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AzureStorageContainer: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AzureStorageContainer: %+v", err) - } - - decoded["containerType"] = "StorageContainer" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AzureStorageContainer: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azurevmappcontainerprotectioncontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azurevmappcontainerprotectioncontainer.go deleted file mode 100644 index 6e223755784..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azurevmappcontainerprotectioncontainer.go +++ /dev/null @@ -1,64 +0,0 @@ -package backupprotectioncontainers - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ProtectionContainer = AzureVMAppContainerProtectionContainer{} - -type AzureVMAppContainerProtectionContainer struct { - ExtendedInfo *AzureWorkloadContainerExtendedInfo `json:"extendedInfo,omitempty"` - LastUpdatedTime *string `json:"lastUpdatedTime,omitempty"` - OperationType *OperationType `json:"operationType,omitempty"` - SourceResourceId *string `json:"sourceResourceId,omitempty"` - WorkloadType *WorkloadType `json:"workloadType,omitempty"` - - // Fields inherited from ProtectionContainer - - BackupManagementType *BackupManagementType `json:"backupManagementType,omitempty"` - ContainerType ProtectableContainerType `json:"containerType"` - FriendlyName *string `json:"friendlyName,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - ProtectableObjectType *string `json:"protectableObjectType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` -} - -func (s AzureVMAppContainerProtectionContainer) ProtectionContainer() BaseProtectionContainerImpl { - return BaseProtectionContainerImpl{ - BackupManagementType: s.BackupManagementType, - ContainerType: s.ContainerType, - FriendlyName: s.FriendlyName, - HealthStatus: s.HealthStatus, - ProtectableObjectType: s.ProtectableObjectType, - RegistrationStatus: s.RegistrationStatus, - } -} - -var _ json.Marshaler = AzureVMAppContainerProtectionContainer{} - -func (s AzureVMAppContainerProtectionContainer) MarshalJSON() ([]byte, error) { - type wrapper AzureVMAppContainerProtectionContainer - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AzureVMAppContainerProtectionContainer: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AzureVMAppContainerProtectionContainer: %+v", err) - } - - decoded["containerType"] = "VMAppContainer" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AzureVMAppContainerProtectionContainer: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azureworkloadcontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azureworkloadcontainer.go deleted file mode 100644 index e540df3877b..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azureworkloadcontainer.go +++ /dev/null @@ -1,64 +0,0 @@ -package backupprotectioncontainers - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ProtectionContainer = AzureWorkloadContainer{} - -type AzureWorkloadContainer struct { - ExtendedInfo *AzureWorkloadContainerExtendedInfo `json:"extendedInfo,omitempty"` - LastUpdatedTime *string `json:"lastUpdatedTime,omitempty"` - OperationType *OperationType `json:"operationType,omitempty"` - SourceResourceId *string `json:"sourceResourceId,omitempty"` - WorkloadType *WorkloadType `json:"workloadType,omitempty"` - - // Fields inherited from ProtectionContainer - - BackupManagementType *BackupManagementType `json:"backupManagementType,omitempty"` - ContainerType ProtectableContainerType `json:"containerType"` - FriendlyName *string `json:"friendlyName,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - ProtectableObjectType *string `json:"protectableObjectType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` -} - -func (s AzureWorkloadContainer) ProtectionContainer() BaseProtectionContainerImpl { - return BaseProtectionContainerImpl{ - BackupManagementType: s.BackupManagementType, - ContainerType: s.ContainerType, - FriendlyName: s.FriendlyName, - HealthStatus: s.HealthStatus, - ProtectableObjectType: s.ProtectableObjectType, - RegistrationStatus: s.RegistrationStatus, - } -} - -var _ json.Marshaler = AzureWorkloadContainer{} - -func (s AzureWorkloadContainer) MarshalJSON() ([]byte, error) { - type wrapper AzureWorkloadContainer - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AzureWorkloadContainer: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AzureWorkloadContainer: %+v", err) - } - - decoded["containerType"] = "AzureWorkloadContainer" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AzureWorkloadContainer: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azureworkloadcontainerextendedinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azureworkloadcontainerextendedinfo.go deleted file mode 100644 index 4e6205329b2..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_azureworkloadcontainerextendedinfo.go +++ /dev/null @@ -1,10 +0,0 @@ -package backupprotectioncontainers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AzureWorkloadContainerExtendedInfo struct { - HostServerName *string `json:"hostServerName,omitempty"` - InquiryInfo *InquiryInfo `json:"inquiryInfo,omitempty"` - NodesList *[]DistributedNodesInfo `json:"nodesList,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_containeridentityinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_containeridentityinfo.go deleted file mode 100644 index 8cff0e16315..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_containeridentityinfo.go +++ /dev/null @@ -1,11 +0,0 @@ -package backupprotectioncontainers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ContainerIdentityInfo struct { - AadTenantId *string `json:"aadTenantId,omitempty"` - Audience *string `json:"audience,omitempty"` - ServicePrincipalClientId *string `json:"servicePrincipalClientId,omitempty"` - UniqueName *string `json:"uniqueName,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_distributednodesinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_distributednodesinfo.go deleted file mode 100644 index 88d6fe5dcf8..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_distributednodesinfo.go +++ /dev/null @@ -1,11 +0,0 @@ -package backupprotectioncontainers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DistributedNodesInfo struct { - ErrorDetail *ErrorDetail `json:"errorDetail,omitempty"` - NodeName *string `json:"nodeName,omitempty"` - SourceResourceId *string `json:"sourceResourceId,omitempty"` - Status *string `json:"status,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_dpmcontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_dpmcontainer.go deleted file mode 100644 index b344dd4102f..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_dpmcontainer.go +++ /dev/null @@ -1,67 +0,0 @@ -package backupprotectioncontainers - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ProtectionContainer = DpmContainer{} - -type DpmContainer struct { - CanReRegister *bool `json:"canReRegister,omitempty"` - ContainerId *string `json:"containerId,omitempty"` - DpmAgentVersion *string `json:"dpmAgentVersion,omitempty"` - DpmServers *[]string `json:"dpmServers,omitempty"` - ExtendedInfo *DPMContainerExtendedInfo `json:"extendedInfo,omitempty"` - ProtectedItemCount *int64 `json:"protectedItemCount,omitempty"` - ProtectionStatus *string `json:"protectionStatus,omitempty"` - UpgradeAvailable *bool `json:"upgradeAvailable,omitempty"` - - // Fields inherited from ProtectionContainer - - BackupManagementType *BackupManagementType `json:"backupManagementType,omitempty"` - ContainerType ProtectableContainerType `json:"containerType"` - FriendlyName *string `json:"friendlyName,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - ProtectableObjectType *string `json:"protectableObjectType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` -} - -func (s DpmContainer) ProtectionContainer() BaseProtectionContainerImpl { - return BaseProtectionContainerImpl{ - BackupManagementType: s.BackupManagementType, - ContainerType: s.ContainerType, - FriendlyName: s.FriendlyName, - HealthStatus: s.HealthStatus, - ProtectableObjectType: s.ProtectableObjectType, - RegistrationStatus: s.RegistrationStatus, - } -} - -var _ json.Marshaler = DpmContainer{} - -func (s DpmContainer) MarshalJSON() ([]byte, error) { - type wrapper DpmContainer - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling DpmContainer: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling DpmContainer: %+v", err) - } - - decoded["containerType"] = "DPMContainer" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling DpmContainer: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_dpmcontainerextendedinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_dpmcontainerextendedinfo.go deleted file mode 100644 index 62c9b305962..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_dpmcontainerextendedinfo.go +++ /dev/null @@ -1,26 +0,0 @@ -package backupprotectioncontainers - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DPMContainerExtendedInfo struct { - LastRefreshedAt *string `json:"lastRefreshedAt,omitempty"` -} - -func (o *DPMContainerExtendedInfo) GetLastRefreshedAtAsTime() (*time.Time, error) { - if o.LastRefreshedAt == nil { - return nil, nil - } - return dates.ParseAsFormat(o.LastRefreshedAt, "2006-01-02T15:04:05Z07:00") -} - -func (o *DPMContainerExtendedInfo) SetLastRefreshedAtAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.LastRefreshedAt = &formatted -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_errordetail.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_errordetail.go deleted file mode 100644 index 86008b3edcb..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_errordetail.go +++ /dev/null @@ -1,10 +0,0 @@ -package backupprotectioncontainers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ErrorDetail struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Recommendations *[]string `json:"recommendations,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_genericcontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_genericcontainer.go deleted file mode 100644 index c912d3229ef..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_genericcontainer.go +++ /dev/null @@ -1,61 +0,0 @@ -package backupprotectioncontainers - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ProtectionContainer = GenericContainer{} - -type GenericContainer struct { - ExtendedInformation *GenericContainerExtendedInfo `json:"extendedInformation,omitempty"` - FabricName *string `json:"fabricName,omitempty"` - - // Fields inherited from ProtectionContainer - - BackupManagementType *BackupManagementType `json:"backupManagementType,omitempty"` - ContainerType ProtectableContainerType `json:"containerType"` - FriendlyName *string `json:"friendlyName,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - ProtectableObjectType *string `json:"protectableObjectType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` -} - -func (s GenericContainer) ProtectionContainer() BaseProtectionContainerImpl { - return BaseProtectionContainerImpl{ - BackupManagementType: s.BackupManagementType, - ContainerType: s.ContainerType, - FriendlyName: s.FriendlyName, - HealthStatus: s.HealthStatus, - ProtectableObjectType: s.ProtectableObjectType, - RegistrationStatus: s.RegistrationStatus, - } -} - -var _ json.Marshaler = GenericContainer{} - -func (s GenericContainer) MarshalJSON() ([]byte, error) { - type wrapper GenericContainer - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling GenericContainer: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling GenericContainer: %+v", err) - } - - decoded["containerType"] = "GenericContainer" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling GenericContainer: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_genericcontainerextendedinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_genericcontainerextendedinfo.go deleted file mode 100644 index 82f18cd823f..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_genericcontainerextendedinfo.go +++ /dev/null @@ -1,10 +0,0 @@ -package backupprotectioncontainers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GenericContainerExtendedInfo struct { - ContainerIdentityInfo *ContainerIdentityInfo `json:"containerIdentityInfo,omitempty"` - RawCertData *string `json:"rawCertData,omitempty"` - ServiceEndpoints *map[string]string `json:"serviceEndpoints,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_iaasvmcontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_iaasvmcontainer.go deleted file mode 100644 index f43a63174a7..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_iaasvmcontainer.go +++ /dev/null @@ -1,62 +0,0 @@ -package backupprotectioncontainers - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ProtectionContainer = IaaSVMContainer{} - -type IaaSVMContainer struct { - ResourceGroup *string `json:"resourceGroup,omitempty"` - VirtualMachineId *string `json:"virtualMachineId,omitempty"` - VirtualMachineVersion *string `json:"virtualMachineVersion,omitempty"` - - // Fields inherited from ProtectionContainer - - BackupManagementType *BackupManagementType `json:"backupManagementType,omitempty"` - ContainerType ProtectableContainerType `json:"containerType"` - FriendlyName *string `json:"friendlyName,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - ProtectableObjectType *string `json:"protectableObjectType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` -} - -func (s IaaSVMContainer) ProtectionContainer() BaseProtectionContainerImpl { - return BaseProtectionContainerImpl{ - BackupManagementType: s.BackupManagementType, - ContainerType: s.ContainerType, - FriendlyName: s.FriendlyName, - HealthStatus: s.HealthStatus, - ProtectableObjectType: s.ProtectableObjectType, - RegistrationStatus: s.RegistrationStatus, - } -} - -var _ json.Marshaler = IaaSVMContainer{} - -func (s IaaSVMContainer) MarshalJSON() ([]byte, error) { - type wrapper IaaSVMContainer - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling IaaSVMContainer: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling IaaSVMContainer: %+v", err) - } - - decoded["containerType"] = "IaasVMContainer" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling IaaSVMContainer: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_inquiryinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_inquiryinfo.go deleted file mode 100644 index 93ec19a6ba0..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_inquiryinfo.go +++ /dev/null @@ -1,10 +0,0 @@ -package backupprotectioncontainers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type InquiryInfo struct { - ErrorDetail *ErrorDetail `json:"errorDetail,omitempty"` - InquiryDetails *[]WorkloadInquiryDetails `json:"inquiryDetails,omitempty"` - Status *string `json:"status,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_inquiryvalidation.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_inquiryvalidation.go deleted file mode 100644 index f33ed3584b2..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_inquiryvalidation.go +++ /dev/null @@ -1,11 +0,0 @@ -package backupprotectioncontainers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type InquiryValidation struct { - AdditionalDetail *string `json:"additionalDetail,omitempty"` - ErrorDetail *ErrorDetail `json:"errorDetail,omitempty"` - ProtectableItemCount *interface{} `json:"protectableItemCount,omitempty"` - Status *string `json:"status,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_mabcontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_mabcontainer.go deleted file mode 100644 index 806e61770c0..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_mabcontainer.go +++ /dev/null @@ -1,66 +0,0 @@ -package backupprotectioncontainers - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ProtectionContainer = MabContainer{} - -type MabContainer struct { - AgentVersion *string `json:"agentVersion,omitempty"` - CanReRegister *bool `json:"canReRegister,omitempty"` - ContainerHealthState *string `json:"containerHealthState,omitempty"` - ContainerId *int64 `json:"containerId,omitempty"` - ExtendedInfo *MabContainerExtendedInfo `json:"extendedInfo,omitempty"` - MabContainerHealthDetails *[]MABContainerHealthDetails `json:"mabContainerHealthDetails,omitempty"` - ProtectedItemCount *int64 `json:"protectedItemCount,omitempty"` - - // Fields inherited from ProtectionContainer - - BackupManagementType *BackupManagementType `json:"backupManagementType,omitempty"` - ContainerType ProtectableContainerType `json:"containerType"` - FriendlyName *string `json:"friendlyName,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - ProtectableObjectType *string `json:"protectableObjectType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` -} - -func (s MabContainer) ProtectionContainer() BaseProtectionContainerImpl { - return BaseProtectionContainerImpl{ - BackupManagementType: s.BackupManagementType, - ContainerType: s.ContainerType, - FriendlyName: s.FriendlyName, - HealthStatus: s.HealthStatus, - ProtectableObjectType: s.ProtectableObjectType, - RegistrationStatus: s.RegistrationStatus, - } -} - -var _ json.Marshaler = MabContainer{} - -func (s MabContainer) MarshalJSON() ([]byte, error) { - type wrapper MabContainer - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling MabContainer: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling MabContainer: %+v", err) - } - - decoded["containerType"] = "Windows" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling MabContainer: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_mabcontainerextendedinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_mabcontainerextendedinfo.go deleted file mode 100644 index b23e3796a39..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_mabcontainerextendedinfo.go +++ /dev/null @@ -1,30 +0,0 @@ -package backupprotectioncontainers - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MabContainerExtendedInfo struct { - BackupItemType *BackupItemType `json:"backupItemType,omitempty"` - BackupItems *[]string `json:"backupItems,omitempty"` - LastBackupStatus *string `json:"lastBackupStatus,omitempty"` - LastRefreshedAt *string `json:"lastRefreshedAt,omitempty"` - PolicyName *string `json:"policyName,omitempty"` -} - -func (o *MabContainerExtendedInfo) GetLastRefreshedAtAsTime() (*time.Time, error) { - if o.LastRefreshedAt == nil { - return nil, nil - } - return dates.ParseAsFormat(o.LastRefreshedAt, "2006-01-02T15:04:05Z07:00") -} - -func (o *MabContainerExtendedInfo) SetLastRefreshedAtAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.LastRefreshedAt = &formatted -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_mabcontainerhealthdetails.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_mabcontainerhealthdetails.go deleted file mode 100644 index 7c04be9060e..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_mabcontainerhealthdetails.go +++ /dev/null @@ -1,11 +0,0 @@ -package backupprotectioncontainers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MABContainerHealthDetails struct { - Code *int64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Recommendations *[]string `json:"recommendations,omitempty"` - Title *string `json:"title,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_protectioncontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_protectioncontainer.go deleted file mode 100644 index cc1f59de216..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_protectioncontainer.go +++ /dev/null @@ -1,168 +0,0 @@ -package backupprotectioncontainers - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ProtectionContainer interface { - ProtectionContainer() BaseProtectionContainerImpl -} - -var _ ProtectionContainer = BaseProtectionContainerImpl{} - -type BaseProtectionContainerImpl struct { - BackupManagementType *BackupManagementType `json:"backupManagementType,omitempty"` - ContainerType ProtectableContainerType `json:"containerType"` - FriendlyName *string `json:"friendlyName,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - ProtectableObjectType *string `json:"protectableObjectType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` -} - -func (s BaseProtectionContainerImpl) ProtectionContainer() BaseProtectionContainerImpl { - return s -} - -var _ ProtectionContainer = RawProtectionContainerImpl{} - -// RawProtectionContainerImpl is returned when the Discriminated Value doesn't match any of the defined types -// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) -// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). -type RawProtectionContainerImpl struct { - protectionContainer BaseProtectionContainerImpl - Type string - Values map[string]interface{} -} - -func (s RawProtectionContainerImpl) ProtectionContainer() BaseProtectionContainerImpl { - return s.protectionContainer -} - -func UnmarshalProtectionContainerImplementation(input []byte) (ProtectionContainer, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling ProtectionContainer into map[string]interface: %+v", err) - } - - var value string - if v, ok := temp["containerType"]; ok { - value = fmt.Sprintf("%v", v) - } - - if strings.EqualFold(value, "AzureBackupServerContainer") { - var out AzureBackupServerContainer - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AzureBackupServerContainer: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "Microsoft.ClassicCompute/virtualMachines") { - var out AzureIaaSClassicComputeVMContainer - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AzureIaaSClassicComputeVMContainer: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "Microsoft.Compute/virtualMachines") { - var out AzureIaaSComputeVMContainer - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AzureIaaSComputeVMContainer: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "SQLAGWorkLoadContainer") { - var out AzureSQLAGWorkloadContainerProtectionContainer - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AzureSQLAGWorkloadContainerProtectionContainer: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "AzureSqlContainer") { - var out AzureSqlContainer - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AzureSqlContainer: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "StorageContainer") { - var out AzureStorageContainer - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AzureStorageContainer: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "VMAppContainer") { - var out AzureVMAppContainerProtectionContainer - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AzureVMAppContainerProtectionContainer: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "AzureWorkloadContainer") { - var out AzureWorkloadContainer - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AzureWorkloadContainer: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "DPMContainer") { - var out DpmContainer - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into DpmContainer: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "GenericContainer") { - var out GenericContainer - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into GenericContainer: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "IaasVMContainer") { - var out IaaSVMContainer - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into IaaSVMContainer: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "Windows") { - var out MabContainer - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into MabContainer: %+v", err) - } - return out, nil - } - - var parent BaseProtectionContainerImpl - if err := json.Unmarshal(input, &parent); err != nil { - return nil, fmt.Errorf("unmarshaling into BaseProtectionContainerImpl: %+v", err) - } - - return RawProtectionContainerImpl{ - protectionContainer: parent, - Type: value, - Values: temp, - }, nil - -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_workloadinquirydetails.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_workloadinquirydetails.go deleted file mode 100644 index fd796f17a93..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_workloadinquirydetails.go +++ /dev/null @@ -1,10 +0,0 @@ -package backupprotectioncontainers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type WorkloadInquiryDetails struct { - InquiryValidation *InquiryValidation `json:"inquiryValidation,omitempty"` - ItemCount *int64 `json:"itemCount,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/predicates.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/predicates.go deleted file mode 100644 index 2c7170b0702..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/predicates.go +++ /dev/null @@ -1,37 +0,0 @@ -package backupprotectioncontainers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ProtectionContainerResourceOperationPredicate struct { - ETag *string - Id *string - Location *string - Name *string - Type *string -} - -func (p ProtectionContainerResourceOperationPredicate) Matches(input ProtectionContainerResource) bool { - - if p.ETag != nil && (input.ETag == nil || *p.ETag != *input.ETag) { - return false - } - - if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { - return false - } - - if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { - return false - } - - if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/README.md deleted file mode 100644 index 69dce38c850..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent` Documentation - -The `backupprotectionintent` SDK allows for interaction with Azure Resource Manager `recoveryservicesbackup` (API Version `2025-02-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent" -``` - - -### Client Initialization - -```go -client := backupprotectionintent.NewBackupProtectionIntentClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `BackupProtectionIntentClient.List` - -```go -ctx := context.TODO() -id := backupprotectionintent.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") - -// alternatively `client.List(ctx, id, backupprotectionintent.DefaultListOperationOptions())` can be used to do batched pagination -items, err := client.ListComplete(ctx, id, backupprotectionintent.DefaultListOperationOptions()) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/client.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/client.go deleted file mode 100644 index 10dc6db01e1..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package backupprotectionintent - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BackupProtectionIntentClient struct { - Client autorest.Client - baseUri string -} - -func NewBackupProtectionIntentClientWithBaseURI(endpoint string) BackupProtectionIntentClient { - return BackupProtectionIntentClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/method_list_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/method_list_autorest.go deleted file mode 100644 index 9e4e60e7b48..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/method_list_autorest.go +++ /dev/null @@ -1,215 +0,0 @@ -package backupprotectionintent - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]ProtectionIntentResource - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []ProtectionIntentResource -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListOperationOptions struct { - Filter *string -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - return out -} - -// List ... -func (c BackupProtectionIntentClient) List(ctx context.Context, id VaultId, options ListOperationOptions) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotectionintent.BackupProtectionIntentClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotectionintent.BackupProtectionIntentClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotectionintent.BackupProtectionIntentClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c BackupProtectionIntentClient) preparerForList(ctx context.Context, id VaultId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/backupProtectionIntents", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c BackupProtectionIntentClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c BackupProtectionIntentClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []ProtectionIntentResource `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotectionintent.BackupProtectionIntentClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotectionintent.BackupProtectionIntentClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backupprotectionintent.BackupProtectionIntentClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c BackupProtectionIntentClient) ListComplete(ctx context.Context, id VaultId, options ListOperationOptions) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, options, ProtectionIntentResourceOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c BackupProtectionIntentClient) ListCompleteMatchingPredicate(ctx context.Context, id VaultId, options ListOperationOptions, predicate ProtectionIntentResourceOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]ProtectionIntentResource, 0) - - page, err := c.List(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupresourceencryptionconfigs/model_backupresourceencryptionconfigextendedresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupresourceencryptionconfigs/model_backupresourceencryptionconfigextendedresource.go index 748ecae7a86..80c7a473aed 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupresourceencryptionconfigs/model_backupresourceencryptionconfigextendedresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/backupresourceencryptionconfigs/model_backupresourceencryptionconfigextendedresource.go @@ -1,5 +1,9 @@ package backupresourceencryptionconfigs +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -9,6 +13,7 @@ type BackupResourceEncryptionConfigExtendedResource struct { Location *string `json:"location,omitempty"` Name *string `json:"name,omitempty"` Properties *BackupResourceEncryptionConfigExtended `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` Tags *map[string]string `json:"tags,omitempty"` Type *string `json:"type,omitempty"` } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupresourceencryptionconfigs/model_backupresourceencryptionconfigresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupresourceencryptionconfigs/model_backupresourceencryptionconfigresource.go index 2bdfb74ffb3..a30dada6189 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupresourceencryptionconfigs/model_backupresourceencryptionconfigresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/backupresourceencryptionconfigs/model_backupresourceencryptionconfigresource.go @@ -1,5 +1,9 @@ package backupresourceencryptionconfigs +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -9,6 +13,7 @@ type BackupResourceEncryptionConfigResource struct { Location *string `json:"location,omitempty"` Name *string `json:"name,omitempty"` Properties *BackupResourceEncryptionConfig `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` Tags *map[string]string `json:"tags,omitempty"` Type *string `json:"type,omitempty"` } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/README.md index 77e3db8b3b8..15c69c6c7de 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/README.md +++ b/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/README.md @@ -20,6 +20,40 @@ client.Client.Authorizer = authorizer ``` +### Example Usage: `BackupResourceStorageConfigsNonCRRClient.BMSPrepareDataMove` + +```go +ctx := context.TODO() +id := backupresourcestorageconfigsnoncrr.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +payload := backupresourcestorageconfigsnoncrr.PrepareDataMoveRequest{ + // ... +} + + +if err := client.BMSPrepareDataMoveThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `BackupResourceStorageConfigsNonCRRClient.BMSTriggerDataMove` + +```go +ctx := context.TODO() +id := backupresourcestorageconfigsnoncrr.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +payload := backupresourcestorageconfigsnoncrr.TriggerDataMoveRequest{ + // ... +} + + +if err := client.BMSTriggerDataMoveThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + ### Example Usage: `BackupResourceStorageConfigsNonCRRClient.Get` ```go diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/constants.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/constants.go index 401d538cf3b..3ef8c681d2d 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/constants.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/constants.go @@ -7,6 +7,37 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. +type DataMoveLevel string + +const ( + DataMoveLevelContainer DataMoveLevel = "Container" + DataMoveLevelInvalid DataMoveLevel = "Invalid" + DataMoveLevelVault DataMoveLevel = "Vault" +) + +func PossibleValuesForDataMoveLevel() []string { + return []string{ + string(DataMoveLevelContainer), + string(DataMoveLevelInvalid), + string(DataMoveLevelVault), + } +} + +func parseDataMoveLevel(input string) (*DataMoveLevel, error) { + vals := map[string]DataMoveLevel{ + "container": DataMoveLevelContainer, + "invalid": DataMoveLevelInvalid, + "vault": DataMoveLevelVault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DataMoveLevel(input) + return &out, nil +} + type DedupState string const ( diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/datamove/method_bmspreparedatamove_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/method_bmspreparedatamove_autorest.go similarity index 64% rename from resource-manager/recoveryservicesbackup/2025-02-01/datamove/method_bmspreparedatamove_autorest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/method_bmspreparedatamove_autorest.go index 460642bf637..adbf2e47448 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/datamove/method_bmspreparedatamove_autorest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/method_bmspreparedatamove_autorest.go @@ -1,4 +1,4 @@ -package datamove +package backupresourcestorageconfigsnoncrr import ( "context" @@ -19,16 +19,16 @@ type BMSPrepareDataMoveOperationResponse struct { } // BMSPrepareDataMove ... -func (c DataMoveClient) BMSPrepareDataMove(ctx context.Context, id VaultId, input PrepareDataMoveRequest) (result BMSPrepareDataMoveOperationResponse, err error) { +func (c BackupResourceStorageConfigsNonCRRClient) BMSPrepareDataMove(ctx context.Context, id VaultId, input PrepareDataMoveRequest) (result BMSPrepareDataMoveOperationResponse, err error) { req, err := c.preparerForBMSPrepareDataMove(ctx, id, input) if err != nil { - err = autorest.NewErrorWithError(err, "datamove.DataMoveClient", "BMSPrepareDataMove", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient", "BMSPrepareDataMove", nil, "Failure preparing request") return } result, err = c.senderForBMSPrepareDataMove(ctx, req) if err != nil { - err = autorest.NewErrorWithError(err, "datamove.DataMoveClient", "BMSPrepareDataMove", result.HttpResponse, "Failure sending request") + err = autorest.NewErrorWithError(err, "backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient", "BMSPrepareDataMove", result.HttpResponse, "Failure sending request") return } @@ -36,7 +36,7 @@ func (c DataMoveClient) BMSPrepareDataMove(ctx context.Context, id VaultId, inpu } // BMSPrepareDataMoveThenPoll performs BMSPrepareDataMove then polls until it's completed -func (c DataMoveClient) BMSPrepareDataMoveThenPoll(ctx context.Context, id VaultId, input PrepareDataMoveRequest) error { +func (c BackupResourceStorageConfigsNonCRRClient) BMSPrepareDataMoveThenPoll(ctx context.Context, id VaultId, input PrepareDataMoveRequest) error { result, err := c.BMSPrepareDataMove(ctx, id, input) if err != nil { return fmt.Errorf("performing BMSPrepareDataMove: %+v", err) @@ -50,7 +50,7 @@ func (c DataMoveClient) BMSPrepareDataMoveThenPoll(ctx context.Context, id Vault } // preparerForBMSPrepareDataMove prepares the BMSPrepareDataMove request. -func (c DataMoveClient) preparerForBMSPrepareDataMove(ctx context.Context, id VaultId, input PrepareDataMoveRequest) (*http.Request, error) { +func (c BackupResourceStorageConfigsNonCRRClient) preparerForBMSPrepareDataMove(ctx context.Context, id VaultId, input PrepareDataMoveRequest) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -67,7 +67,7 @@ func (c DataMoveClient) preparerForBMSPrepareDataMove(ctx context.Context, id Va // senderForBMSPrepareDataMove sends the BMSPrepareDataMove request. The method will close the // http.Response Body if it receives an error. -func (c DataMoveClient) senderForBMSPrepareDataMove(ctx context.Context, req *http.Request) (future BMSPrepareDataMoveOperationResponse, err error) { +func (c BackupResourceStorageConfigsNonCRRClient) senderForBMSPrepareDataMove(ctx context.Context, req *http.Request) (future BMSPrepareDataMoveOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/datamove/method_bmstriggerdatamove_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/method_bmstriggerdatamove_autorest.go similarity index 64% rename from resource-manager/recoveryservicesbackup/2025-02-01/datamove/method_bmstriggerdatamove_autorest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/method_bmstriggerdatamove_autorest.go index 5f89d916019..75df3ca051c 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/datamove/method_bmstriggerdatamove_autorest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/method_bmstriggerdatamove_autorest.go @@ -1,4 +1,4 @@ -package datamove +package backupresourcestorageconfigsnoncrr import ( "context" @@ -19,16 +19,16 @@ type BMSTriggerDataMoveOperationResponse struct { } // BMSTriggerDataMove ... -func (c DataMoveClient) BMSTriggerDataMove(ctx context.Context, id VaultId, input TriggerDataMoveRequest) (result BMSTriggerDataMoveOperationResponse, err error) { +func (c BackupResourceStorageConfigsNonCRRClient) BMSTriggerDataMove(ctx context.Context, id VaultId, input TriggerDataMoveRequest) (result BMSTriggerDataMoveOperationResponse, err error) { req, err := c.preparerForBMSTriggerDataMove(ctx, id, input) if err != nil { - err = autorest.NewErrorWithError(err, "datamove.DataMoveClient", "BMSTriggerDataMove", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient", "BMSTriggerDataMove", nil, "Failure preparing request") return } result, err = c.senderForBMSTriggerDataMove(ctx, req) if err != nil { - err = autorest.NewErrorWithError(err, "datamove.DataMoveClient", "BMSTriggerDataMove", result.HttpResponse, "Failure sending request") + err = autorest.NewErrorWithError(err, "backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient", "BMSTriggerDataMove", result.HttpResponse, "Failure sending request") return } @@ -36,7 +36,7 @@ func (c DataMoveClient) BMSTriggerDataMove(ctx context.Context, id VaultId, inpu } // BMSTriggerDataMoveThenPoll performs BMSTriggerDataMove then polls until it's completed -func (c DataMoveClient) BMSTriggerDataMoveThenPoll(ctx context.Context, id VaultId, input TriggerDataMoveRequest) error { +func (c BackupResourceStorageConfigsNonCRRClient) BMSTriggerDataMoveThenPoll(ctx context.Context, id VaultId, input TriggerDataMoveRequest) error { result, err := c.BMSTriggerDataMove(ctx, id, input) if err != nil { return fmt.Errorf("performing BMSTriggerDataMove: %+v", err) @@ -50,7 +50,7 @@ func (c DataMoveClient) BMSTriggerDataMoveThenPoll(ctx context.Context, id Vault } // preparerForBMSTriggerDataMove prepares the BMSTriggerDataMove request. -func (c DataMoveClient) preparerForBMSTriggerDataMove(ctx context.Context, id VaultId, input TriggerDataMoveRequest) (*http.Request, error) { +func (c BackupResourceStorageConfigsNonCRRClient) preparerForBMSTriggerDataMove(ctx context.Context, id VaultId, input TriggerDataMoveRequest) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -67,7 +67,7 @@ func (c DataMoveClient) preparerForBMSTriggerDataMove(ctx context.Context, id Va // senderForBMSTriggerDataMove sends the BMSTriggerDataMove request. The method will close the // http.Response Body if it receives an error. -func (c DataMoveClient) senderForBMSTriggerDataMove(ctx context.Context, req *http.Request) (future BMSTriggerDataMoveOperationResponse, err error) { +func (c BackupResourceStorageConfigsNonCRRClient) senderForBMSTriggerDataMove(ctx context.Context, req *http.Request) (future BMSTriggerDataMoveOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/model_backupresourceconfigresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/model_backupresourceconfigresource.go index 8fc2680cafb..f4943c9169d 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/model_backupresourceconfigresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/model_backupresourceconfigresource.go @@ -1,14 +1,19 @@ package backupresourcestorageconfigsnoncrr +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type BackupResourceConfigResource struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *BackupResourceConfig `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *BackupResourceConfig `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/datamove/model_preparedatamoverequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/model_preparedatamoverequest.go similarity index 92% rename from resource-manager/recoveryservicesbackup/2025-02-01/datamove/model_preparedatamoverequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/model_preparedatamoverequest.go index f2e39d1cd8a..bbbd4f65499 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/datamove/model_preparedatamoverequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/model_preparedatamoverequest.go @@ -1,4 +1,4 @@ -package datamove +package backupresourcestorageconfigsnoncrr // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/datamove/model_triggerdatamoverequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/model_triggerdatamoverequest.go similarity index 93% rename from resource-manager/recoveryservicesbackup/2025-02-01/datamove/model_triggerdatamoverequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/model_triggerdatamoverequest.go index eb35ce70218..560def1b390 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/datamove/model_triggerdatamoverequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr/model_triggerdatamoverequest.go @@ -1,4 +1,4 @@ -package datamove +package backupresourcestorageconfigsnoncrr // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcevaultconfigs/model_backupresourcevaultconfigresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcevaultconfigs/model_backupresourcevaultconfigresource.go index 9957131bbd6..390effc5596 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcevaultconfigs/model_backupresourcevaultconfigresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcevaultconfigs/model_backupresourcevaultconfigresource.go @@ -1,5 +1,9 @@ package backupresourcevaultconfigs +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -9,6 +13,7 @@ type BackupResourceVaultConfigResource struct { Location *string `json:"location,omitempty"` Name *string `json:"name,omitempty"` Properties *BackupResourceVaultConfig `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` Tags *map[string]string `json:"tags,omitempty"` Type *string `json:"type,omitempty"` } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backups/model_backuprequestresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/backups/model_backuprequestresource.go index 14cfe2f2003..35dffa15947 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backups/model_backuprequestresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/backups/model_backuprequestresource.go @@ -3,31 +3,35 @@ package backups import ( "encoding/json" "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" ) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type BackupRequestResource struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties BackupRequest `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties BackupRequest `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } var _ json.Unmarshaler = &BackupRequestResource{} func (s *BackupRequestResource) UnmarshalJSON(bytes []byte) error { var decoded struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -37,6 +41,7 @@ func (s *BackupRequestResource) UnmarshalJSON(bytes []byte) error { s.Id = decoded.Id s.Location = decoded.Location s.Name = decoded.Name + s.SystemData = decoded.SystemData s.Tags = decoded.Tags s.Type = decoded.Type diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/README.md deleted file mode 100644 index 8e6d707c267..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/README.md +++ /dev/null @@ -1,41 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus` Documentation - -The `backupstatus` SDK allows for interaction with Azure Resource Manager `recoveryservicesbackup` (API Version `2025-02-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus" -``` - - -### Client Initialization - -```go -client := backupstatus.NewBackupStatusClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `BackupStatusClient.Get` - -```go -ctx := context.TODO() -id := backupstatus.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") - -payload := backupstatus.BackupStatusRequest{ - // ... -} - - -read, err := client.Get(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/client.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/client.go deleted file mode 100644 index d17f64f2d24..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package backupstatus - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BackupStatusClient struct { - Client autorest.Client - baseUri string -} - -func NewBackupStatusClientWithBaseURI(endpoint string) BackupStatusClient { - return BackupStatusClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/constants.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/constants.go deleted file mode 100644 index 2ee8d184452..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/constants.go +++ /dev/null @@ -1,171 +0,0 @@ -package backupstatus - -import ( - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AcquireStorageAccountLock string - -const ( - AcquireStorageAccountLockAcquire AcquireStorageAccountLock = "Acquire" - AcquireStorageAccountLockNotAcquire AcquireStorageAccountLock = "NotAcquire" -) - -func PossibleValuesForAcquireStorageAccountLock() []string { - return []string{ - string(AcquireStorageAccountLockAcquire), - string(AcquireStorageAccountLockNotAcquire), - } -} - -func parseAcquireStorageAccountLock(input string) (*AcquireStorageAccountLock, error) { - vals := map[string]AcquireStorageAccountLock{ - "acquire": AcquireStorageAccountLockAcquire, - "notacquire": AcquireStorageAccountLockNotAcquire, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AcquireStorageAccountLock(input) - return &out, nil -} - -type DataSourceType string - -const ( - DataSourceTypeAzureFileShare DataSourceType = "AzureFileShare" - DataSourceTypeAzureSqlDb DataSourceType = "AzureSqlDb" - DataSourceTypeClient DataSourceType = "Client" - DataSourceTypeExchange DataSourceType = "Exchange" - DataSourceTypeFileFolder DataSourceType = "FileFolder" - DataSourceTypeGenericDataSource DataSourceType = "GenericDataSource" - DataSourceTypeInvalid DataSourceType = "Invalid" - DataSourceTypeSAPAseDatabase DataSourceType = "SAPAseDatabase" - DataSourceTypeSAPHanaDBInstance DataSourceType = "SAPHanaDBInstance" - DataSourceTypeSAPHanaDatabase DataSourceType = "SAPHanaDatabase" - DataSourceTypeSQLDB DataSourceType = "SQLDB" - DataSourceTypeSQLDataBase DataSourceType = "SQLDataBase" - DataSourceTypeSharepoint DataSourceType = "Sharepoint" - DataSourceTypeSystemState DataSourceType = "SystemState" - DataSourceTypeVM DataSourceType = "VM" - DataSourceTypeVMwareVM DataSourceType = "VMwareVM" -) - -func PossibleValuesForDataSourceType() []string { - return []string{ - string(DataSourceTypeAzureFileShare), - string(DataSourceTypeAzureSqlDb), - string(DataSourceTypeClient), - string(DataSourceTypeExchange), - string(DataSourceTypeFileFolder), - string(DataSourceTypeGenericDataSource), - string(DataSourceTypeInvalid), - string(DataSourceTypeSAPAseDatabase), - string(DataSourceTypeSAPHanaDBInstance), - string(DataSourceTypeSAPHanaDatabase), - string(DataSourceTypeSQLDB), - string(DataSourceTypeSQLDataBase), - string(DataSourceTypeSharepoint), - string(DataSourceTypeSystemState), - string(DataSourceTypeVM), - string(DataSourceTypeVMwareVM), - } -} - -func parseDataSourceType(input string) (*DataSourceType, error) { - vals := map[string]DataSourceType{ - "azurefileshare": DataSourceTypeAzureFileShare, - "azuresqldb": DataSourceTypeAzureSqlDb, - "client": DataSourceTypeClient, - "exchange": DataSourceTypeExchange, - "filefolder": DataSourceTypeFileFolder, - "genericdatasource": DataSourceTypeGenericDataSource, - "invalid": DataSourceTypeInvalid, - "sapasedatabase": DataSourceTypeSAPAseDatabase, - "saphanadbinstance": DataSourceTypeSAPHanaDBInstance, - "saphanadatabase": DataSourceTypeSAPHanaDatabase, - "sqldb": DataSourceTypeSQLDB, - "sqldatabase": DataSourceTypeSQLDataBase, - "sharepoint": DataSourceTypeSharepoint, - "systemstate": DataSourceTypeSystemState, - "vm": DataSourceTypeVM, - "vmwarevm": DataSourceTypeVMwareVM, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := DataSourceType(input) - return &out, nil -} - -type FabricName string - -const ( - FabricNameAzure FabricName = "Azure" - FabricNameInvalid FabricName = "Invalid" -) - -func PossibleValuesForFabricName() []string { - return []string{ - string(FabricNameAzure), - string(FabricNameInvalid), - } -} - -func parseFabricName(input string) (*FabricName, error) { - vals := map[string]FabricName{ - "azure": FabricNameAzure, - "invalid": FabricNameInvalid, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FabricName(input) - return &out, nil -} - -type ProtectionStatus string - -const ( - ProtectionStatusInvalid ProtectionStatus = "Invalid" - ProtectionStatusNotProtected ProtectionStatus = "NotProtected" - ProtectionStatusProtected ProtectionStatus = "Protected" - ProtectionStatusProtecting ProtectionStatus = "Protecting" - ProtectionStatusProtectionFailed ProtectionStatus = "ProtectionFailed" -) - -func PossibleValuesForProtectionStatus() []string { - return []string{ - string(ProtectionStatusInvalid), - string(ProtectionStatusNotProtected), - string(ProtectionStatusProtected), - string(ProtectionStatusProtecting), - string(ProtectionStatusProtectionFailed), - } -} - -func parseProtectionStatus(input string) (*ProtectionStatus, error) { - vals := map[string]ProtectionStatus{ - "invalid": ProtectionStatusInvalid, - "notprotected": ProtectionStatusNotProtected, - "protected": ProtectionStatusProtected, - "protecting": ProtectionStatusProtecting, - "protectionfailed": ProtectionStatusProtectionFailed, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProtectionStatus(input) - return &out, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/README.md deleted file mode 100644 index cbb444e3a8a..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/README.md +++ /dev/null @@ -1,36 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries` Documentation - -The `backupusagesummaries` SDK allows for interaction with Azure Resource Manager `recoveryservicesbackup` (API Version `2025-02-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries" -``` - - -### Client Initialization - -```go -client := backupusagesummaries.NewBackupUsageSummariesClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `BackupUsageSummariesClient.List` - -```go -ctx := context.TODO() -id := backupusagesummaries.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") - -read, err := client.List(ctx, id, backupusagesummaries.DefaultListOperationOptions()) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/client.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/client.go deleted file mode 100644 index d6dbffa806e..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package backupusagesummaries - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BackupUsageSummariesClient struct { - Client autorest.Client - baseUri string -} - -func NewBackupUsageSummariesClientWithBaseURI(endpoint string) BackupUsageSummariesClient { - return BackupUsageSummariesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/constants.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/constants.go deleted file mode 100644 index 35bb7f168aa..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/constants.go +++ /dev/null @@ -1,48 +0,0 @@ -package backupusagesummaries - -import ( - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UsagesUnit string - -const ( - UsagesUnitBytes UsagesUnit = "Bytes" - UsagesUnitBytesPerSecond UsagesUnit = "BytesPerSecond" - UsagesUnitCount UsagesUnit = "Count" - UsagesUnitCountPerSecond UsagesUnit = "CountPerSecond" - UsagesUnitPercent UsagesUnit = "Percent" - UsagesUnitSeconds UsagesUnit = "Seconds" -) - -func PossibleValuesForUsagesUnit() []string { - return []string{ - string(UsagesUnitBytes), - string(UsagesUnitBytesPerSecond), - string(UsagesUnitCount), - string(UsagesUnitCountPerSecond), - string(UsagesUnitPercent), - string(UsagesUnitSeconds), - } -} - -func parseUsagesUnit(input string) (*UsagesUnit, error) { - vals := map[string]UsagesUnit{ - "bytes": UsagesUnitBytes, - "bytespersecond": UsagesUnitBytesPerSecond, - "count": UsagesUnitCount, - "countpersecond": UsagesUnitCountPerSecond, - "percent": UsagesUnitPercent, - "seconds": UsagesUnitSeconds, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := UsagesUnit(input) - return &out, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/id_vault.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/id_vault.go deleted file mode 100644 index 6c678e26ebe..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/id_vault.go +++ /dev/null @@ -1,130 +0,0 @@ -package backupusagesummaries - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -func init() { - recaser.RegisterResourceId(&VaultId{}) -} - -var _ resourceids.ResourceId = &VaultId{} - -// VaultId is a struct representing the Resource ID for a Vault -type VaultId struct { - SubscriptionId string - ResourceGroupName string - VaultName string -} - -// NewVaultID returns a new VaultId struct -func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { - return VaultId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - VaultName: vaultName, - } -} - -// ParseVaultID parses 'input' into a VaultId -func ParseVaultID(input string) (*VaultId, error) { - parser := resourceids.NewParserFromResourceIdType(&VaultId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VaultId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseVaultIDInsensitively parses 'input' case-insensitively into a VaultId -// note: this method should only be used for API response data and not user input -func ParseVaultIDInsensitively(input string) (*VaultId, error) { - parser := resourceids.NewParserFromResourceIdType(&VaultId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VaultId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *VaultId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) - } - - if id.VaultName, ok = input.Parsed["vaultName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) - } - - return nil -} - -// ValidateVaultID checks that 'input' can be parsed as a Vault ID -func ValidateVaultID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseVaultID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Vault ID -func (id VaultId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Vault ID -func (id VaultId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), - resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("vaultName", "vaultName"), - } -} - -// String returns a human-readable description of this Vault ID -func (id VaultId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Vault Name: %q", id.VaultName), - } - return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/id_vault_test.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/id_vault_test.go deleted file mode 100644 index 3531163a6df..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/id_vault_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package backupusagesummaries - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ resourceids.ResourceId = &VaultId{} - -func TestNewVaultID(t *testing.T) { - id := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.VaultName != "vaultName" { - t.Fatalf("Expected %q but got %q for Segment 'VaultName'", id.VaultName, "vaultName") - } -} - -func TestFormatVaultID(t *testing.T) { - actual := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVaultID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VaultId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VaultName: "vaultName", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVaultID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.VaultName != v.Expected.VaultName { - t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) - } - - } -} - -func TestParseVaultIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VaultId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VaultName: "vaultName", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - VaultName: "vAuLtNaMe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVaultIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.VaultName != v.Expected.VaultName { - t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) - } - - } -} - -func TestSegmentsForVaultId(t *testing.T) { - segments := VaultId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VaultId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/method_list_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/method_list_autorest.go deleted file mode 100644 index f3562412897..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/method_list_autorest.go +++ /dev/null @@ -1,98 +0,0 @@ -package backupusagesummaries - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *BackupManagementUsageList -} - -type ListOperationOptions struct { - Filter *string -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - return out -} - -// List ... -func (c BackupUsageSummariesClient) List(ctx context.Context, id VaultId, options ListOperationOptions) (result ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "backupusagesummaries.BackupUsageSummariesClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "backupusagesummaries.BackupUsageSummariesClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "backupusagesummaries.BackupUsageSummariesClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForList prepares the List request. -func (c BackupUsageSummariesClient) preparerForList(ctx context.Context, id VaultId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/backupUsageSummaries", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c BackupUsageSummariesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupworkloaditems/model_workloaditemresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupworkloaditems/model_workloaditemresource.go index 4cea6b568cc..d7eff506784 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupworkloaditems/model_workloaditemresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/backupworkloaditems/model_workloaditemresource.go @@ -3,31 +3,35 @@ package backupworkloaditems import ( "encoding/json" "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" ) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type WorkloadItemResource struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties WorkloadItem `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties WorkloadItem `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } var _ json.Unmarshaler = &WorkloadItemResource{} func (s *WorkloadItemResource) UnmarshalJSON(bytes []byte) error { var decoded struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -37,6 +41,7 @@ func (s *WorkloadItemResource) UnmarshalJSON(bytes []byte) error { s.Id = decoded.Id s.Location = decoded.Location s.Name = decoded.Name + s.SystemData = decoded.SystemData s.Tags = decoded.Tags s.Type = decoded.Type diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/bms/README.md new file mode 100644 index 00000000000..73ba44b0262 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/README.md @@ -0,0 +1,342 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/bms` Documentation + +The `bms` SDK allows for interaction with Azure Resource Manager `recoveryservicesbackup` (API Version `2025-02-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/bms" +``` + + +### Client Initialization + +```go +client := bms.NewBmsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `BmsClient.BackupOperationStatusesGet` + +```go +ctx := context.TODO() +id := bms.NewBackupOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "operationId") + +read, err := client.BackupOperationStatusesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BmsClient.BackupProtectableItemsList` + +```go +ctx := context.TODO() +id := bms.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +// alternatively `client.BackupProtectableItemsList(ctx, id, bms.DefaultBackupProtectableItemsListOperationOptions())` can be used to do batched pagination +items, err := client.BackupProtectableItemsListComplete(ctx, id, bms.DefaultBackupProtectableItemsListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `BmsClient.BackupProtectedItemsList` + +```go +ctx := context.TODO() +id := bms.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +// alternatively `client.BackupProtectedItemsList(ctx, id, bms.DefaultBackupProtectedItemsListOperationOptions())` can be used to do batched pagination +items, err := client.BackupProtectedItemsListComplete(ctx, id, bms.DefaultBackupProtectedItemsListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `BmsClient.BackupProtectionContainersList` + +```go +ctx := context.TODO() +id := bms.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +// alternatively `client.BackupProtectionContainersList(ctx, id, bms.DefaultBackupProtectionContainersListOperationOptions())` can be used to do batched pagination +items, err := client.BackupProtectionContainersListComplete(ctx, id, bms.DefaultBackupProtectionContainersListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `BmsClient.BackupProtectionIntentList` + +```go +ctx := context.TODO() +id := bms.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +// alternatively `client.BackupProtectionIntentList(ctx, id, bms.DefaultBackupProtectionIntentListOperationOptions())` can be used to do batched pagination +items, err := client.BackupProtectionIntentListComplete(ctx, id, bms.DefaultBackupProtectionIntentListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `BmsClient.BackupStatusGet` + +```go +ctx := context.TODO() +id := bms.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +payload := bms.BackupStatusRequest{ + // ... +} + + +read, err := client.BackupStatusGet(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BmsClient.BackupUsageSummariesList` + +```go +ctx := context.TODO() +id := bms.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +// alternatively `client.BackupUsageSummariesList(ctx, id, bms.DefaultBackupUsageSummariesListOperationOptions())` can be used to do batched pagination +items, err := client.BackupUsageSummariesListComplete(ctx, id, bms.DefaultBackupUsageSummariesListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `BmsClient.DeletedProtectionContainersList` + +```go +ctx := context.TODO() +id := bms.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +// alternatively `client.DeletedProtectionContainersList(ctx, id, bms.DefaultDeletedProtectionContainersListOperationOptions())` can be used to do batched pagination +items, err := client.DeletedProtectionContainersListComplete(ctx, id, bms.DefaultDeletedProtectionContainersListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `BmsClient.FeatureSupportValidate` + +```go +ctx := context.TODO() +id := bms.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +payload := bms.FeatureSupportRequest{ + // ... +} + + +read, err := client.FeatureSupportValidate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BmsClient.FetchTieringCostPost` + +```go +ctx := context.TODO() +id := bms.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +payload := bms.FetchTieringCostInfoRequest{ + // ... +} + + +if err := client.FetchTieringCostPostThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `BmsClient.JobsExport` + +```go +ctx := context.TODO() +id := bms.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +read, err := client.JobsExport(ctx, id, bms.DefaultJobsExportOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BmsClient.OperationValidate` + +```go +ctx := context.TODO() +id := bms.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +payload := bms.ValidateOperationRequestResource{ + // ... +} + + +read, err := client.OperationValidate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BmsClient.ProtectableContainersList` + +```go +ctx := context.TODO() +id := bms.NewBackupFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "backupFabricName") + +// alternatively `client.ProtectableContainersList(ctx, id, bms.DefaultProtectableContainersListOperationOptions())` can be used to do batched pagination +items, err := client.ProtectableContainersListComplete(ctx, id, bms.DefaultProtectableContainersListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `BmsClient.ProtectionContainersRefresh` + +```go +ctx := context.TODO() +id := bms.NewBackupFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "backupFabricName") + +read, err := client.ProtectionContainersRefresh(ctx, id, bms.DefaultProtectionContainersRefreshOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BmsClient.ProtectionIntentValidate` + +```go +ctx := context.TODO() +id := bms.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +payload := bms.PreValidateEnableBackupRequest{ + // ... +} + + +read, err := client.ProtectionIntentValidate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BmsClient.SecurityPINsGet` + +```go +ctx := context.TODO() +id := bms.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +payload := bms.SecurityPinBase{ + // ... +} + + +read, err := client.SecurityPINsGet(ctx, id, payload, bms.DefaultSecurityPINsGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BmsClient.ValidateOperationStatusesGet` + +```go +ctx := context.TODO() +id := bms.NewBackupValidateOperationsStatusID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "operationId") + +read, err := client.ValidateOperationStatusesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BmsClient.ValidateOperationTrigger` + +```go +ctx := context.TODO() +id := bms.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +payload := bms.ValidateOperationRequestResource{ + // ... +} + + +if err := client.ValidateOperationTriggerThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/jobs/client.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/client.go similarity index 73% rename from resource-manager/recoveryservicesbackup/2025-02-01/jobs/client.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/client.go index fd4e7899bb5..7abcef50dab 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/jobs/client.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/client.go @@ -1,17 +1,17 @@ -package jobs +package bms import "github.com/Azure/go-autorest/autorest" // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type JobsClient struct { +type BmsClient struct { Client autorest.Client baseUri string } -func NewJobsClientWithBaseURI(endpoint string) JobsClient { - return JobsClient{ +func NewBmsClientWithBaseURI(endpoint string) BmsClient { + return BmsClient{ Client: autorest.NewClientWithUserAgent(userAgent()), baseUri: endpoint, } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/constants.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/constants.go new file mode 100644 index 00000000000..f17aca54fcc --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/constants.go @@ -0,0 +1,1325 @@ +package bms + +import ( + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AcquireStorageAccountLock string + +const ( + AcquireStorageAccountLockAcquire AcquireStorageAccountLock = "Acquire" + AcquireStorageAccountLockNotAcquire AcquireStorageAccountLock = "NotAcquire" +) + +func PossibleValuesForAcquireStorageAccountLock() []string { + return []string{ + string(AcquireStorageAccountLockAcquire), + string(AcquireStorageAccountLockNotAcquire), + } +} + +func parseAcquireStorageAccountLock(input string) (*AcquireStorageAccountLock, error) { + vals := map[string]AcquireStorageAccountLock{ + "acquire": AcquireStorageAccountLockAcquire, + "notacquire": AcquireStorageAccountLockNotAcquire, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AcquireStorageAccountLock(input) + return &out, nil +} + +type AzureFileShareType string + +const ( + AzureFileShareTypeInvalid AzureFileShareType = "Invalid" + AzureFileShareTypeXSMB AzureFileShareType = "XSMB" + AzureFileShareTypeXSync AzureFileShareType = "XSync" +) + +func PossibleValuesForAzureFileShareType() []string { + return []string{ + string(AzureFileShareTypeInvalid), + string(AzureFileShareTypeXSMB), + string(AzureFileShareTypeXSync), + } +} + +func parseAzureFileShareType(input string) (*AzureFileShareType, error) { + vals := map[string]AzureFileShareType{ + "invalid": AzureFileShareTypeInvalid, + "xsmb": AzureFileShareTypeXSMB, + "xsync": AzureFileShareTypeXSync, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AzureFileShareType(input) + return &out, nil +} + +type BackupItemType string + +const ( + BackupItemTypeAzureFileShare BackupItemType = "AzureFileShare" + BackupItemTypeAzureSqlDb BackupItemType = "AzureSqlDb" + BackupItemTypeClient BackupItemType = "Client" + BackupItemTypeExchange BackupItemType = "Exchange" + BackupItemTypeFileFolder BackupItemType = "FileFolder" + BackupItemTypeGenericDataSource BackupItemType = "GenericDataSource" + BackupItemTypeInvalid BackupItemType = "Invalid" + BackupItemTypeSAPAseDatabase BackupItemType = "SAPAseDatabase" + BackupItemTypeSAPHanaDBInstance BackupItemType = "SAPHanaDBInstance" + BackupItemTypeSAPHanaDatabase BackupItemType = "SAPHanaDatabase" + BackupItemTypeSQLDB BackupItemType = "SQLDB" + BackupItemTypeSQLDataBase BackupItemType = "SQLDataBase" + BackupItemTypeSharepoint BackupItemType = "Sharepoint" + BackupItemTypeSystemState BackupItemType = "SystemState" + BackupItemTypeVM BackupItemType = "VM" + BackupItemTypeVMwareVM BackupItemType = "VMwareVM" +) + +func PossibleValuesForBackupItemType() []string { + return []string{ + string(BackupItemTypeAzureFileShare), + string(BackupItemTypeAzureSqlDb), + string(BackupItemTypeClient), + string(BackupItemTypeExchange), + string(BackupItemTypeFileFolder), + string(BackupItemTypeGenericDataSource), + string(BackupItemTypeInvalid), + string(BackupItemTypeSAPAseDatabase), + string(BackupItemTypeSAPHanaDBInstance), + string(BackupItemTypeSAPHanaDatabase), + string(BackupItemTypeSQLDB), + string(BackupItemTypeSQLDataBase), + string(BackupItemTypeSharepoint), + string(BackupItemTypeSystemState), + string(BackupItemTypeVM), + string(BackupItemTypeVMwareVM), + } +} + +func parseBackupItemType(input string) (*BackupItemType, error) { + vals := map[string]BackupItemType{ + "azurefileshare": BackupItemTypeAzureFileShare, + "azuresqldb": BackupItemTypeAzureSqlDb, + "client": BackupItemTypeClient, + "exchange": BackupItemTypeExchange, + "filefolder": BackupItemTypeFileFolder, + "genericdatasource": BackupItemTypeGenericDataSource, + "invalid": BackupItemTypeInvalid, + "sapasedatabase": BackupItemTypeSAPAseDatabase, + "saphanadbinstance": BackupItemTypeSAPHanaDBInstance, + "saphanadatabase": BackupItemTypeSAPHanaDatabase, + "sqldb": BackupItemTypeSQLDB, + "sqldatabase": BackupItemTypeSQLDataBase, + "sharepoint": BackupItemTypeSharepoint, + "systemstate": BackupItemTypeSystemState, + "vm": BackupItemTypeVM, + "vmwarevm": BackupItemTypeVMwareVM, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BackupItemType(input) + return &out, nil +} + +type BackupManagementType string + +const ( + BackupManagementTypeAzureBackupServer BackupManagementType = "AzureBackupServer" + BackupManagementTypeAzureIaasVM BackupManagementType = "AzureIaasVM" + BackupManagementTypeAzureSql BackupManagementType = "AzureSql" + BackupManagementTypeAzureStorage BackupManagementType = "AzureStorage" + BackupManagementTypeAzureWorkload BackupManagementType = "AzureWorkload" + BackupManagementTypeDPM BackupManagementType = "DPM" + BackupManagementTypeDefaultBackup BackupManagementType = "DefaultBackup" + BackupManagementTypeInvalid BackupManagementType = "Invalid" + BackupManagementTypeMAB BackupManagementType = "MAB" +) + +func PossibleValuesForBackupManagementType() []string { + return []string{ + string(BackupManagementTypeAzureBackupServer), + string(BackupManagementTypeAzureIaasVM), + string(BackupManagementTypeAzureSql), + string(BackupManagementTypeAzureStorage), + string(BackupManagementTypeAzureWorkload), + string(BackupManagementTypeDPM), + string(BackupManagementTypeDefaultBackup), + string(BackupManagementTypeInvalid), + string(BackupManagementTypeMAB), + } +} + +func parseBackupManagementType(input string) (*BackupManagementType, error) { + vals := map[string]BackupManagementType{ + "azurebackupserver": BackupManagementTypeAzureBackupServer, + "azureiaasvm": BackupManagementTypeAzureIaasVM, + "azuresql": BackupManagementTypeAzureSql, + "azurestorage": BackupManagementTypeAzureStorage, + "azureworkload": BackupManagementTypeAzureWorkload, + "dpm": BackupManagementTypeDPM, + "defaultbackup": BackupManagementTypeDefaultBackup, + "invalid": BackupManagementTypeInvalid, + "mab": BackupManagementTypeMAB, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BackupManagementType(input) + return &out, nil +} + +type CopyOptions string + +const ( + CopyOptionsCreateCopy CopyOptions = "CreateCopy" + CopyOptionsFailOnConflict CopyOptions = "FailOnConflict" + CopyOptionsInvalid CopyOptions = "Invalid" + CopyOptionsOverwrite CopyOptions = "Overwrite" + CopyOptionsSkip CopyOptions = "Skip" +) + +func PossibleValuesForCopyOptions() []string { + return []string{ + string(CopyOptionsCreateCopy), + string(CopyOptionsFailOnConflict), + string(CopyOptionsInvalid), + string(CopyOptionsOverwrite), + string(CopyOptionsSkip), + } +} + +func parseCopyOptions(input string) (*CopyOptions, error) { + vals := map[string]CopyOptions{ + "createcopy": CopyOptionsCreateCopy, + "failonconflict": CopyOptionsFailOnConflict, + "invalid": CopyOptionsInvalid, + "overwrite": CopyOptionsOverwrite, + "skip": CopyOptionsSkip, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CopyOptions(input) + return &out, nil +} + +type CreateMode string + +const ( + CreateModeDefault CreateMode = "Default" + CreateModeInvalid CreateMode = "Invalid" + CreateModeRecover CreateMode = "Recover" +) + +func PossibleValuesForCreateMode() []string { + return []string{ + string(CreateModeDefault), + string(CreateModeInvalid), + string(CreateModeRecover), + } +} + +func parseCreateMode(input string) (*CreateMode, error) { + vals := map[string]CreateMode{ + "default": CreateModeDefault, + "invalid": CreateModeInvalid, + "recover": CreateModeRecover, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CreateMode(input) + return &out, nil +} + +type DataSourceType string + +const ( + DataSourceTypeAzureFileShare DataSourceType = "AzureFileShare" + DataSourceTypeAzureSqlDb DataSourceType = "AzureSqlDb" + DataSourceTypeClient DataSourceType = "Client" + DataSourceTypeExchange DataSourceType = "Exchange" + DataSourceTypeFileFolder DataSourceType = "FileFolder" + DataSourceTypeGenericDataSource DataSourceType = "GenericDataSource" + DataSourceTypeInvalid DataSourceType = "Invalid" + DataSourceTypeSAPAseDatabase DataSourceType = "SAPAseDatabase" + DataSourceTypeSAPHanaDBInstance DataSourceType = "SAPHanaDBInstance" + DataSourceTypeSAPHanaDatabase DataSourceType = "SAPHanaDatabase" + DataSourceTypeSQLDB DataSourceType = "SQLDB" + DataSourceTypeSQLDataBase DataSourceType = "SQLDataBase" + DataSourceTypeSharepoint DataSourceType = "Sharepoint" + DataSourceTypeSystemState DataSourceType = "SystemState" + DataSourceTypeVM DataSourceType = "VM" + DataSourceTypeVMwareVM DataSourceType = "VMwareVM" +) + +func PossibleValuesForDataSourceType() []string { + return []string{ + string(DataSourceTypeAzureFileShare), + string(DataSourceTypeAzureSqlDb), + string(DataSourceTypeClient), + string(DataSourceTypeExchange), + string(DataSourceTypeFileFolder), + string(DataSourceTypeGenericDataSource), + string(DataSourceTypeInvalid), + string(DataSourceTypeSAPAseDatabase), + string(DataSourceTypeSAPHanaDBInstance), + string(DataSourceTypeSAPHanaDatabase), + string(DataSourceTypeSQLDB), + string(DataSourceTypeSQLDataBase), + string(DataSourceTypeSharepoint), + string(DataSourceTypeSystemState), + string(DataSourceTypeVM), + string(DataSourceTypeVMwareVM), + } +} + +func parseDataSourceType(input string) (*DataSourceType, error) { + vals := map[string]DataSourceType{ + "azurefileshare": DataSourceTypeAzureFileShare, + "azuresqldb": DataSourceTypeAzureSqlDb, + "client": DataSourceTypeClient, + "exchange": DataSourceTypeExchange, + "filefolder": DataSourceTypeFileFolder, + "genericdatasource": DataSourceTypeGenericDataSource, + "invalid": DataSourceTypeInvalid, + "sapasedatabase": DataSourceTypeSAPAseDatabase, + "saphanadbinstance": DataSourceTypeSAPHanaDBInstance, + "saphanadatabase": DataSourceTypeSAPHanaDatabase, + "sqldb": DataSourceTypeSQLDB, + "sqldatabase": DataSourceTypeSQLDataBase, + "sharepoint": DataSourceTypeSharepoint, + "systemstate": DataSourceTypeSystemState, + "vm": DataSourceTypeVM, + "vmwarevm": DataSourceTypeVMwareVM, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DataSourceType(input) + return &out, nil +} + +type FabricName string + +const ( + FabricNameAzure FabricName = "Azure" + FabricNameInvalid FabricName = "Invalid" +) + +func PossibleValuesForFabricName() []string { + return []string{ + string(FabricNameAzure), + string(FabricNameInvalid), + } +} + +func parseFabricName(input string) (*FabricName, error) { + vals := map[string]FabricName{ + "azure": FabricNameAzure, + "invalid": FabricNameInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FabricName(input) + return &out, nil +} + +type HealthStatus string + +const ( + HealthStatusActionRequired HealthStatus = "ActionRequired" + HealthStatusActionSuggested HealthStatus = "ActionSuggested" + HealthStatusInvalid HealthStatus = "Invalid" + HealthStatusPassed HealthStatus = "Passed" +) + +func PossibleValuesForHealthStatus() []string { + return []string{ + string(HealthStatusActionRequired), + string(HealthStatusActionSuggested), + string(HealthStatusInvalid), + string(HealthStatusPassed), + } +} + +func parseHealthStatus(input string) (*HealthStatus, error) { + vals := map[string]HealthStatus{ + "actionrequired": HealthStatusActionRequired, + "actionsuggested": HealthStatusActionSuggested, + "invalid": HealthStatusInvalid, + "passed": HealthStatusPassed, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HealthStatus(input) + return &out, nil +} + +type InquiryStatus string + +const ( + InquiryStatusFailed InquiryStatus = "Failed" + InquiryStatusInvalid InquiryStatus = "Invalid" + InquiryStatusSuccess InquiryStatus = "Success" +) + +func PossibleValuesForInquiryStatus() []string { + return []string{ + string(InquiryStatusFailed), + string(InquiryStatusInvalid), + string(InquiryStatusSuccess), + } +} + +func parseInquiryStatus(input string) (*InquiryStatus, error) { + vals := map[string]InquiryStatus{ + "failed": InquiryStatusFailed, + "invalid": InquiryStatusInvalid, + "success": InquiryStatusSuccess, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InquiryStatus(input) + return &out, nil +} + +type LastBackupStatus string + +const ( + LastBackupStatusHealthy LastBackupStatus = "Healthy" + LastBackupStatusIRPending LastBackupStatus = "IRPending" + LastBackupStatusInvalid LastBackupStatus = "Invalid" + LastBackupStatusUnhealthy LastBackupStatus = "Unhealthy" +) + +func PossibleValuesForLastBackupStatus() []string { + return []string{ + string(LastBackupStatusHealthy), + string(LastBackupStatusIRPending), + string(LastBackupStatusInvalid), + string(LastBackupStatusUnhealthy), + } +} + +func parseLastBackupStatus(input string) (*LastBackupStatus, error) { + vals := map[string]LastBackupStatus{ + "healthy": LastBackupStatusHealthy, + "irpending": LastBackupStatusIRPending, + "invalid": LastBackupStatusInvalid, + "unhealthy": LastBackupStatusUnhealthy, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LastBackupStatus(input) + return &out, nil +} + +type OperationStatusValues string + +const ( + OperationStatusValuesCanceled OperationStatusValues = "Canceled" + OperationStatusValuesFailed OperationStatusValues = "Failed" + OperationStatusValuesInProgress OperationStatusValues = "InProgress" + OperationStatusValuesInvalid OperationStatusValues = "Invalid" + OperationStatusValuesSucceeded OperationStatusValues = "Succeeded" +) + +func PossibleValuesForOperationStatusValues() []string { + return []string{ + string(OperationStatusValuesCanceled), + string(OperationStatusValuesFailed), + string(OperationStatusValuesInProgress), + string(OperationStatusValuesInvalid), + string(OperationStatusValuesSucceeded), + } +} + +func parseOperationStatusValues(input string) (*OperationStatusValues, error) { + vals := map[string]OperationStatusValues{ + "canceled": OperationStatusValuesCanceled, + "failed": OperationStatusValuesFailed, + "inprogress": OperationStatusValuesInProgress, + "invalid": OperationStatusValuesInvalid, + "succeeded": OperationStatusValuesSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperationStatusValues(input) + return &out, nil +} + +type OperationType string + +const ( + OperationTypeInvalid OperationType = "Invalid" + OperationTypeRegister OperationType = "Register" + OperationTypeRehydrate OperationType = "Rehydrate" + OperationTypeReregister OperationType = "Reregister" +) + +func PossibleValuesForOperationType() []string { + return []string{ + string(OperationTypeInvalid), + string(OperationTypeRegister), + string(OperationTypeRehydrate), + string(OperationTypeReregister), + } +} + +func parseOperationType(input string) (*OperationType, error) { + vals := map[string]OperationType{ + "invalid": OperationTypeInvalid, + "register": OperationTypeRegister, + "rehydrate": OperationTypeRehydrate, + "reregister": OperationTypeReregister, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperationType(input) + return &out, nil +} + +type OverwriteOptions string + +const ( + OverwriteOptionsFailOnConflict OverwriteOptions = "FailOnConflict" + OverwriteOptionsInvalid OverwriteOptions = "Invalid" + OverwriteOptionsOverwrite OverwriteOptions = "Overwrite" +) + +func PossibleValuesForOverwriteOptions() []string { + return []string{ + string(OverwriteOptionsFailOnConflict), + string(OverwriteOptionsInvalid), + string(OverwriteOptionsOverwrite), + } +} + +func parseOverwriteOptions(input string) (*OverwriteOptions, error) { + vals := map[string]OverwriteOptions{ + "failonconflict": OverwriteOptionsFailOnConflict, + "invalid": OverwriteOptionsInvalid, + "overwrite": OverwriteOptionsOverwrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OverwriteOptions(input) + return &out, nil +} + +type ProtectableContainerType string + +const ( + ProtectableContainerTypeAzureBackupServerContainer ProtectableContainerType = "AzureBackupServerContainer" + ProtectableContainerTypeAzureSqlContainer ProtectableContainerType = "AzureSqlContainer" + ProtectableContainerTypeAzureWorkloadContainer ProtectableContainerType = "AzureWorkloadContainer" + ProtectableContainerTypeCluster ProtectableContainerType = "Cluster" + ProtectableContainerTypeDPMContainer ProtectableContainerType = "DPMContainer" + ProtectableContainerTypeGenericContainer ProtectableContainerType = "GenericContainer" + ProtectableContainerTypeIaasVMContainer ProtectableContainerType = "IaasVMContainer" + ProtectableContainerTypeIaasVMServiceContainer ProtectableContainerType = "IaasVMServiceContainer" + ProtectableContainerTypeInvalid ProtectableContainerType = "Invalid" + ProtectableContainerTypeMABContainer ProtectableContainerType = "MABContainer" + ProtectableContainerTypeMicrosoftPointClassicComputeVirtualMachines ProtectableContainerType = "Microsoft.ClassicCompute/virtualMachines" + ProtectableContainerTypeMicrosoftPointComputeVirtualMachines ProtectableContainerType = "Microsoft.Compute/virtualMachines" + ProtectableContainerTypeSQLAGWorkLoadContainer ProtectableContainerType = "SQLAGWorkLoadContainer" + ProtectableContainerTypeStorageContainer ProtectableContainerType = "StorageContainer" + ProtectableContainerTypeUnknown ProtectableContainerType = "Unknown" + ProtectableContainerTypeVCenter ProtectableContainerType = "VCenter" + ProtectableContainerTypeVMAppContainer ProtectableContainerType = "VMAppContainer" + ProtectableContainerTypeWindows ProtectableContainerType = "Windows" +) + +func PossibleValuesForProtectableContainerType() []string { + return []string{ + string(ProtectableContainerTypeAzureBackupServerContainer), + string(ProtectableContainerTypeAzureSqlContainer), + string(ProtectableContainerTypeAzureWorkloadContainer), + string(ProtectableContainerTypeCluster), + string(ProtectableContainerTypeDPMContainer), + string(ProtectableContainerTypeGenericContainer), + string(ProtectableContainerTypeIaasVMContainer), + string(ProtectableContainerTypeIaasVMServiceContainer), + string(ProtectableContainerTypeInvalid), + string(ProtectableContainerTypeMABContainer), + string(ProtectableContainerTypeMicrosoftPointClassicComputeVirtualMachines), + string(ProtectableContainerTypeMicrosoftPointComputeVirtualMachines), + string(ProtectableContainerTypeSQLAGWorkLoadContainer), + string(ProtectableContainerTypeStorageContainer), + string(ProtectableContainerTypeUnknown), + string(ProtectableContainerTypeVCenter), + string(ProtectableContainerTypeVMAppContainer), + string(ProtectableContainerTypeWindows), + } +} + +func parseProtectableContainerType(input string) (*ProtectableContainerType, error) { + vals := map[string]ProtectableContainerType{ + "azurebackupservercontainer": ProtectableContainerTypeAzureBackupServerContainer, + "azuresqlcontainer": ProtectableContainerTypeAzureSqlContainer, + "azureworkloadcontainer": ProtectableContainerTypeAzureWorkloadContainer, + "cluster": ProtectableContainerTypeCluster, + "dpmcontainer": ProtectableContainerTypeDPMContainer, + "genericcontainer": ProtectableContainerTypeGenericContainer, + "iaasvmcontainer": ProtectableContainerTypeIaasVMContainer, + "iaasvmservicecontainer": ProtectableContainerTypeIaasVMServiceContainer, + "invalid": ProtectableContainerTypeInvalid, + "mabcontainer": ProtectableContainerTypeMABContainer, + "microsoft.classiccompute/virtualmachines": ProtectableContainerTypeMicrosoftPointClassicComputeVirtualMachines, + "microsoft.compute/virtualmachines": ProtectableContainerTypeMicrosoftPointComputeVirtualMachines, + "sqlagworkloadcontainer": ProtectableContainerTypeSQLAGWorkLoadContainer, + "storagecontainer": ProtectableContainerTypeStorageContainer, + "unknown": ProtectableContainerTypeUnknown, + "vcenter": ProtectableContainerTypeVCenter, + "vmappcontainer": ProtectableContainerTypeVMAppContainer, + "windows": ProtectableContainerTypeWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProtectableContainerType(input) + return &out, nil +} + +type ProtectedItemHealthStatus string + +const ( + ProtectedItemHealthStatusHealthy ProtectedItemHealthStatus = "Healthy" + ProtectedItemHealthStatusIRPending ProtectedItemHealthStatus = "IRPending" + ProtectedItemHealthStatusInvalid ProtectedItemHealthStatus = "Invalid" + ProtectedItemHealthStatusNotReachable ProtectedItemHealthStatus = "NotReachable" + ProtectedItemHealthStatusUnhealthy ProtectedItemHealthStatus = "Unhealthy" +) + +func PossibleValuesForProtectedItemHealthStatus() []string { + return []string{ + string(ProtectedItemHealthStatusHealthy), + string(ProtectedItemHealthStatusIRPending), + string(ProtectedItemHealthStatusInvalid), + string(ProtectedItemHealthStatusNotReachable), + string(ProtectedItemHealthStatusUnhealthy), + } +} + +func parseProtectedItemHealthStatus(input string) (*ProtectedItemHealthStatus, error) { + vals := map[string]ProtectedItemHealthStatus{ + "healthy": ProtectedItemHealthStatusHealthy, + "irpending": ProtectedItemHealthStatusIRPending, + "invalid": ProtectedItemHealthStatusInvalid, + "notreachable": ProtectedItemHealthStatusNotReachable, + "unhealthy": ProtectedItemHealthStatusUnhealthy, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProtectedItemHealthStatus(input) + return &out, nil +} + +type ProtectedItemState string + +const ( + ProtectedItemStateBackupsSuspended ProtectedItemState = "BackupsSuspended" + ProtectedItemStateIRPending ProtectedItemState = "IRPending" + ProtectedItemStateInvalid ProtectedItemState = "Invalid" + ProtectedItemStateProtected ProtectedItemState = "Protected" + ProtectedItemStateProtectionError ProtectedItemState = "ProtectionError" + ProtectedItemStateProtectionPaused ProtectedItemState = "ProtectionPaused" + ProtectedItemStateProtectionStopped ProtectedItemState = "ProtectionStopped" +) + +func PossibleValuesForProtectedItemState() []string { + return []string{ + string(ProtectedItemStateBackupsSuspended), + string(ProtectedItemStateIRPending), + string(ProtectedItemStateInvalid), + string(ProtectedItemStateProtected), + string(ProtectedItemStateProtectionError), + string(ProtectedItemStateProtectionPaused), + string(ProtectedItemStateProtectionStopped), + } +} + +func parseProtectedItemState(input string) (*ProtectedItemState, error) { + vals := map[string]ProtectedItemState{ + "backupssuspended": ProtectedItemStateBackupsSuspended, + "irpending": ProtectedItemStateIRPending, + "invalid": ProtectedItemStateInvalid, + "protected": ProtectedItemStateProtected, + "protectionerror": ProtectedItemStateProtectionError, + "protectionpaused": ProtectedItemStateProtectionPaused, + "protectionstopped": ProtectedItemStateProtectionStopped, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProtectedItemState(input) + return &out, nil +} + +type ProtectionIntentItemType string + +const ( + ProtectionIntentItemTypeAzureResourceItem ProtectionIntentItemType = "AzureResourceItem" + ProtectionIntentItemTypeAzureWorkloadAutoProtectionIntent ProtectionIntentItemType = "AzureWorkloadAutoProtectionIntent" + ProtectionIntentItemTypeAzureWorkloadContainerAutoProtectionIntent ProtectionIntentItemType = "AzureWorkloadContainerAutoProtectionIntent" + ProtectionIntentItemTypeAzureWorkloadSQLAutoProtectionIntent ProtectionIntentItemType = "AzureWorkloadSQLAutoProtectionIntent" + ProtectionIntentItemTypeInvalid ProtectionIntentItemType = "Invalid" + ProtectionIntentItemTypeRecoveryServiceVaultItem ProtectionIntentItemType = "RecoveryServiceVaultItem" +) + +func PossibleValuesForProtectionIntentItemType() []string { + return []string{ + string(ProtectionIntentItemTypeAzureResourceItem), + string(ProtectionIntentItemTypeAzureWorkloadAutoProtectionIntent), + string(ProtectionIntentItemTypeAzureWorkloadContainerAutoProtectionIntent), + string(ProtectionIntentItemTypeAzureWorkloadSQLAutoProtectionIntent), + string(ProtectionIntentItemTypeInvalid), + string(ProtectionIntentItemTypeRecoveryServiceVaultItem), + } +} + +func parseProtectionIntentItemType(input string) (*ProtectionIntentItemType, error) { + vals := map[string]ProtectionIntentItemType{ + "azureresourceitem": ProtectionIntentItemTypeAzureResourceItem, + "azureworkloadautoprotectionintent": ProtectionIntentItemTypeAzureWorkloadAutoProtectionIntent, + "azureworkloadcontainerautoprotectionintent": ProtectionIntentItemTypeAzureWorkloadContainerAutoProtectionIntent, + "azureworkloadsqlautoprotectionintent": ProtectionIntentItemTypeAzureWorkloadSQLAutoProtectionIntent, + "invalid": ProtectionIntentItemTypeInvalid, + "recoveryservicevaultitem": ProtectionIntentItemTypeRecoveryServiceVaultItem, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProtectionIntentItemType(input) + return &out, nil +} + +type ProtectionState string + +const ( + ProtectionStateBackupsSuspended ProtectionState = "BackupsSuspended" + ProtectionStateIRPending ProtectionState = "IRPending" + ProtectionStateInvalid ProtectionState = "Invalid" + ProtectionStateProtected ProtectionState = "Protected" + ProtectionStateProtectionError ProtectionState = "ProtectionError" + ProtectionStateProtectionPaused ProtectionState = "ProtectionPaused" + ProtectionStateProtectionStopped ProtectionState = "ProtectionStopped" +) + +func PossibleValuesForProtectionState() []string { + return []string{ + string(ProtectionStateBackupsSuspended), + string(ProtectionStateIRPending), + string(ProtectionStateInvalid), + string(ProtectionStateProtected), + string(ProtectionStateProtectionError), + string(ProtectionStateProtectionPaused), + string(ProtectionStateProtectionStopped), + } +} + +func parseProtectionState(input string) (*ProtectionState, error) { + vals := map[string]ProtectionState{ + "backupssuspended": ProtectionStateBackupsSuspended, + "irpending": ProtectionStateIRPending, + "invalid": ProtectionStateInvalid, + "protected": ProtectionStateProtected, + "protectionerror": ProtectionStateProtectionError, + "protectionpaused": ProtectionStateProtectionPaused, + "protectionstopped": ProtectionStateProtectionStopped, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProtectionState(input) + return &out, nil +} + +type ProtectionStatus string + +const ( + ProtectionStatusInvalid ProtectionStatus = "Invalid" + ProtectionStatusNotProtected ProtectionStatus = "NotProtected" + ProtectionStatusProtected ProtectionStatus = "Protected" + ProtectionStatusProtecting ProtectionStatus = "Protecting" + ProtectionStatusProtectionFailed ProtectionStatus = "ProtectionFailed" +) + +func PossibleValuesForProtectionStatus() []string { + return []string{ + string(ProtectionStatusInvalid), + string(ProtectionStatusNotProtected), + string(ProtectionStatusProtected), + string(ProtectionStatusProtecting), + string(ProtectionStatusProtectionFailed), + } +} + +func parseProtectionStatus(input string) (*ProtectionStatus, error) { + vals := map[string]ProtectionStatus{ + "invalid": ProtectionStatusInvalid, + "notprotected": ProtectionStatusNotProtected, + "protected": ProtectionStatusProtected, + "protecting": ProtectionStatusProtecting, + "protectionfailed": ProtectionStatusProtectionFailed, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProtectionStatus(input) + return &out, nil +} + +type RecoveryMode string + +const ( + RecoveryModeFileRecovery RecoveryMode = "FileRecovery" + RecoveryModeInvalid RecoveryMode = "Invalid" + RecoveryModeRecoveryUsingSnapshot RecoveryMode = "RecoveryUsingSnapshot" + RecoveryModeSnapshotAttach RecoveryMode = "SnapshotAttach" + RecoveryModeSnapshotAttachAndRecover RecoveryMode = "SnapshotAttachAndRecover" + RecoveryModeWorkloadRecovery RecoveryMode = "WorkloadRecovery" +) + +func PossibleValuesForRecoveryMode() []string { + return []string{ + string(RecoveryModeFileRecovery), + string(RecoveryModeInvalid), + string(RecoveryModeRecoveryUsingSnapshot), + string(RecoveryModeSnapshotAttach), + string(RecoveryModeSnapshotAttachAndRecover), + string(RecoveryModeWorkloadRecovery), + } +} + +func parseRecoveryMode(input string) (*RecoveryMode, error) { + vals := map[string]RecoveryMode{ + "filerecovery": RecoveryModeFileRecovery, + "invalid": RecoveryModeInvalid, + "recoveryusingsnapshot": RecoveryModeRecoveryUsingSnapshot, + "snapshotattach": RecoveryModeSnapshotAttach, + "snapshotattachandrecover": RecoveryModeSnapshotAttachAndRecover, + "workloadrecovery": RecoveryModeWorkloadRecovery, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RecoveryMode(input) + return &out, nil +} + +type RecoveryPointTierType string + +const ( + RecoveryPointTierTypeArchivedRP RecoveryPointTierType = "ArchivedRP" + RecoveryPointTierTypeHardenedRP RecoveryPointTierType = "HardenedRP" + RecoveryPointTierTypeInstantRP RecoveryPointTierType = "InstantRP" + RecoveryPointTierTypeInvalid RecoveryPointTierType = "Invalid" +) + +func PossibleValuesForRecoveryPointTierType() []string { + return []string{ + string(RecoveryPointTierTypeArchivedRP), + string(RecoveryPointTierTypeHardenedRP), + string(RecoveryPointTierTypeInstantRP), + string(RecoveryPointTierTypeInvalid), + } +} + +func parseRecoveryPointTierType(input string) (*RecoveryPointTierType, error) { + vals := map[string]RecoveryPointTierType{ + "archivedrp": RecoveryPointTierTypeArchivedRP, + "hardenedrp": RecoveryPointTierTypeHardenedRP, + "instantrp": RecoveryPointTierTypeInstantRP, + "invalid": RecoveryPointTierTypeInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RecoveryPointTierType(input) + return &out, nil +} + +type RecoveryType string + +const ( + RecoveryTypeAlternateLocation RecoveryType = "AlternateLocation" + RecoveryTypeInvalid RecoveryType = "Invalid" + RecoveryTypeOffline RecoveryType = "Offline" + RecoveryTypeOriginalLocation RecoveryType = "OriginalLocation" + RecoveryTypeRestoreDisks RecoveryType = "RestoreDisks" +) + +func PossibleValuesForRecoveryType() []string { + return []string{ + string(RecoveryTypeAlternateLocation), + string(RecoveryTypeInvalid), + string(RecoveryTypeOffline), + string(RecoveryTypeOriginalLocation), + string(RecoveryTypeRestoreDisks), + } +} + +func parseRecoveryType(input string) (*RecoveryType, error) { + vals := map[string]RecoveryType{ + "alternatelocation": RecoveryTypeAlternateLocation, + "invalid": RecoveryTypeInvalid, + "offline": RecoveryTypeOffline, + "originallocation": RecoveryTypeOriginalLocation, + "restoredisks": RecoveryTypeRestoreDisks, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RecoveryType(input) + return &out, nil +} + +type RehydrationPriority string + +const ( + RehydrationPriorityHigh RehydrationPriority = "High" + RehydrationPriorityStandard RehydrationPriority = "Standard" +) + +func PossibleValuesForRehydrationPriority() []string { + return []string{ + string(RehydrationPriorityHigh), + string(RehydrationPriorityStandard), + } +} + +func parseRehydrationPriority(input string) (*RehydrationPriority, error) { + vals := map[string]RehydrationPriority{ + "high": RehydrationPriorityHigh, + "standard": RehydrationPriorityStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RehydrationPriority(input) + return &out, nil +} + +type ResourceHealthStatus string + +const ( + ResourceHealthStatusHealthy ResourceHealthStatus = "Healthy" + ResourceHealthStatusInvalid ResourceHealthStatus = "Invalid" + ResourceHealthStatusPersistentDegraded ResourceHealthStatus = "PersistentDegraded" + ResourceHealthStatusPersistentUnhealthy ResourceHealthStatus = "PersistentUnhealthy" + ResourceHealthStatusTransientDegraded ResourceHealthStatus = "TransientDegraded" + ResourceHealthStatusTransientUnhealthy ResourceHealthStatus = "TransientUnhealthy" +) + +func PossibleValuesForResourceHealthStatus() []string { + return []string{ + string(ResourceHealthStatusHealthy), + string(ResourceHealthStatusInvalid), + string(ResourceHealthStatusPersistentDegraded), + string(ResourceHealthStatusPersistentUnhealthy), + string(ResourceHealthStatusTransientDegraded), + string(ResourceHealthStatusTransientUnhealthy), + } +} + +func parseResourceHealthStatus(input string) (*ResourceHealthStatus, error) { + vals := map[string]ResourceHealthStatus{ + "healthy": ResourceHealthStatusHealthy, + "invalid": ResourceHealthStatusInvalid, + "persistentdegraded": ResourceHealthStatusPersistentDegraded, + "persistentunhealthy": ResourceHealthStatusPersistentUnhealthy, + "transientdegraded": ResourceHealthStatusTransientDegraded, + "transientunhealthy": ResourceHealthStatusTransientUnhealthy, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceHealthStatus(input) + return &out, nil +} + +type RestoreRequestType string + +const ( + RestoreRequestTypeFullShareRestore RestoreRequestType = "FullShareRestore" + RestoreRequestTypeInvalid RestoreRequestType = "Invalid" + RestoreRequestTypeItemLevelRestore RestoreRequestType = "ItemLevelRestore" +) + +func PossibleValuesForRestoreRequestType() []string { + return []string{ + string(RestoreRequestTypeFullShareRestore), + string(RestoreRequestTypeInvalid), + string(RestoreRequestTypeItemLevelRestore), + } +} + +func parseRestoreRequestType(input string) (*RestoreRequestType, error) { + vals := map[string]RestoreRequestType{ + "fullsharerestore": RestoreRequestTypeFullShareRestore, + "invalid": RestoreRequestTypeInvalid, + "itemlevelrestore": RestoreRequestTypeItemLevelRestore, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RestoreRequestType(input) + return &out, nil +} + +type SQLDataDirectoryType string + +const ( + SQLDataDirectoryTypeData SQLDataDirectoryType = "Data" + SQLDataDirectoryTypeInvalid SQLDataDirectoryType = "Invalid" + SQLDataDirectoryTypeLog SQLDataDirectoryType = "Log" +) + +func PossibleValuesForSQLDataDirectoryType() []string { + return []string{ + string(SQLDataDirectoryTypeData), + string(SQLDataDirectoryTypeInvalid), + string(SQLDataDirectoryTypeLog), + } +} + +func parseSQLDataDirectoryType(input string) (*SQLDataDirectoryType, error) { + vals := map[string]SQLDataDirectoryType{ + "data": SQLDataDirectoryTypeData, + "invalid": SQLDataDirectoryTypeInvalid, + "log": SQLDataDirectoryTypeLog, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SQLDataDirectoryType(input) + return &out, nil +} + +type SupportStatus string + +const ( + SupportStatusDefaultOFF SupportStatus = "DefaultOFF" + SupportStatusDefaultON SupportStatus = "DefaultON" + SupportStatusInvalid SupportStatus = "Invalid" + SupportStatusNotSupported SupportStatus = "NotSupported" + SupportStatusSupported SupportStatus = "Supported" +) + +func PossibleValuesForSupportStatus() []string { + return []string{ + string(SupportStatusDefaultOFF), + string(SupportStatusDefaultON), + string(SupportStatusInvalid), + string(SupportStatusNotSupported), + string(SupportStatusSupported), + } +} + +func parseSupportStatus(input string) (*SupportStatus, error) { + vals := map[string]SupportStatus{ + "defaultoff": SupportStatusDefaultOFF, + "defaulton": SupportStatusDefaultON, + "invalid": SupportStatusInvalid, + "notsupported": SupportStatusNotSupported, + "supported": SupportStatusSupported, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SupportStatus(input) + return &out, nil +} + +type TargetDiskNetworkAccessOption string + +const ( + TargetDiskNetworkAccessOptionEnablePrivateAccessForAllDisks TargetDiskNetworkAccessOption = "EnablePrivateAccessForAllDisks" + TargetDiskNetworkAccessOptionEnablePublicAccessForAllDisks TargetDiskNetworkAccessOption = "EnablePublicAccessForAllDisks" + TargetDiskNetworkAccessOptionSameAsOnSourceDisks TargetDiskNetworkAccessOption = "SameAsOnSourceDisks" +) + +func PossibleValuesForTargetDiskNetworkAccessOption() []string { + return []string{ + string(TargetDiskNetworkAccessOptionEnablePrivateAccessForAllDisks), + string(TargetDiskNetworkAccessOptionEnablePublicAccessForAllDisks), + string(TargetDiskNetworkAccessOptionSameAsOnSourceDisks), + } +} + +func parseTargetDiskNetworkAccessOption(input string) (*TargetDiskNetworkAccessOption, error) { + vals := map[string]TargetDiskNetworkAccessOption{ + "enableprivateaccessforalldisks": TargetDiskNetworkAccessOptionEnablePrivateAccessForAllDisks, + "enablepublicaccessforalldisks": TargetDiskNetworkAccessOptionEnablePublicAccessForAllDisks, + "sameasonsourcedisks": TargetDiskNetworkAccessOptionSameAsOnSourceDisks, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TargetDiskNetworkAccessOption(input) + return &out, nil +} + +type UsagesUnit string + +const ( + UsagesUnitBytes UsagesUnit = "Bytes" + UsagesUnitBytesPerSecond UsagesUnit = "BytesPerSecond" + UsagesUnitCount UsagesUnit = "Count" + UsagesUnitCountPerSecond UsagesUnit = "CountPerSecond" + UsagesUnitPercent UsagesUnit = "Percent" + UsagesUnitSeconds UsagesUnit = "Seconds" +) + +func PossibleValuesForUsagesUnit() []string { + return []string{ + string(UsagesUnitBytes), + string(UsagesUnitBytesPerSecond), + string(UsagesUnitCount), + string(UsagesUnitCountPerSecond), + string(UsagesUnitPercent), + string(UsagesUnitSeconds), + } +} + +func parseUsagesUnit(input string) (*UsagesUnit, error) { + vals := map[string]UsagesUnit{ + "bytes": UsagesUnitBytes, + "bytespersecond": UsagesUnitBytesPerSecond, + "count": UsagesUnitCount, + "countpersecond": UsagesUnitCountPerSecond, + "percent": UsagesUnitPercent, + "seconds": UsagesUnitSeconds, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UsagesUnit(input) + return &out, nil +} + +type ValidationStatus string + +const ( + ValidationStatusFailed ValidationStatus = "Failed" + ValidationStatusInvalid ValidationStatus = "Invalid" + ValidationStatusSucceeded ValidationStatus = "Succeeded" +) + +func PossibleValuesForValidationStatus() []string { + return []string{ + string(ValidationStatusFailed), + string(ValidationStatusInvalid), + string(ValidationStatusSucceeded), + } +} + +func parseValidationStatus(input string) (*ValidationStatus, error) { + vals := map[string]ValidationStatus{ + "failed": ValidationStatusFailed, + "invalid": ValidationStatusInvalid, + "succeeded": ValidationStatusSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ValidationStatus(input) + return &out, nil +} + +type WorkloadItemType string + +const ( + WorkloadItemTypeInvalid WorkloadItemType = "Invalid" + WorkloadItemTypeSAPAseDatabase WorkloadItemType = "SAPAseDatabase" + WorkloadItemTypeSAPAseSystem WorkloadItemType = "SAPAseSystem" + WorkloadItemTypeSAPHanaDBInstance WorkloadItemType = "SAPHanaDBInstance" + WorkloadItemTypeSAPHanaDatabase WorkloadItemType = "SAPHanaDatabase" + WorkloadItemTypeSAPHanaSystem WorkloadItemType = "SAPHanaSystem" + WorkloadItemTypeSQLDataBase WorkloadItemType = "SQLDataBase" + WorkloadItemTypeSQLInstance WorkloadItemType = "SQLInstance" +) + +func PossibleValuesForWorkloadItemType() []string { + return []string{ + string(WorkloadItemTypeInvalid), + string(WorkloadItemTypeSAPAseDatabase), + string(WorkloadItemTypeSAPAseSystem), + string(WorkloadItemTypeSAPHanaDBInstance), + string(WorkloadItemTypeSAPHanaDatabase), + string(WorkloadItemTypeSAPHanaSystem), + string(WorkloadItemTypeSQLDataBase), + string(WorkloadItemTypeSQLInstance), + } +} + +func parseWorkloadItemType(input string) (*WorkloadItemType, error) { + vals := map[string]WorkloadItemType{ + "invalid": WorkloadItemTypeInvalid, + "sapasedatabase": WorkloadItemTypeSAPAseDatabase, + "sapasesystem": WorkloadItemTypeSAPAseSystem, + "saphanadbinstance": WorkloadItemTypeSAPHanaDBInstance, + "saphanadatabase": WorkloadItemTypeSAPHanaDatabase, + "saphanasystem": WorkloadItemTypeSAPHanaSystem, + "sqldatabase": WorkloadItemTypeSQLDataBase, + "sqlinstance": WorkloadItemTypeSQLInstance, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WorkloadItemType(input) + return &out, nil +} + +type WorkloadType string + +const ( + WorkloadTypeAzureFileShare WorkloadType = "AzureFileShare" + WorkloadTypeAzureSqlDb WorkloadType = "AzureSqlDb" + WorkloadTypeClient WorkloadType = "Client" + WorkloadTypeExchange WorkloadType = "Exchange" + WorkloadTypeFileFolder WorkloadType = "FileFolder" + WorkloadTypeGenericDataSource WorkloadType = "GenericDataSource" + WorkloadTypeInvalid WorkloadType = "Invalid" + WorkloadTypeSAPAseDatabase WorkloadType = "SAPAseDatabase" + WorkloadTypeSAPHanaDBInstance WorkloadType = "SAPHanaDBInstance" + WorkloadTypeSAPHanaDatabase WorkloadType = "SAPHanaDatabase" + WorkloadTypeSQLDB WorkloadType = "SQLDB" + WorkloadTypeSQLDataBase WorkloadType = "SQLDataBase" + WorkloadTypeSharepoint WorkloadType = "Sharepoint" + WorkloadTypeSystemState WorkloadType = "SystemState" + WorkloadTypeVM WorkloadType = "VM" + WorkloadTypeVMwareVM WorkloadType = "VMwareVM" +) + +func PossibleValuesForWorkloadType() []string { + return []string{ + string(WorkloadTypeAzureFileShare), + string(WorkloadTypeAzureSqlDb), + string(WorkloadTypeClient), + string(WorkloadTypeExchange), + string(WorkloadTypeFileFolder), + string(WorkloadTypeGenericDataSource), + string(WorkloadTypeInvalid), + string(WorkloadTypeSAPAseDatabase), + string(WorkloadTypeSAPHanaDBInstance), + string(WorkloadTypeSAPHanaDatabase), + string(WorkloadTypeSQLDB), + string(WorkloadTypeSQLDataBase), + string(WorkloadTypeSharepoint), + string(WorkloadTypeSystemState), + string(WorkloadTypeVM), + string(WorkloadTypeVMwareVM), + } +} + +func parseWorkloadType(input string) (*WorkloadType, error) { + vals := map[string]WorkloadType{ + "azurefileshare": WorkloadTypeAzureFileShare, + "azuresqldb": WorkloadTypeAzureSqlDb, + "client": WorkloadTypeClient, + "exchange": WorkloadTypeExchange, + "filefolder": WorkloadTypeFileFolder, + "genericdatasource": WorkloadTypeGenericDataSource, + "invalid": WorkloadTypeInvalid, + "sapasedatabase": WorkloadTypeSAPAseDatabase, + "saphanadbinstance": WorkloadTypeSAPHanaDBInstance, + "saphanadatabase": WorkloadTypeSAPHanaDatabase, + "sqldb": WorkloadTypeSQLDB, + "sqldatabase": WorkloadTypeSQLDataBase, + "sharepoint": WorkloadTypeSharepoint, + "systemstate": WorkloadTypeSystemState, + "vm": WorkloadTypeVM, + "vmwarevm": WorkloadTypeVMwareVM, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WorkloadType(input) + return &out, nil +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectioncontainers/id_backupfabric.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/id_backupfabric.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/protectioncontainers/id_backupfabric.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/id_backupfabric.go index 54027e95d42..cf00f6c61e6 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectioncontainers/id_backupfabric.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/id_backupfabric.go @@ -1,4 +1,4 @@ -package protectioncontainers +package bms import ( "fmt" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectioncontainers/id_backupfabric_test.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/id_backupfabric_test.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/protectioncontainers/id_backupfabric_test.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/id_backupfabric_test.go index b5023fb6f57..de304726677 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectioncontainers/id_backupfabric_test.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/id_backupfabric_test.go @@ -1,4 +1,4 @@ -package protectioncontainers +package bms import ( "testing" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/id_backupfabric.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/id_backupoperation.go similarity index 56% rename from resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/id_backupfabric.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/id_backupoperation.go index 6771b5d5025..23a0142c497 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/id_backupfabric.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/id_backupoperation.go @@ -1,4 +1,4 @@ -package protectablecontainers +package bms import ( "fmt" @@ -12,38 +12,38 @@ import ( // Licensed under the MIT License. See NOTICE.txt in the project root for license information. func init() { - recaser.RegisterResourceId(&BackupFabricId{}) + recaser.RegisterResourceId(&BackupOperationId{}) } -var _ resourceids.ResourceId = &BackupFabricId{} +var _ resourceids.ResourceId = &BackupOperationId{} -// BackupFabricId is a struct representing the Resource ID for a Backup Fabric -type BackupFabricId struct { +// BackupOperationId is a struct representing the Resource ID for a Backup Operation +type BackupOperationId struct { SubscriptionId string ResourceGroupName string VaultName string - BackupFabricName string + OperationId string } -// NewBackupFabricID returns a new BackupFabricId struct -func NewBackupFabricID(subscriptionId string, resourceGroupName string, vaultName string, backupFabricName string) BackupFabricId { - return BackupFabricId{ +// NewBackupOperationID returns a new BackupOperationId struct +func NewBackupOperationID(subscriptionId string, resourceGroupName string, vaultName string, operationId string) BackupOperationId { + return BackupOperationId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, VaultName: vaultName, - BackupFabricName: backupFabricName, + OperationId: operationId, } } -// ParseBackupFabricID parses 'input' into a BackupFabricId -func ParseBackupFabricID(input string) (*BackupFabricId, error) { - parser := resourceids.NewParserFromResourceIdType(&BackupFabricId{}) +// ParseBackupOperationID parses 'input' into a BackupOperationId +func ParseBackupOperationID(input string) (*BackupOperationId, error) { + parser := resourceids.NewParserFromResourceIdType(&BackupOperationId{}) parsed, err := parser.Parse(input, false) if err != nil { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - id := BackupFabricId{} + id := BackupOperationId{} if err = id.FromParseResult(*parsed); err != nil { return nil, err } @@ -51,16 +51,16 @@ func ParseBackupFabricID(input string) (*BackupFabricId, error) { return &id, nil } -// ParseBackupFabricIDInsensitively parses 'input' case-insensitively into a BackupFabricId +// ParseBackupOperationIDInsensitively parses 'input' case-insensitively into a BackupOperationId // note: this method should only be used for API response data and not user input -func ParseBackupFabricIDInsensitively(input string) (*BackupFabricId, error) { - parser := resourceids.NewParserFromResourceIdType(&BackupFabricId{}) +func ParseBackupOperationIDInsensitively(input string) (*BackupOperationId, error) { + parser := resourceids.NewParserFromResourceIdType(&BackupOperationId{}) parsed, err := parser.Parse(input, true) if err != nil { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - id := BackupFabricId{} + id := BackupOperationId{} if err = id.FromParseResult(*parsed); err != nil { return nil, err } @@ -68,7 +68,7 @@ func ParseBackupFabricIDInsensitively(input string) (*BackupFabricId, error) { return &id, nil } -func (id *BackupFabricId) FromParseResult(input resourceids.ParseResult) error { +func (id *BackupOperationId) FromParseResult(input resourceids.ParseResult) error { var ok bool if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { @@ -83,36 +83,36 @@ func (id *BackupFabricId) FromParseResult(input resourceids.ParseResult) error { return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } return nil } -// ValidateBackupFabricID checks that 'input' can be parsed as a Backup Fabric ID -func ValidateBackupFabricID(input interface{}, key string) (warnings []string, errors []error) { +// ValidateBackupOperationID checks that 'input' can be parsed as a Backup Operation ID +func ValidateBackupOperationID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) if !ok { errors = append(errors, fmt.Errorf("expected %q to be a string", key)) return } - if _, err := ParseBackupFabricID(v); err != nil { + if _, err := ParseBackupOperationID(v); err != nil { errors = append(errors, err) } return } -// ID returns the formatted Backup Fabric ID -func (id BackupFabricId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s/backupFabrics/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.BackupFabricName) +// ID returns the formatted Backup Operation ID +func (id BackupOperationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s/backupOperations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.OperationId) } -// Segments returns a slice of Resource ID Segments which comprise this Backup Fabric ID -func (id BackupFabricId) Segments() []resourceids.Segment { +// Segments returns a slice of Resource ID Segments which comprise this Backup Operation ID +func (id BackupOperationId) Segments() []resourceids.Segment { return []resourceids.Segment{ resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), @@ -122,18 +122,18 @@ func (id BackupFabricId) Segments() []resourceids.Segment { resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), resourceids.StaticSegment("staticVaults", "vaults", "vaults"), resourceids.UserSpecifiedSegment("vaultName", "vaultName"), - resourceids.StaticSegment("staticBackupFabrics", "backupFabrics", "backupFabrics"), - resourceids.UserSpecifiedSegment("backupFabricName", "backupFabricName"), + resourceids.StaticSegment("staticBackupOperations", "backupOperations", "backupOperations"), + resourceids.UserSpecifiedSegment("operationId", "operationId"), } } -// String returns a human-readable description of this Backup Fabric ID -func (id BackupFabricId) String() string { +// String returns a human-readable description of this Backup Operation ID +func (id BackupOperationId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), fmt.Sprintf("Vault Name: %q", id.VaultName), - fmt.Sprintf("Backup Fabric Name: %q", id.BackupFabricName), + fmt.Sprintf("Operation: %q", id.OperationId), } - return fmt.Sprintf("Backup Fabric (%s)", strings.Join(components, "\n")) + return fmt.Sprintf("Backup Operation (%s)", strings.Join(components, "\n")) } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/id_backupfabric_test.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/id_backupoperation_test.go similarity index 81% rename from resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/id_backupfabric_test.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/id_backupoperation_test.go index 1d43607add8..d80176d33d7 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/id_backupfabric_test.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/id_backupoperation_test.go @@ -1,4 +1,4 @@ -package protectablecontainers +package bms import ( "testing" @@ -9,10 +9,10 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -var _ resourceids.ResourceId = &BackupFabricId{} +var _ resourceids.ResourceId = &BackupOperationId{} -func TestNewBackupFabricID(t *testing.T) { - id := NewBackupFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "backupFabricName") +func TestNewBackupOperationID(t *testing.T) { + id := NewBackupOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "operationId") if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") @@ -26,24 +26,24 @@ func TestNewBackupFabricID(t *testing.T) { t.Fatalf("Expected %q but got %q for Segment 'VaultName'", id.VaultName, "vaultName") } - if id.BackupFabricName != "backupFabricName" { - t.Fatalf("Expected %q but got %q for Segment 'BackupFabricName'", id.BackupFabricName, "backupFabricName") + if id.OperationId != "operationId" { + t.Fatalf("Expected %q but got %q for Segment 'OperationId'", id.OperationId, "operationId") } } -func TestFormatBackupFabricID(t *testing.T) { - actual := NewBackupFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "backupFabricName").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics/backupFabricName" +func TestFormatBackupOperationID(t *testing.T) { + actual := NewBackupOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "operationId").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupOperations/operationId" if actual != expected { t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) } } -func TestParseBackupFabricID(t *testing.T) { +func TestParseBackupOperationID(t *testing.T) { testData := []struct { Input string Error bool - Expected *BackupFabricId + Expected *BackupOperationId }{ { // Incomplete URI @@ -92,29 +92,29 @@ func TestParseBackupFabricID(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupOperations", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics/backupFabricName", - Expected: &BackupFabricId{ + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupOperations/operationId", + Expected: &BackupOperationId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroupName: "example-resource-group", VaultName: "vaultName", - BackupFabricName: "backupFabricName", + OperationId: "operationId", }, }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics/backupFabricName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupOperations/operationId/extra", Error: true, }, } for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ParseBackupFabricID(v.Input) + actual, err := ParseBackupOperationID(v.Input) if err != nil { if v.Error { continue @@ -138,18 +138,18 @@ func TestParseBackupFabricID(t *testing.T) { t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) } - if actual.BackupFabricName != v.Expected.BackupFabricName { - t.Fatalf("Expected %q but got %q for BackupFabricName", v.Expected.BackupFabricName, actual.BackupFabricName) + if actual.OperationId != v.Expected.OperationId { + t.Fatalf("Expected %q but got %q for OperationId", v.Expected.OperationId, actual.OperationId) } } } -func TestParseBackupFabricIDInsensitively(t *testing.T) { +func TestParseBackupOperationIDInsensitively(t *testing.T) { testData := []struct { Input string Error bool - Expected *BackupFabricId + Expected *BackupOperationId }{ { // Incomplete URI @@ -238,49 +238,49 @@ func TestParseBackupFabricIDInsensitively(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupOperations", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/bAcKuPfAbRiCs", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/bAcKuPoPeRaTiOnS", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics/backupFabricName", - Expected: &BackupFabricId{ + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupOperations/operationId", + Expected: &BackupOperationId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroupName: "example-resource-group", VaultName: "vaultName", - BackupFabricName: "backupFabricName", + OperationId: "operationId", }, }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics/backupFabricName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupOperations/operationId/extra", Error: true, }, { // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/bAcKuPfAbRiCs/bAcKuPfAbRiCnAmE", - Expected: &BackupFabricId{ + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/bAcKuPoPeRaTiOnS/oPeRaTiOnId", + Expected: &BackupOperationId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", VaultName: "vAuLtNaMe", - BackupFabricName: "bAcKuPfAbRiCnAmE", + OperationId: "oPeRaTiOnId", }, }, { // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/bAcKuPfAbRiCs/bAcKuPfAbRiCnAmE/extra", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/bAcKuPoPeRaTiOnS/oPeRaTiOnId/extra", Error: true, }, } for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ParseBackupFabricIDInsensitively(v.Input) + actual, err := ParseBackupOperationIDInsensitively(v.Input) if err != nil { if v.Error { continue @@ -304,17 +304,17 @@ func TestParseBackupFabricIDInsensitively(t *testing.T) { t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) } - if actual.BackupFabricName != v.Expected.BackupFabricName { - t.Fatalf("Expected %q but got %q for BackupFabricName", v.Expected.BackupFabricName, actual.BackupFabricName) + if actual.OperationId != v.Expected.OperationId { + t.Fatalf("Expected %q but got %q for OperationId", v.Expected.OperationId, actual.OperationId) } } } -func TestSegmentsForBackupFabricId(t *testing.T) { - segments := BackupFabricId{}.Segments() +func TestSegmentsForBackupOperationId(t *testing.T) { + segments := BackupOperationId{}.Segments() if len(segments) == 0 { - t.Fatalf("BackupFabricId has no segments") + t.Fatalf("BackupOperationId has no segments") } uniqueNames := make(map[string]struct{}, 0) diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/id_vault.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/id_backupvalidateoperationsstatus.go similarity index 50% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/id_vault.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/id_backupvalidateoperationsstatus.go index 7e8ee3ec9cc..ddea1d5c55d 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/id_backupvalidateoperationsstatus.go @@ -1,4 +1,4 @@ -package backupprotectionintent +package bms import ( "fmt" @@ -12,36 +12,38 @@ import ( // Licensed under the MIT License. See NOTICE.txt in the project root for license information. func init() { - recaser.RegisterResourceId(&VaultId{}) + recaser.RegisterResourceId(&BackupValidateOperationsStatusId{}) } -var _ resourceids.ResourceId = &VaultId{} +var _ resourceids.ResourceId = &BackupValidateOperationsStatusId{} -// VaultId is a struct representing the Resource ID for a Vault -type VaultId struct { +// BackupValidateOperationsStatusId is a struct representing the Resource ID for a Backup Validate Operations Status +type BackupValidateOperationsStatusId struct { SubscriptionId string ResourceGroupName string VaultName string + OperationId string } -// NewVaultID returns a new VaultId struct -func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { - return VaultId{ +// NewBackupValidateOperationsStatusID returns a new BackupValidateOperationsStatusId struct +func NewBackupValidateOperationsStatusID(subscriptionId string, resourceGroupName string, vaultName string, operationId string) BackupValidateOperationsStatusId { + return BackupValidateOperationsStatusId{ SubscriptionId: subscriptionId, ResourceGroupName: resourceGroupName, VaultName: vaultName, + OperationId: operationId, } } -// ParseVaultID parses 'input' into a VaultId -func ParseVaultID(input string) (*VaultId, error) { - parser := resourceids.NewParserFromResourceIdType(&VaultId{}) +// ParseBackupValidateOperationsStatusID parses 'input' into a BackupValidateOperationsStatusId +func ParseBackupValidateOperationsStatusID(input string) (*BackupValidateOperationsStatusId, error) { + parser := resourceids.NewParserFromResourceIdType(&BackupValidateOperationsStatusId{}) parsed, err := parser.Parse(input, false) if err != nil { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - id := VaultId{} + id := BackupValidateOperationsStatusId{} if err = id.FromParseResult(*parsed); err != nil { return nil, err } @@ -49,16 +51,16 @@ func ParseVaultID(input string) (*VaultId, error) { return &id, nil } -// ParseVaultIDInsensitively parses 'input' case-insensitively into a VaultId +// ParseBackupValidateOperationsStatusIDInsensitively parses 'input' case-insensitively into a BackupValidateOperationsStatusId // note: this method should only be used for API response data and not user input -func ParseVaultIDInsensitively(input string) (*VaultId, error) { - parser := resourceids.NewParserFromResourceIdType(&VaultId{}) +func ParseBackupValidateOperationsStatusIDInsensitively(input string) (*BackupValidateOperationsStatusId, error) { + parser := resourceids.NewParserFromResourceIdType(&BackupValidateOperationsStatusId{}) parsed, err := parser.Parse(input, true) if err != nil { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - id := VaultId{} + id := BackupValidateOperationsStatusId{} if err = id.FromParseResult(*parsed); err != nil { return nil, err } @@ -66,7 +68,7 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return &id, nil } -func (id *VaultId) FromParseResult(input resourceids.ParseResult) error { +func (id *BackupValidateOperationsStatusId) FromParseResult(input resourceids.ParseResult) error { var ok bool if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { @@ -81,32 +83,36 @@ func (id *VaultId) FromParseResult(input resourceids.ParseResult) error { return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) + } + return nil } -// ValidateVaultID checks that 'input' can be parsed as a Vault ID -func ValidateVaultID(input interface{}, key string) (warnings []string, errors []error) { +// ValidateBackupValidateOperationsStatusID checks that 'input' can be parsed as a Backup Validate Operations Status ID +func ValidateBackupValidateOperationsStatusID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) if !ok { errors = append(errors, fmt.Errorf("expected %q to be a string", key)) return } - if _, err := ParseVaultID(v); err != nil { + if _, err := ParseBackupValidateOperationsStatusID(v); err != nil { errors = append(errors, err) } return } -// ID returns the formatted Vault ID -func (id VaultId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) +// ID returns the formatted Backup Validate Operations Status ID +func (id BackupValidateOperationsStatusId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s/backupValidateOperationsStatuses/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.OperationId) } -// Segments returns a slice of Resource ID Segments which comprise this Vault ID -func (id VaultId) Segments() []resourceids.Segment { +// Segments returns a slice of Resource ID Segments which comprise this Backup Validate Operations Status ID +func (id BackupValidateOperationsStatusId) Segments() []resourceids.Segment { return []resourceids.Segment{ resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), @@ -116,15 +122,18 @@ func (id VaultId) Segments() []resourceids.Segment { resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), resourceids.StaticSegment("staticVaults", "vaults", "vaults"), resourceids.UserSpecifiedSegment("vaultName", "vaultName"), + resourceids.StaticSegment("staticBackupValidateOperationsStatuses", "backupValidateOperationsStatuses", "backupValidateOperationsStatuses"), + resourceids.UserSpecifiedSegment("operationId", "operationId"), } } -// String returns a human-readable description of this Vault ID -func (id VaultId) String() string { +// String returns a human-readable description of this Backup Validate Operations Status ID +func (id BackupValidateOperationsStatusId) String() string { components := []string{ fmt.Sprintf("Subscription: %q", id.SubscriptionId), fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Operation: %q", id.OperationId), } - return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) + return fmt.Sprintf("Backup Validate Operations Status (%s)", strings.Join(components, "\n")) } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/id_vault_test.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/id_backupvalidateoperationsstatus_test.go similarity index 69% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/id_vault_test.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/id_backupvalidateoperationsstatus_test.go index 827e17ae883..ee36d9be25d 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/id_vault_test.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/id_backupvalidateoperationsstatus_test.go @@ -1,4 +1,4 @@ -package backupprotectionintent +package bms import ( "testing" @@ -9,10 +9,10 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -var _ resourceids.ResourceId = &VaultId{} +var _ resourceids.ResourceId = &BackupValidateOperationsStatusId{} -func TestNewVaultID(t *testing.T) { - id := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") +func TestNewBackupValidateOperationsStatusID(t *testing.T) { + id := NewBackupValidateOperationsStatusID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "operationId") if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") @@ -25,21 +25,25 @@ func TestNewVaultID(t *testing.T) { if id.VaultName != "vaultName" { t.Fatalf("Expected %q but got %q for Segment 'VaultName'", id.VaultName, "vaultName") } + + if id.OperationId != "operationId" { + t.Fatalf("Expected %q but got %q for Segment 'OperationId'", id.OperationId, "operationId") + } } -func TestFormatVaultID(t *testing.T) { - actual := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName" +func TestFormatBackupValidateOperationsStatusID(t *testing.T) { + actual := NewBackupValidateOperationsStatusID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "operationId").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupValidateOperationsStatuses/operationId" if actual != expected { t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) } } -func TestParseVaultID(t *testing.T) { +func TestParseBackupValidateOperationsStatusID(t *testing.T) { testData := []struct { Input string Error bool - Expected *VaultId + Expected *BackupValidateOperationsStatusId }{ { // Incomplete URI @@ -82,24 +86,35 @@ func TestParseVaultID(t *testing.T) { Error: true, }, { - // Valid URI + // Incomplete URI Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Expected: &VaultId{ + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupValidateOperationsStatuses", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupValidateOperationsStatuses/operationId", + Expected: &BackupValidateOperationsStatusId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroupName: "example-resource-group", VaultName: "vaultName", + OperationId: "operationId", }, }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupValidateOperationsStatuses/operationId/extra", Error: true, }, } for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ParseVaultID(v.Input) + actual, err := ParseBackupValidateOperationsStatusID(v.Input) if err != nil { if v.Error { continue @@ -123,14 +138,18 @@ func TestParseVaultID(t *testing.T) { t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) } + if actual.OperationId != v.Expected.OperationId { + t.Fatalf("Expected %q but got %q for OperationId", v.Expected.OperationId, actual.OperationId) + } + } } -func TestParseVaultIDInsensitively(t *testing.T) { +func TestParseBackupValidateOperationsStatusIDInsensitively(t *testing.T) { testData := []struct { Input string Error bool - Expected *VaultId + Expected *BackupValidateOperationsStatusId }{ { // Incomplete URI @@ -208,38 +227,60 @@ func TestParseVaultIDInsensitively(t *testing.T) { Error: true, }, { - // Valid URI + // Incomplete URI Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Expected: &VaultId{ + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupValidateOperationsStatuses", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/bAcKuPvAlIdAtEoPeRaTiOnSsTaTuSeS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupValidateOperationsStatuses/operationId", + Expected: &BackupValidateOperationsStatusId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroupName: "example-resource-group", VaultName: "vaultName", + OperationId: "operationId", }, }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupValidateOperationsStatuses/operationId/extra", Error: true, }, { // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe", - Expected: &VaultId{ + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/bAcKuPvAlIdAtEoPeRaTiOnSsTaTuSeS/oPeRaTiOnId", + Expected: &BackupValidateOperationsStatusId{ SubscriptionId: "12345678-1234-9876-4563-123456789012", ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", VaultName: "vAuLtNaMe", + OperationId: "oPeRaTiOnId", }, }, { // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/extra", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/bAcKuPvAlIdAtEoPeRaTiOnSsTaTuSeS/oPeRaTiOnId/extra", Error: true, }, } for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ParseVaultIDInsensitively(v.Input) + actual, err := ParseBackupValidateOperationsStatusIDInsensitively(v.Input) if err != nil { if v.Error { continue @@ -263,13 +304,17 @@ func TestParseVaultIDInsensitively(t *testing.T) { t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) } + if actual.OperationId != v.Expected.OperationId { + t.Fatalf("Expected %q but got %q for OperationId", v.Expected.OperationId, actual.OperationId) + } + } } -func TestSegmentsForVaultId(t *testing.T) { - segments := VaultId{}.Segments() +func TestSegmentsForBackupValidateOperationsStatusId(t *testing.T) { + segments := BackupValidateOperationsStatusId{}.Segments() if len(segments) == 0 { - t.Fatalf("VaultId has no segments") + t.Fatalf("BackupValidateOperationsStatusId has no segments") } uniqueNames := make(map[string]struct{}, 0) diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/id_location.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/id_location.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/id_location.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/id_location.go index 417d5cf70d6..c402aa7fcb4 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/id_location.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/id_location.go @@ -1,4 +1,4 @@ -package backupstatus +package bms import ( "fmt" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/id_location_test.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/id_location_test.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/id_location_test.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/id_location_test.go index e5365b1bacb..808528bc65b 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/id_location_test.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/id_location_test.go @@ -1,4 +1,4 @@ -package backupstatus +package bms import ( "testing" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/jobs/id_vault.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/id_vault.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/jobs/id_vault.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/id_vault.go index eaa508afacb..628e1494a27 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/jobs/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/id_vault.go @@ -1,4 +1,4 @@ -package jobs +package bms import ( "fmt" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/jobs/id_vault_test.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/id_vault_test.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/jobs/id_vault_test.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/id_vault_test.go index 553cd05b262..7438042df7f 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/jobs/id_vault_test.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/id_vault_test.go @@ -1,4 +1,4 @@ -package jobs +package bms import ( "testing" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupoperationstatusesget_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupoperationstatusesget_autorest.go new file mode 100644 index 00000000000..a0d82796f16 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupoperationstatusesget_autorest.go @@ -0,0 +1,68 @@ +package bms + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupOperationStatusesGetOperationResponse struct { + HttpResponse *http.Response + Model *OperationStatus +} + +// BackupOperationStatusesGet ... +func (c BmsClient) BackupOperationStatusesGet(ctx context.Context, id BackupOperationId) (result BackupOperationStatusesGetOperationResponse, err error) { + req, err := c.preparerForBackupOperationStatusesGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupOperationStatusesGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupOperationStatusesGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForBackupOperationStatusesGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupOperationStatusesGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForBackupOperationStatusesGet prepares the BackupOperationStatusesGet request. +func (c BmsClient) preparerForBackupOperationStatusesGet(ctx context.Context, id BackupOperationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForBackupOperationStatusesGet handles the response to the BackupOperationStatusesGet request. The method always +// closes the http.Response Body. +func (c BmsClient) responderForBackupOperationStatusesGet(resp *http.Response) (result BackupOperationStatusesGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupprotectableitemslist_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupprotectableitemslist_autorest.go new file mode 100644 index 00000000000..e33f43cd926 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupprotectableitemslist_autorest.go @@ -0,0 +1,215 @@ +package bms + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupProtectableItemsListOperationResponse struct { + HttpResponse *http.Response + Model *[]WorkloadProtectableItemResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (BackupProtectableItemsListOperationResponse, error) +} + +type BackupProtectableItemsListCompleteResult struct { + Items []WorkloadProtectableItemResource +} + +func (r BackupProtectableItemsListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r BackupProtectableItemsListOperationResponse) LoadMore(ctx context.Context) (resp BackupProtectableItemsListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type BackupProtectableItemsListOperationOptions struct { + Filter *string +} + +func DefaultBackupProtectableItemsListOperationOptions() BackupProtectableItemsListOperationOptions { + return BackupProtectableItemsListOperationOptions{} +} + +func (o BackupProtectableItemsListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o BackupProtectableItemsListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + return out +} + +// BackupProtectableItemsList ... +func (c BmsClient) BackupProtectableItemsList(ctx context.Context, id VaultId, options BackupProtectableItemsListOperationOptions) (resp BackupProtectableItemsListOperationResponse, err error) { + req, err := c.preparerForBackupProtectableItemsList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectableItemsList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectableItemsList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForBackupProtectableItemsList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectableItemsList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForBackupProtectableItemsList prepares the BackupProtectableItemsList request. +func (c BmsClient) preparerForBackupProtectableItemsList(ctx context.Context, id VaultId, options BackupProtectableItemsListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/backupProtectableItems", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForBackupProtectableItemsListWithNextLink prepares the BackupProtectableItemsList request with the given nextLink token. +func (c BmsClient) preparerForBackupProtectableItemsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForBackupProtectableItemsList handles the response to the BackupProtectableItemsList request. The method always +// closes the http.Response Body. +func (c BmsClient) responderForBackupProtectableItemsList(resp *http.Response) (result BackupProtectableItemsListOperationResponse, err error) { + type page struct { + Values []WorkloadProtectableItemResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result BackupProtectableItemsListOperationResponse, err error) { + req, err := c.preparerForBackupProtectableItemsListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectableItemsList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectableItemsList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForBackupProtectableItemsList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectableItemsList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// BackupProtectableItemsListComplete retrieves all of the results into a single object +func (c BmsClient) BackupProtectableItemsListComplete(ctx context.Context, id VaultId, options BackupProtectableItemsListOperationOptions) (BackupProtectableItemsListCompleteResult, error) { + return c.BackupProtectableItemsListCompleteMatchingPredicate(ctx, id, options, WorkloadProtectableItemResourceOperationPredicate{}) +} + +// BackupProtectableItemsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c BmsClient) BackupProtectableItemsListCompleteMatchingPredicate(ctx context.Context, id VaultId, options BackupProtectableItemsListOperationOptions, predicate WorkloadProtectableItemResourceOperationPredicate) (resp BackupProtectableItemsListCompleteResult, err error) { + items := make([]WorkloadProtectableItemResource, 0) + + page, err := c.BackupProtectableItemsList(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := BackupProtectableItemsListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupprotecteditemslist_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupprotecteditemslist_autorest.go new file mode 100644 index 00000000000..524818a0a52 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupprotecteditemslist_autorest.go @@ -0,0 +1,215 @@ +package bms + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupProtectedItemsListOperationResponse struct { + HttpResponse *http.Response + Model *[]ProtectedItemResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (BackupProtectedItemsListOperationResponse, error) +} + +type BackupProtectedItemsListCompleteResult struct { + Items []ProtectedItemResource +} + +func (r BackupProtectedItemsListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r BackupProtectedItemsListOperationResponse) LoadMore(ctx context.Context) (resp BackupProtectedItemsListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type BackupProtectedItemsListOperationOptions struct { + Filter *string +} + +func DefaultBackupProtectedItemsListOperationOptions() BackupProtectedItemsListOperationOptions { + return BackupProtectedItemsListOperationOptions{} +} + +func (o BackupProtectedItemsListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o BackupProtectedItemsListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + return out +} + +// BackupProtectedItemsList ... +func (c BmsClient) BackupProtectedItemsList(ctx context.Context, id VaultId, options BackupProtectedItemsListOperationOptions) (resp BackupProtectedItemsListOperationResponse, err error) { + req, err := c.preparerForBackupProtectedItemsList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectedItemsList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectedItemsList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForBackupProtectedItemsList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectedItemsList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForBackupProtectedItemsList prepares the BackupProtectedItemsList request. +func (c BmsClient) preparerForBackupProtectedItemsList(ctx context.Context, id VaultId, options BackupProtectedItemsListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/backupProtectedItems", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForBackupProtectedItemsListWithNextLink prepares the BackupProtectedItemsList request with the given nextLink token. +func (c BmsClient) preparerForBackupProtectedItemsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForBackupProtectedItemsList handles the response to the BackupProtectedItemsList request. The method always +// closes the http.Response Body. +func (c BmsClient) responderForBackupProtectedItemsList(resp *http.Response) (result BackupProtectedItemsListOperationResponse, err error) { + type page struct { + Values []ProtectedItemResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result BackupProtectedItemsListOperationResponse, err error) { + req, err := c.preparerForBackupProtectedItemsListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectedItemsList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectedItemsList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForBackupProtectedItemsList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectedItemsList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// BackupProtectedItemsListComplete retrieves all of the results into a single object +func (c BmsClient) BackupProtectedItemsListComplete(ctx context.Context, id VaultId, options BackupProtectedItemsListOperationOptions) (BackupProtectedItemsListCompleteResult, error) { + return c.BackupProtectedItemsListCompleteMatchingPredicate(ctx, id, options, ProtectedItemResourceOperationPredicate{}) +} + +// BackupProtectedItemsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c BmsClient) BackupProtectedItemsListCompleteMatchingPredicate(ctx context.Context, id VaultId, options BackupProtectedItemsListOperationOptions, predicate ProtectedItemResourceOperationPredicate) (resp BackupProtectedItemsListCompleteResult, err error) { + items := make([]ProtectedItemResource, 0) + + page, err := c.BackupProtectedItemsList(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := BackupProtectedItemsListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupprotectioncontainerslist_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupprotectioncontainerslist_autorest.go new file mode 100644 index 00000000000..616bee3e814 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupprotectioncontainerslist_autorest.go @@ -0,0 +1,215 @@ +package bms + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupProtectionContainersListOperationResponse struct { + HttpResponse *http.Response + Model *[]ProtectionContainerResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (BackupProtectionContainersListOperationResponse, error) +} + +type BackupProtectionContainersListCompleteResult struct { + Items []ProtectionContainerResource +} + +func (r BackupProtectionContainersListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r BackupProtectionContainersListOperationResponse) LoadMore(ctx context.Context) (resp BackupProtectionContainersListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type BackupProtectionContainersListOperationOptions struct { + Filter *string +} + +func DefaultBackupProtectionContainersListOperationOptions() BackupProtectionContainersListOperationOptions { + return BackupProtectionContainersListOperationOptions{} +} + +func (o BackupProtectionContainersListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o BackupProtectionContainersListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + return out +} + +// BackupProtectionContainersList ... +func (c BmsClient) BackupProtectionContainersList(ctx context.Context, id VaultId, options BackupProtectionContainersListOperationOptions) (resp BackupProtectionContainersListOperationResponse, err error) { + req, err := c.preparerForBackupProtectionContainersList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectionContainersList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectionContainersList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForBackupProtectionContainersList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectionContainersList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForBackupProtectionContainersList prepares the BackupProtectionContainersList request. +func (c BmsClient) preparerForBackupProtectionContainersList(ctx context.Context, id VaultId, options BackupProtectionContainersListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/backupProtectionContainers", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForBackupProtectionContainersListWithNextLink prepares the BackupProtectionContainersList request with the given nextLink token. +func (c BmsClient) preparerForBackupProtectionContainersListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForBackupProtectionContainersList handles the response to the BackupProtectionContainersList request. The method always +// closes the http.Response Body. +func (c BmsClient) responderForBackupProtectionContainersList(resp *http.Response) (result BackupProtectionContainersListOperationResponse, err error) { + type page struct { + Values []ProtectionContainerResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result BackupProtectionContainersListOperationResponse, err error) { + req, err := c.preparerForBackupProtectionContainersListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectionContainersList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectionContainersList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForBackupProtectionContainersList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectionContainersList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// BackupProtectionContainersListComplete retrieves all of the results into a single object +func (c BmsClient) BackupProtectionContainersListComplete(ctx context.Context, id VaultId, options BackupProtectionContainersListOperationOptions) (BackupProtectionContainersListCompleteResult, error) { + return c.BackupProtectionContainersListCompleteMatchingPredicate(ctx, id, options, ProtectionContainerResourceOperationPredicate{}) +} + +// BackupProtectionContainersListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c BmsClient) BackupProtectionContainersListCompleteMatchingPredicate(ctx context.Context, id VaultId, options BackupProtectionContainersListOperationOptions, predicate ProtectionContainerResourceOperationPredicate) (resp BackupProtectionContainersListCompleteResult, err error) { + items := make([]ProtectionContainerResource, 0) + + page, err := c.BackupProtectionContainersList(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := BackupProtectionContainersListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupprotectionintentlist_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupprotectionintentlist_autorest.go new file mode 100644 index 00000000000..739ac6d8dde --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupprotectionintentlist_autorest.go @@ -0,0 +1,215 @@ +package bms + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupProtectionIntentListOperationResponse struct { + HttpResponse *http.Response + Model *[]ProtectionIntentResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (BackupProtectionIntentListOperationResponse, error) +} + +type BackupProtectionIntentListCompleteResult struct { + Items []ProtectionIntentResource +} + +func (r BackupProtectionIntentListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r BackupProtectionIntentListOperationResponse) LoadMore(ctx context.Context) (resp BackupProtectionIntentListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type BackupProtectionIntentListOperationOptions struct { + Filter *string +} + +func DefaultBackupProtectionIntentListOperationOptions() BackupProtectionIntentListOperationOptions { + return BackupProtectionIntentListOperationOptions{} +} + +func (o BackupProtectionIntentListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o BackupProtectionIntentListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + return out +} + +// BackupProtectionIntentList ... +func (c BmsClient) BackupProtectionIntentList(ctx context.Context, id VaultId, options BackupProtectionIntentListOperationOptions) (resp BackupProtectionIntentListOperationResponse, err error) { + req, err := c.preparerForBackupProtectionIntentList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectionIntentList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectionIntentList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForBackupProtectionIntentList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectionIntentList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForBackupProtectionIntentList prepares the BackupProtectionIntentList request. +func (c BmsClient) preparerForBackupProtectionIntentList(ctx context.Context, id VaultId, options BackupProtectionIntentListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/backupProtectionIntents", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForBackupProtectionIntentListWithNextLink prepares the BackupProtectionIntentList request with the given nextLink token. +func (c BmsClient) preparerForBackupProtectionIntentListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForBackupProtectionIntentList handles the response to the BackupProtectionIntentList request. The method always +// closes the http.Response Body. +func (c BmsClient) responderForBackupProtectionIntentList(resp *http.Response) (result BackupProtectionIntentListOperationResponse, err error) { + type page struct { + Values []ProtectionIntentResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result BackupProtectionIntentListOperationResponse, err error) { + req, err := c.preparerForBackupProtectionIntentListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectionIntentList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectionIntentList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForBackupProtectionIntentList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupProtectionIntentList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// BackupProtectionIntentListComplete retrieves all of the results into a single object +func (c BmsClient) BackupProtectionIntentListComplete(ctx context.Context, id VaultId, options BackupProtectionIntentListOperationOptions) (BackupProtectionIntentListCompleteResult, error) { + return c.BackupProtectionIntentListCompleteMatchingPredicate(ctx, id, options, ProtectionIntentResourceOperationPredicate{}) +} + +// BackupProtectionIntentListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c BmsClient) BackupProtectionIntentListCompleteMatchingPredicate(ctx context.Context, id VaultId, options BackupProtectionIntentListOperationOptions, predicate ProtectionIntentResourceOperationPredicate) (resp BackupProtectionIntentListCompleteResult, err error) { + items := make([]ProtectionIntentResource, 0) + + page, err := c.BackupProtectionIntentList(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := BackupProtectionIntentListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/method_get_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupstatusget_autorest.go similarity index 51% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/method_get_autorest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupstatusget_autorest.go index 5bdbd049ea0..e8df789e036 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/method_get_autorest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupstatusget_autorest.go @@ -1,4 +1,4 @@ -package backupstatus +package bms import ( "context" @@ -12,36 +12,36 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type GetOperationResponse struct { +type BackupStatusGetOperationResponse struct { HttpResponse *http.Response Model *BackupStatusResponse } -// Get ... -func (c BackupStatusClient) Get(ctx context.Context, id LocationId, input BackupStatusRequest) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id, input) +// BackupStatusGet ... +func (c BmsClient) BackupStatusGet(ctx context.Context, id LocationId, input BackupStatusRequest) (result BackupStatusGetOperationResponse, err error) { + req, err := c.preparerForBackupStatusGet(ctx, id, input) if err != nil { - err = autorest.NewErrorWithError(err, "backupstatus.BackupStatusClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupStatusGet", nil, "Failure preparing request") return } result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { - err = autorest.NewErrorWithError(err, "backupstatus.BackupStatusClient", "Get", result.HttpResponse, "Failure sending request") + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupStatusGet", result.HttpResponse, "Failure sending request") return } - result, err = c.responderForGet(result.HttpResponse) + result, err = c.responderForBackupStatusGet(result.HttpResponse) if err != nil { - err = autorest.NewErrorWithError(err, "backupstatus.BackupStatusClient", "Get", result.HttpResponse, "Failure responding to request") + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupStatusGet", result.HttpResponse, "Failure responding to request") return } return } -// preparerForGet prepares the Get request. -func (c BackupStatusClient) preparerForGet(ctx context.Context, id LocationId, input BackupStatusRequest) (*http.Request, error) { +// preparerForBackupStatusGet prepares the BackupStatusGet request. +func (c BmsClient) preparerForBackupStatusGet(ctx context.Context, id LocationId, input BackupStatusRequest) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -56,9 +56,9 @@ func (c BackupStatusClient) preparerForGet(ctx context.Context, id LocationId, i return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// responderForGet handles the response to the Get request. The method always +// responderForBackupStatusGet handles the response to the BackupStatusGet request. The method always // closes the http.Response Body. -func (c BackupStatusClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { +func (c BmsClient) responderForBackupStatusGet(resp *http.Response) (result BackupStatusGetOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupusagesummarieslist_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupusagesummarieslist_autorest.go new file mode 100644 index 00000000000..db93b9934b3 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_backupusagesummarieslist_autorest.go @@ -0,0 +1,215 @@ +package bms + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupUsageSummariesListOperationResponse struct { + HttpResponse *http.Response + Model *[]BackupManagementUsage + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (BackupUsageSummariesListOperationResponse, error) +} + +type BackupUsageSummariesListCompleteResult struct { + Items []BackupManagementUsage +} + +func (r BackupUsageSummariesListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r BackupUsageSummariesListOperationResponse) LoadMore(ctx context.Context) (resp BackupUsageSummariesListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type BackupUsageSummariesListOperationOptions struct { + Filter *string +} + +func DefaultBackupUsageSummariesListOperationOptions() BackupUsageSummariesListOperationOptions { + return BackupUsageSummariesListOperationOptions{} +} + +func (o BackupUsageSummariesListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o BackupUsageSummariesListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + return out +} + +// BackupUsageSummariesList ... +func (c BmsClient) BackupUsageSummariesList(ctx context.Context, id VaultId, options BackupUsageSummariesListOperationOptions) (resp BackupUsageSummariesListOperationResponse, err error) { + req, err := c.preparerForBackupUsageSummariesList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupUsageSummariesList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupUsageSummariesList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForBackupUsageSummariesList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupUsageSummariesList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForBackupUsageSummariesList prepares the BackupUsageSummariesList request. +func (c BmsClient) preparerForBackupUsageSummariesList(ctx context.Context, id VaultId, options BackupUsageSummariesListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/backupUsageSummaries", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForBackupUsageSummariesListWithNextLink prepares the BackupUsageSummariesList request with the given nextLink token. +func (c BmsClient) preparerForBackupUsageSummariesListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForBackupUsageSummariesList handles the response to the BackupUsageSummariesList request. The method always +// closes the http.Response Body. +func (c BmsClient) responderForBackupUsageSummariesList(resp *http.Response) (result BackupUsageSummariesListOperationResponse, err error) { + type page struct { + Values []BackupManagementUsage `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result BackupUsageSummariesListOperationResponse, err error) { + req, err := c.preparerForBackupUsageSummariesListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupUsageSummariesList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupUsageSummariesList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForBackupUsageSummariesList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "BackupUsageSummariesList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// BackupUsageSummariesListComplete retrieves all of the results into a single object +func (c BmsClient) BackupUsageSummariesListComplete(ctx context.Context, id VaultId, options BackupUsageSummariesListOperationOptions) (BackupUsageSummariesListCompleteResult, error) { + return c.BackupUsageSummariesListCompleteMatchingPredicate(ctx, id, options, BackupManagementUsageOperationPredicate{}) +} + +// BackupUsageSummariesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c BmsClient) BackupUsageSummariesListCompleteMatchingPredicate(ctx context.Context, id VaultId, options BackupUsageSummariesListOperationOptions, predicate BackupManagementUsageOperationPredicate) (resp BackupUsageSummariesListCompleteResult, err error) { + items := make([]BackupManagementUsage, 0) + + page, err := c.BackupUsageSummariesList(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := BackupUsageSummariesListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/method_deletedprotectioncontainerslist_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_deletedprotectioncontainerslist_autorest.go similarity index 70% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/method_deletedprotectioncontainerslist_autorest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/method_deletedprotectioncontainerslist_autorest.go index 412ffcc44a7..87bf2a11345 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/method_deletedprotectioncontainerslist_autorest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_deletedprotectioncontainerslist_autorest.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms import ( "context" @@ -62,29 +62,29 @@ func (o DeletedProtectionContainersListOperationOptions) toQueryString() map[str } // DeletedProtectionContainersList ... -func (c SoftDeletedContainersClient) DeletedProtectionContainersList(ctx context.Context, id VaultId, options DeletedProtectionContainersListOperationOptions) (resp DeletedProtectionContainersListOperationResponse, err error) { +func (c BmsClient) DeletedProtectionContainersList(ctx context.Context, id VaultId, options DeletedProtectionContainersListOperationOptions) (resp DeletedProtectionContainersListOperationResponse, err error) { req, err := c.preparerForDeletedProtectionContainersList(ctx, id, options) if err != nil { - err = autorest.NewErrorWithError(err, "softdeletedcontainers.SoftDeletedContainersClient", "DeletedProtectionContainersList", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "bms.BmsClient", "DeletedProtectionContainersList", nil, "Failure preparing request") return } resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { - err = autorest.NewErrorWithError(err, "softdeletedcontainers.SoftDeletedContainersClient", "DeletedProtectionContainersList", resp.HttpResponse, "Failure sending request") + err = autorest.NewErrorWithError(err, "bms.BmsClient", "DeletedProtectionContainersList", resp.HttpResponse, "Failure sending request") return } resp, err = c.responderForDeletedProtectionContainersList(resp.HttpResponse) if err != nil { - err = autorest.NewErrorWithError(err, "softdeletedcontainers.SoftDeletedContainersClient", "DeletedProtectionContainersList", resp.HttpResponse, "Failure responding to request") + err = autorest.NewErrorWithError(err, "bms.BmsClient", "DeletedProtectionContainersList", resp.HttpResponse, "Failure responding to request") return } return } // preparerForDeletedProtectionContainersList prepares the DeletedProtectionContainersList request. -func (c SoftDeletedContainersClient) preparerForDeletedProtectionContainersList(ctx context.Context, id VaultId, options DeletedProtectionContainersListOperationOptions) (*http.Request, error) { +func (c BmsClient) preparerForDeletedProtectionContainersList(ctx context.Context, id VaultId, options DeletedProtectionContainersListOperationOptions) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -104,7 +104,7 @@ func (c SoftDeletedContainersClient) preparerForDeletedProtectionContainersList( } // preparerForDeletedProtectionContainersListWithNextLink prepares the DeletedProtectionContainersList request with the given nextLink token. -func (c SoftDeletedContainersClient) preparerForDeletedProtectionContainersListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { +func (c BmsClient) preparerForDeletedProtectionContainersListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { uri, err := url.Parse(nextLink) if err != nil { return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) @@ -130,7 +130,7 @@ func (c SoftDeletedContainersClient) preparerForDeletedProtectionContainersListW // responderForDeletedProtectionContainersList handles the response to the DeletedProtectionContainersList request. The method always // closes the http.Response Body. -func (c SoftDeletedContainersClient) responderForDeletedProtectionContainersList(resp *http.Response) (result DeletedProtectionContainersListOperationResponse, err error) { +func (c BmsClient) responderForDeletedProtectionContainersList(resp *http.Response) (result DeletedProtectionContainersListOperationResponse, err error) { type page struct { Values []ProtectionContainerResource `json:"value"` NextLink *string `json:"nextLink"` @@ -148,19 +148,19 @@ func (c SoftDeletedContainersClient) responderForDeletedProtectionContainersList result.nextPageFunc = func(ctx context.Context, nextLink string) (result DeletedProtectionContainersListOperationResponse, err error) { req, err := c.preparerForDeletedProtectionContainersListWithNextLink(ctx, nextLink) if err != nil { - err = autorest.NewErrorWithError(err, "softdeletedcontainers.SoftDeletedContainersClient", "DeletedProtectionContainersList", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "bms.BmsClient", "DeletedProtectionContainersList", nil, "Failure preparing request") return } result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { - err = autorest.NewErrorWithError(err, "softdeletedcontainers.SoftDeletedContainersClient", "DeletedProtectionContainersList", result.HttpResponse, "Failure sending request") + err = autorest.NewErrorWithError(err, "bms.BmsClient", "DeletedProtectionContainersList", result.HttpResponse, "Failure sending request") return } result, err = c.responderForDeletedProtectionContainersList(result.HttpResponse) if err != nil { - err = autorest.NewErrorWithError(err, "softdeletedcontainers.SoftDeletedContainersClient", "DeletedProtectionContainersList", result.HttpResponse, "Failure responding to request") + err = autorest.NewErrorWithError(err, "bms.BmsClient", "DeletedProtectionContainersList", result.HttpResponse, "Failure responding to request") return } @@ -171,12 +171,12 @@ func (c SoftDeletedContainersClient) responderForDeletedProtectionContainersList } // DeletedProtectionContainersListComplete retrieves all of the results into a single object -func (c SoftDeletedContainersClient) DeletedProtectionContainersListComplete(ctx context.Context, id VaultId, options DeletedProtectionContainersListOperationOptions) (DeletedProtectionContainersListCompleteResult, error) { +func (c BmsClient) DeletedProtectionContainersListComplete(ctx context.Context, id VaultId, options DeletedProtectionContainersListOperationOptions) (DeletedProtectionContainersListCompleteResult, error) { return c.DeletedProtectionContainersListCompleteMatchingPredicate(ctx, id, options, ProtectionContainerResourceOperationPredicate{}) } // DeletedProtectionContainersListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c SoftDeletedContainersClient) DeletedProtectionContainersListCompleteMatchingPredicate(ctx context.Context, id VaultId, options DeletedProtectionContainersListOperationOptions, predicate ProtectionContainerResourceOperationPredicate) (resp DeletedProtectionContainersListCompleteResult, err error) { +func (c BmsClient) DeletedProtectionContainersListCompleteMatchingPredicate(ctx context.Context, id VaultId, options DeletedProtectionContainersListOperationOptions, predicate ProtectionContainerResourceOperationPredicate) (resp DeletedProtectionContainersListCompleteResult, err error) { items := make([]ProtectionContainerResource, 0) page, err := c.DeletedProtectionContainersList(ctx, id, options) diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_featuresupportvalidate_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_featuresupportvalidate_autorest.go new file mode 100644 index 00000000000..e6b18c6d090 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_featuresupportvalidate_autorest.go @@ -0,0 +1,70 @@ +package bms + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FeatureSupportValidateOperationResponse struct { + HttpResponse *http.Response + Model *AzureVMResourceFeatureSupportResponse +} + +// FeatureSupportValidate ... +func (c BmsClient) FeatureSupportValidate(ctx context.Context, id LocationId, input FeatureSupportRequest) (result FeatureSupportValidateOperationResponse, err error) { + req, err := c.preparerForFeatureSupportValidate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "FeatureSupportValidate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "FeatureSupportValidate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForFeatureSupportValidate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "FeatureSupportValidate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForFeatureSupportValidate prepares the FeatureSupportValidate request. +func (c BmsClient) preparerForFeatureSupportValidate(ctx context.Context, id LocationId, input FeatureSupportRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/backupValidateFeatures", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForFeatureSupportValidate handles the response to the FeatureSupportValidate request. The method always +// closes the http.Response Body. +func (c BmsClient) responderForFeatureSupportValidate(resp *http.Response) (result FeatureSupportValidateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_fetchtieringcostpost_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_fetchtieringcostpost_autorest.go new file mode 100644 index 00000000000..8844717bb3f --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_fetchtieringcostpost_autorest.go @@ -0,0 +1,80 @@ +package bms + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FetchTieringCostPostOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response + Model *TieringCostInfo +} + +// FetchTieringCostPost ... +func (c BmsClient) FetchTieringCostPost(ctx context.Context, id VaultId, input FetchTieringCostInfoRequest) (result FetchTieringCostPostOperationResponse, err error) { + req, err := c.preparerForFetchTieringCostPost(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "FetchTieringCostPost", nil, "Failure preparing request") + return + } + + result, err = c.senderForFetchTieringCostPost(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "FetchTieringCostPost", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// FetchTieringCostPostThenPoll performs FetchTieringCostPost then polls until it's completed +func (c BmsClient) FetchTieringCostPostThenPoll(ctx context.Context, id VaultId, input FetchTieringCostInfoRequest) error { + result, err := c.FetchTieringCostPost(ctx, id, input) + if err != nil { + return fmt.Errorf("performing FetchTieringCostPost: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after FetchTieringCostPost: %+v", err) + } + + return nil +} + +// preparerForFetchTieringCostPost prepares the FetchTieringCostPost request. +func (c BmsClient) preparerForFetchTieringCostPost(ctx context.Context, id VaultId, input FetchTieringCostInfoRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/backupTieringCost/default/fetchTieringCost", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForFetchTieringCostPost sends the FetchTieringCostPost request. The method will close the +// http.Response Body if it receives an error. +func (c BmsClient) senderForFetchTieringCostPost(ctx context.Context, req *http.Request) (future FetchTieringCostPostOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/jobs/method_export_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_jobsexport_autorest.go similarity index 51% rename from resource-manager/recoveryservicesbackup/2025-02-01/jobs/method_export_autorest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/method_jobsexport_autorest.go index d6662857fa9..3624cf91bb7 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/jobs/method_export_autorest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_jobsexport_autorest.go @@ -1,4 +1,4 @@ -package jobs +package bms import ( "context" @@ -12,25 +12,25 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type ExportOperationResponse struct { +type JobsExportOperationResponse struct { HttpResponse *http.Response } -type ExportOperationOptions struct { +type JobsExportOperationOptions struct { Filter *string } -func DefaultExportOperationOptions() ExportOperationOptions { - return ExportOperationOptions{} +func DefaultJobsExportOperationOptions() JobsExportOperationOptions { + return JobsExportOperationOptions{} } -func (o ExportOperationOptions) toHeaders() map[string]interface{} { +func (o JobsExportOperationOptions) toHeaders() map[string]interface{} { out := make(map[string]interface{}) return out } -func (o ExportOperationOptions) toQueryString() map[string]interface{} { +func (o JobsExportOperationOptions) toQueryString() map[string]interface{} { out := make(map[string]interface{}) if o.Filter != nil { @@ -40,31 +40,31 @@ func (o ExportOperationOptions) toQueryString() map[string]interface{} { return out } -// Export ... -func (c JobsClient) Export(ctx context.Context, id VaultId, options ExportOperationOptions) (result ExportOperationResponse, err error) { - req, err := c.preparerForExport(ctx, id, options) +// JobsExport ... +func (c BmsClient) JobsExport(ctx context.Context, id VaultId, options JobsExportOperationOptions) (result JobsExportOperationResponse, err error) { + req, err := c.preparerForJobsExport(ctx, id, options) if err != nil { - err = autorest.NewErrorWithError(err, "jobs.JobsClient", "Export", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "bms.BmsClient", "JobsExport", nil, "Failure preparing request") return } result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { - err = autorest.NewErrorWithError(err, "jobs.JobsClient", "Export", result.HttpResponse, "Failure sending request") + err = autorest.NewErrorWithError(err, "bms.BmsClient", "JobsExport", result.HttpResponse, "Failure sending request") return } - result, err = c.responderForExport(result.HttpResponse) + result, err = c.responderForJobsExport(result.HttpResponse) if err != nil { - err = autorest.NewErrorWithError(err, "jobs.JobsClient", "Export", result.HttpResponse, "Failure responding to request") + err = autorest.NewErrorWithError(err, "bms.BmsClient", "JobsExport", result.HttpResponse, "Failure responding to request") return } return } -// preparerForExport prepares the Export request. -func (c JobsClient) preparerForExport(ctx context.Context, id VaultId, options ExportOperationOptions) (*http.Request, error) { +// preparerForJobsExport prepares the JobsExport request. +func (c BmsClient) preparerForJobsExport(ctx context.Context, id VaultId, options JobsExportOperationOptions) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -83,9 +83,9 @@ func (c JobsClient) preparerForExport(ctx context.Context, id VaultId, options E return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// responderForExport handles the response to the Export request. The method always +// responderForJobsExport handles the response to the JobsExport request. The method always // closes the http.Response Body. -func (c JobsClient) responderForExport(resp *http.Response) (result ExportOperationResponse, err error) { +func (c BmsClient) responderForJobsExport(resp *http.Response) (result JobsExportOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusAccepted), diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/method_validate_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_operationvalidate_autorest.go similarity index 50% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/method_validate_autorest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/method_operationvalidate_autorest.go index 05bac629ddd..6b924c98df9 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/method_validate_autorest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_operationvalidate_autorest.go @@ -1,4 +1,4 @@ -package operation +package bms import ( "context" @@ -12,36 +12,36 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type ValidateOperationApiResponse struct { +type OperationValidateOperationResponse struct { HttpResponse *http.Response Model *ValidateOperationsResponse } -// Validate ... -func (c OperationClient) Validate(ctx context.Context, id VaultId, input ValidateOperationRequestResource) (result ValidateOperationApiResponse, err error) { - req, err := c.preparerForValidate(ctx, id, input) +// OperationValidate ... +func (c BmsClient) OperationValidate(ctx context.Context, id VaultId, input ValidateOperationRequestResource) (result OperationValidateOperationResponse, err error) { + req, err := c.preparerForOperationValidate(ctx, id, input) if err != nil { - err = autorest.NewErrorWithError(err, "operation.OperationClient", "Validate", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "bms.BmsClient", "OperationValidate", nil, "Failure preparing request") return } result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { - err = autorest.NewErrorWithError(err, "operation.OperationClient", "Validate", result.HttpResponse, "Failure sending request") + err = autorest.NewErrorWithError(err, "bms.BmsClient", "OperationValidate", result.HttpResponse, "Failure sending request") return } - result, err = c.responderForValidate(result.HttpResponse) + result, err = c.responderForOperationValidate(result.HttpResponse) if err != nil { - err = autorest.NewErrorWithError(err, "operation.OperationClient", "Validate", result.HttpResponse, "Failure responding to request") + err = autorest.NewErrorWithError(err, "bms.BmsClient", "OperationValidate", result.HttpResponse, "Failure responding to request") return } return } -// preparerForValidate prepares the Validate request. -func (c OperationClient) preparerForValidate(ctx context.Context, id VaultId, input ValidateOperationRequestResource) (*http.Request, error) { +// preparerForOperationValidate prepares the OperationValidate request. +func (c BmsClient) preparerForOperationValidate(ctx context.Context, id VaultId, input ValidateOperationRequestResource) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -56,9 +56,9 @@ func (c OperationClient) preparerForValidate(ctx context.Context, id VaultId, in return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// responderForValidate handles the response to the Validate request. The method always +// responderForOperationValidate handles the response to the OperationValidate request. The method always // closes the http.Response Body. -func (c OperationClient) responderForValidate(resp *http.Response) (result ValidateOperationApiResponse, err error) { +func (c BmsClient) responderForOperationValidate(resp *http.Response) (result OperationValidateOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_protectablecontainerslist_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_protectablecontainerslist_autorest.go new file mode 100644 index 00000000000..ae274182040 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_protectablecontainerslist_autorest.go @@ -0,0 +1,215 @@ +package bms + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProtectableContainersListOperationResponse struct { + HttpResponse *http.Response + Model *[]ProtectableContainerResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ProtectableContainersListOperationResponse, error) +} + +type ProtectableContainersListCompleteResult struct { + Items []ProtectableContainerResource +} + +func (r ProtectableContainersListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ProtectableContainersListOperationResponse) LoadMore(ctx context.Context) (resp ProtectableContainersListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ProtectableContainersListOperationOptions struct { + Filter *string +} + +func DefaultProtectableContainersListOperationOptions() ProtectableContainersListOperationOptions { + return ProtectableContainersListOperationOptions{} +} + +func (o ProtectableContainersListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ProtectableContainersListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + return out +} + +// ProtectableContainersList ... +func (c BmsClient) ProtectableContainersList(ctx context.Context, id BackupFabricId, options ProtectableContainersListOperationOptions) (resp ProtectableContainersListOperationResponse, err error) { + req, err := c.preparerForProtectableContainersList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "ProtectableContainersList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "ProtectableContainersList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForProtectableContainersList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "ProtectableContainersList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForProtectableContainersList prepares the ProtectableContainersList request. +func (c BmsClient) preparerForProtectableContainersList(ctx context.Context, id BackupFabricId, options ProtectableContainersListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/protectableContainers", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForProtectableContainersListWithNextLink prepares the ProtectableContainersList request with the given nextLink token. +func (c BmsClient) preparerForProtectableContainersListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForProtectableContainersList handles the response to the ProtectableContainersList request. The method always +// closes the http.Response Body. +func (c BmsClient) responderForProtectableContainersList(resp *http.Response) (result ProtectableContainersListOperationResponse, err error) { + type page struct { + Values []ProtectableContainerResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ProtectableContainersListOperationResponse, err error) { + req, err := c.preparerForProtectableContainersListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "ProtectableContainersList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "ProtectableContainersList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForProtectableContainersList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "ProtectableContainersList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ProtectableContainersListComplete retrieves all of the results into a single object +func (c BmsClient) ProtectableContainersListComplete(ctx context.Context, id BackupFabricId, options ProtectableContainersListOperationOptions) (ProtectableContainersListCompleteResult, error) { + return c.ProtectableContainersListCompleteMatchingPredicate(ctx, id, options, ProtectableContainerResourceOperationPredicate{}) +} + +// ProtectableContainersListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c BmsClient) ProtectableContainersListCompleteMatchingPredicate(ctx context.Context, id BackupFabricId, options ProtectableContainersListOperationOptions, predicate ProtectableContainerResourceOperationPredicate) (resp ProtectableContainersListCompleteResult, err error) { + items := make([]ProtectableContainerResource, 0) + + page, err := c.ProtectableContainersList(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ProtectableContainersListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_protectioncontainersrefresh_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_protectioncontainersrefresh_autorest.go new file mode 100644 index 00000000000..573395f07fc --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_protectioncontainersrefresh_autorest.go @@ -0,0 +1,96 @@ +package bms + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProtectionContainersRefreshOperationResponse struct { + HttpResponse *http.Response +} + +type ProtectionContainersRefreshOperationOptions struct { + Filter *string +} + +func DefaultProtectionContainersRefreshOperationOptions() ProtectionContainersRefreshOperationOptions { + return ProtectionContainersRefreshOperationOptions{} +} + +func (o ProtectionContainersRefreshOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ProtectionContainersRefreshOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + return out +} + +// ProtectionContainersRefresh ... +func (c BmsClient) ProtectionContainersRefresh(ctx context.Context, id BackupFabricId, options ProtectionContainersRefreshOperationOptions) (result ProtectionContainersRefreshOperationResponse, err error) { + req, err := c.preparerForProtectionContainersRefresh(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "ProtectionContainersRefresh", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "ProtectionContainersRefresh", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForProtectionContainersRefresh(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "ProtectionContainersRefresh", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForProtectionContainersRefresh prepares the ProtectionContainersRefresh request. +func (c BmsClient) preparerForProtectionContainersRefresh(ctx context.Context, id BackupFabricId, options ProtectionContainersRefreshOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/refreshContainers", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForProtectionContainersRefresh handles the response to the ProtectionContainersRefresh request. The method always +// closes the http.Response Body. +func (c BmsClient) responderForProtectionContainersRefresh(resp *http.Response) (result ProtectionContainersRefreshOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusAccepted), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_protectionintentvalidate_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_protectionintentvalidate_autorest.go new file mode 100644 index 00000000000..31f6ad47c06 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_protectionintentvalidate_autorest.go @@ -0,0 +1,70 @@ +package bms + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProtectionIntentValidateOperationResponse struct { + HttpResponse *http.Response + Model *PreValidateEnableBackupResponse +} + +// ProtectionIntentValidate ... +func (c BmsClient) ProtectionIntentValidate(ctx context.Context, id LocationId, input PreValidateEnableBackupRequest) (result ProtectionIntentValidateOperationResponse, err error) { + req, err := c.preparerForProtectionIntentValidate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "ProtectionIntentValidate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "ProtectionIntentValidate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForProtectionIntentValidate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "ProtectionIntentValidate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForProtectionIntentValidate prepares the ProtectionIntentValidate request. +func (c BmsClient) preparerForProtectionIntentValidate(ctx context.Context, id LocationId, input PreValidateEnableBackupRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/backupPreValidateProtection", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForProtectionIntentValidate handles the response to the ProtectionIntentValidate request. The method always +// closes the http.Response Body. +func (c BmsClient) responderForProtectionIntentValidate(resp *http.Response) (result ProtectionIntentValidateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/securitypins/method_get_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_securitypinsget_autorest.go similarity index 51% rename from resource-manager/recoveryservicesbackup/2025-02-01/securitypins/method_get_autorest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/method_securitypinsget_autorest.go index 7680900edb8..78e084cf854 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/securitypins/method_get_autorest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_securitypinsget_autorest.go @@ -1,4 +1,4 @@ -package securitypins +package bms import ( "context" @@ -12,20 +12,20 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type GetOperationResponse struct { +type SecurityPINsGetOperationResponse struct { HttpResponse *http.Response Model *TokenInformation } -type GetOperationOptions struct { +type SecurityPINsGetOperationOptions struct { XMsAuthorizationAuxiliary *string } -func DefaultGetOperationOptions() GetOperationOptions { - return GetOperationOptions{} +func DefaultSecurityPINsGetOperationOptions() SecurityPINsGetOperationOptions { + return SecurityPINsGetOperationOptions{} } -func (o GetOperationOptions) toHeaders() map[string]interface{} { +func (o SecurityPINsGetOperationOptions) toHeaders() map[string]interface{} { out := make(map[string]interface{}) if o.XMsAuthorizationAuxiliary != nil { @@ -35,37 +35,37 @@ func (o GetOperationOptions) toHeaders() map[string]interface{} { return out } -func (o GetOperationOptions) toQueryString() map[string]interface{} { +func (o SecurityPINsGetOperationOptions) toQueryString() map[string]interface{} { out := make(map[string]interface{}) return out } -// Get ... -func (c SecurityPINsClient) Get(ctx context.Context, id VaultId, input SecurityPinBase, options GetOperationOptions) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id, input, options) +// SecurityPINsGet ... +func (c BmsClient) SecurityPINsGet(ctx context.Context, id VaultId, input SecurityPinBase, options SecurityPINsGetOperationOptions) (result SecurityPINsGetOperationResponse, err error) { + req, err := c.preparerForSecurityPINsGet(ctx, id, input, options) if err != nil { - err = autorest.NewErrorWithError(err, "securitypins.SecurityPINsClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "bms.BmsClient", "SecurityPINsGet", nil, "Failure preparing request") return } result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { - err = autorest.NewErrorWithError(err, "securitypins.SecurityPINsClient", "Get", result.HttpResponse, "Failure sending request") + err = autorest.NewErrorWithError(err, "bms.BmsClient", "SecurityPINsGet", result.HttpResponse, "Failure sending request") return } - result, err = c.responderForGet(result.HttpResponse) + result, err = c.responderForSecurityPINsGet(result.HttpResponse) if err != nil { - err = autorest.NewErrorWithError(err, "securitypins.SecurityPINsClient", "Get", result.HttpResponse, "Failure responding to request") + err = autorest.NewErrorWithError(err, "bms.BmsClient", "SecurityPINsGet", result.HttpResponse, "Failure responding to request") return } return } -// preparerForGet prepares the Get request. -func (c SecurityPINsClient) preparerForGet(ctx context.Context, id VaultId, input SecurityPinBase, options GetOperationOptions) (*http.Request, error) { +// preparerForSecurityPINsGet prepares the SecurityPINsGet request. +func (c BmsClient) preparerForSecurityPINsGet(ctx context.Context, id VaultId, input SecurityPinBase, options SecurityPINsGetOperationOptions) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -85,9 +85,9 @@ func (c SecurityPINsClient) preparerForGet(ctx context.Context, id VaultId, inpu return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// responderForGet handles the response to the Get request. The method always +// responderForSecurityPINsGet handles the response to the SecurityPINsGet request. The method always // closes the http.Response Body. -func (c SecurityPINsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { +func (c BmsClient) responderForSecurityPINsGet(resp *http.Response) (result SecurityPINsGetOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_validateoperationstatusesget_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_validateoperationstatusesget_autorest.go new file mode 100644 index 00000000000..110a0b1ad93 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_validateoperationstatusesget_autorest.go @@ -0,0 +1,68 @@ +package bms + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ValidateOperationStatusesGetOperationResponse struct { + HttpResponse *http.Response + Model *OperationStatus +} + +// ValidateOperationStatusesGet ... +func (c BmsClient) ValidateOperationStatusesGet(ctx context.Context, id BackupValidateOperationsStatusId) (result ValidateOperationStatusesGetOperationResponse, err error) { + req, err := c.preparerForValidateOperationStatusesGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "ValidateOperationStatusesGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "ValidateOperationStatusesGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForValidateOperationStatusesGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "ValidateOperationStatusesGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForValidateOperationStatusesGet prepares the ValidateOperationStatusesGet request. +func (c BmsClient) preparerForValidateOperationStatusesGet(ctx context.Context, id BackupValidateOperationsStatusId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForValidateOperationStatusesGet handles the response to the ValidateOperationStatusesGet request. The method always +// closes the http.Response Body. +func (c BmsClient) responderForValidateOperationStatusesGet(resp *http.Response) (result ValidateOperationStatusesGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_validateoperationtrigger_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_validateoperationtrigger_autorest.go new file mode 100644 index 00000000000..e9f0fef37f8 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/method_validateoperationtrigger_autorest.go @@ -0,0 +1,79 @@ +package bms + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ValidateOperationTriggerOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ValidateOperationTrigger ... +func (c BmsClient) ValidateOperationTrigger(ctx context.Context, id VaultId, input ValidateOperationRequestResource) (result ValidateOperationTriggerOperationResponse, err error) { + req, err := c.preparerForValidateOperationTrigger(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "ValidateOperationTrigger", nil, "Failure preparing request") + return + } + + result, err = c.senderForValidateOperationTrigger(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "bms.BmsClient", "ValidateOperationTrigger", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ValidateOperationTriggerThenPoll performs ValidateOperationTrigger then polls until it's completed +func (c BmsClient) ValidateOperationTriggerThenPoll(ctx context.Context, id VaultId, input ValidateOperationRequestResource) error { + result, err := c.ValidateOperationTrigger(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ValidateOperationTrigger: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ValidateOperationTrigger: %+v", err) + } + + return nil +} + +// preparerForValidateOperationTrigger prepares the ValidateOperationTrigger request. +func (c BmsClient) preparerForValidateOperationTrigger(ctx context.Context, id VaultId, input ValidateOperationRequestResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/backupTriggerValidateOperation", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForValidateOperationTrigger sends the ValidateOperationTrigger request. The method will close the +// http.Response Body if it receives an error. +func (c BmsClient) senderForValidateOperationTrigger(ctx context.Context, req *http.Request) (future ValidateOperationTriggerOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/model_azurebackupgoalfeaturesupportrequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurebackupgoalfeaturesupportrequest.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/model_azurebackupgoalfeaturesupportrequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurebackupgoalfeaturesupportrequest.go index ecc777b3d84..d0bd149a603 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/model_azurebackupgoalfeaturesupportrequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurebackupgoalfeaturesupportrequest.go @@ -1,4 +1,4 @@ -package featuresupport +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azurebackupservercontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurebackupservercontainer.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azurebackupservercontainer.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurebackupservercontainer.go index a69df42e95d..ee7466ca991 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azurebackupservercontainer.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurebackupservercontainer.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurefileshareprotectableitem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurefileshareprotectableitem.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurefileshareprotectableitem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurefileshareprotectableitem.go index 542f5632c6a..517c7ce1abf 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurefileshareprotectableitem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurefileshareprotectableitem.go @@ -1,4 +1,4 @@ -package backupprotectableitems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurefileshareprotecteditem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurefileshareprotecteditem.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurefileshareprotecteditem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurefileshareprotecteditem.go index f912c83a9d5..9fee2c2aca2 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurefileshareprotecteditem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurefileshareprotecteditem.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurefileshareprotecteditemextendedinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurefileshareprotecteditemextendedinfo.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurefileshareprotecteditemextendedinfo.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurefileshareprotecteditemextendedinfo.go index 784dbda1d5d..3e741343f21 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurefileshareprotecteditemextendedinfo.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurefileshareprotecteditemextendedinfo.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms import ( "time" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azurefilesharerestorerequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurefilesharerestorerequest.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azurefilesharerestorerequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurefilesharerestorerequest.go index db4906bc43b..bafc92ebaa2 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azurefilesharerestorerequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurefilesharerestorerequest.go @@ -1,4 +1,4 @@ -package operation +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azureiaasclassiccomputevmcontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaasclassiccomputevmcontainer.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azureiaasclassiccomputevmcontainer.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaasclassiccomputevmcontainer.go index f71ebe1ecbc..e62e4b70948 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azureiaasclassiccomputevmcontainer.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaasclassiccomputevmcontainer.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azureiaasclassiccomputevmprotectableitem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaasclassiccomputevmprotectableitem.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azureiaasclassiccomputevmprotectableitem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaasclassiccomputevmprotectableitem.go index 783ca6ce6b1..c100462c11f 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azureiaasclassiccomputevmprotectableitem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaasclassiccomputevmprotectableitem.go @@ -1,4 +1,4 @@ -package backupprotectableitems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azureiaasclassiccomputevmprotecteditem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaasclassiccomputevmprotecteditem.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azureiaasclassiccomputevmprotecteditem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaasclassiccomputevmprotecteditem.go index ca6e8d6944f..7c2eef145ed 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azureiaasclassiccomputevmprotecteditem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaasclassiccomputevmprotecteditem.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azureiaascomputevmcontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaascomputevmcontainer.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azureiaascomputevmcontainer.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaascomputevmcontainer.go index b44b93046f3..6c38e7e329c 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azureiaascomputevmcontainer.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaascomputevmcontainer.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azureiaascomputevmprotectableitem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaascomputevmprotectableitem.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azureiaascomputevmprotectableitem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaascomputevmprotectableitem.go index 01d84ff8f83..233f6017082 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azureiaascomputevmprotectableitem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaascomputevmprotectableitem.go @@ -1,4 +1,4 @@ -package backupprotectableitems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azureiaascomputevmprotecteditem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaascomputevmprotecteditem.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azureiaascomputevmprotecteditem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaascomputevmprotecteditem.go index a61b1f5970c..c72de261934 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azureiaascomputevmprotecteditem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaascomputevmprotecteditem.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azureiaasvmprotecteditem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaasvmprotecteditem.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azureiaasvmprotecteditem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaasvmprotecteditem.go index 0c5dd77f86f..d0df32e7d8a 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azureiaasvmprotecteditem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaasvmprotecteditem.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azureiaasvmprotecteditemextendedinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaasvmprotecteditemextendedinfo.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azureiaasvmprotecteditemextendedinfo.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaasvmprotecteditemextendedinfo.go index f9bd89ad856..206c6b380a9 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azureiaasvmprotecteditemextendedinfo.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureiaasvmprotecteditemextendedinfo.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms import ( "time" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_azurerecoveryservicevaultprotectionintent.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurerecoveryservicevaultprotectionintent.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_azurerecoveryservicevaultprotectionintent.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurerecoveryservicevaultprotectionintent.go index 7d06a8fd30b..2b8e0220d4b 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_azurerecoveryservicevaultprotectionintent.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurerecoveryservicevaultprotectionintent.go @@ -1,4 +1,4 @@ -package protectionintent +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_azureresourceprotectionintent.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureresourceprotectionintent.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_azureresourceprotectionintent.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureresourceprotectionintent.go index a757f8703aa..e9560dc9866 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_azureresourceprotectionintent.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureresourceprotectionintent.go @@ -1,4 +1,4 @@ -package protectionintent +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azuresqlagworkloadcontainerprotectioncontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azuresqlagworkloadcontainerprotectioncontainer.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azuresqlagworkloadcontainerprotectioncontainer.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azuresqlagworkloadcontainerprotectioncontainer.go index aab5648fb34..6b2bb3ec835 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azuresqlagworkloadcontainerprotectioncontainer.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azuresqlagworkloadcontainerprotectioncontainer.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azuresqlcontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azuresqlcontainer.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azuresqlcontainer.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azuresqlcontainer.go index 62794d1b909..0b136af9c4c 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azuresqlcontainer.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azuresqlcontainer.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azuresqlprotecteditem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azuresqlprotecteditem.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azuresqlprotecteditem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azuresqlprotecteditem.go index a07c8b44ee2..c6507de53e4 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azuresqlprotecteditem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azuresqlprotecteditem.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azuresqlprotecteditemextendedinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azuresqlprotecteditemextendedinfo.go similarity index 96% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azuresqlprotecteditemextendedinfo.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azuresqlprotecteditemextendedinfo.go index 1f95cebc98c..e32a9c558ff 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azuresqlprotecteditemextendedinfo.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azuresqlprotecteditemextendedinfo.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms import ( "time" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azurestoragecontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurestoragecontainer.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azurestoragecontainer.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurestoragecontainer.go index eb1cee72ad3..4b55b388210 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azurestoragecontainer.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurestoragecontainer.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/model_azurestorageprotectablecontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurestorageprotectablecontainer.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/model_azurestorageprotectablecontainer.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurestorageprotectablecontainer.go index 21518eff5f8..e6c4fffae0e 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/model_azurestorageprotectablecontainer.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurestorageprotectablecontainer.go @@ -1,4 +1,4 @@ -package protectablecontainers +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/model_azurevmappcontainerprotectablecontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmappcontainerprotectablecontainer.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/model_azurevmappcontainerprotectablecontainer.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmappcontainerprotectablecontainer.go index 10ed7c1a1fe..f981d6c404c 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/model_azurevmappcontainerprotectablecontainer.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmappcontainerprotectablecontainer.go @@ -1,4 +1,4 @@ -package protectablecontainers +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azurevmappcontainerprotectioncontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmappcontainerprotectioncontainer.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azurevmappcontainerprotectioncontainer.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmappcontainerprotectioncontainer.go index 8dad4ff2e28..5f43afccd28 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azurevmappcontainerprotectioncontainer.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmappcontainerprotectioncontainer.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/model_azurevmresourcefeaturesupportrequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmresourcefeaturesupportrequest.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/model_azurevmresourcefeaturesupportrequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmresourcefeaturesupportrequest.go index 691dba6c83b..1a866a6d17e 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/model_azurevmresourcefeaturesupportrequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmresourcefeaturesupportrequest.go @@ -1,4 +1,4 @@ -package featuresupport +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/model_azurevmresourcefeaturesupportresponse.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmresourcefeaturesupportresponse.go similarity index 92% rename from resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/model_azurevmresourcefeaturesupportresponse.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmresourcefeaturesupportresponse.go index b9d8a42e54a..54fb5526e79 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/model_azurevmresourcefeaturesupportresponse.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmresourcefeaturesupportresponse.go @@ -1,4 +1,4 @@ -package featuresupport +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadprotectableitem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadprotectableitem.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadprotectableitem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadprotectableitem.go index 985a6a45b79..3d284dba4e1 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadprotectableitem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadprotectableitem.go @@ -1,4 +1,4 @@ -package backupprotectableitems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurevmworkloadprotecteditem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadprotecteditem.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurevmworkloadprotecteditem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadprotecteditem.go index f9009af809d..f284363b95b 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurevmworkloadprotecteditem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadprotecteditem.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurevmworkloadprotecteditemextendedinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadprotecteditemextendedinfo.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurevmworkloadprotecteditemextendedinfo.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadprotecteditemextendedinfo.go index 4ad1e158847..bcd7d7846d5 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurevmworkloadprotecteditemextendedinfo.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadprotecteditemextendedinfo.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms import ( "time" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsapasedatabaseprotectableitem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsapasedatabaseprotectableitem.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsapasedatabaseprotectableitem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsapasedatabaseprotectableitem.go index 81e0a9bed71..1ea75de7ad5 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsapasedatabaseprotectableitem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsapasedatabaseprotectableitem.go @@ -1,4 +1,4 @@ -package backupprotectableitems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurevmworkloadsapasedatabaseprotecteditem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsapasedatabaseprotecteditem.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurevmworkloadsapasedatabaseprotecteditem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsapasedatabaseprotecteditem.go index 83e91d8a89f..cdd5cb277a8 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurevmworkloadsapasedatabaseprotecteditem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsapasedatabaseprotecteditem.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsapasesystemprotectableitem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsapasesystemprotectableitem.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsapasesystemprotectableitem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsapasesystemprotectableitem.go index 57392564a47..19d7e9e2177 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsapasesystemprotectableitem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsapasesystemprotectableitem.go @@ -1,4 +1,4 @@ -package backupprotectableitems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsaphanadatabaseprotectableitem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsaphanadatabaseprotectableitem.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsaphanadatabaseprotectableitem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsaphanadatabaseprotectableitem.go index 62eeed455f0..e4cd6c09a9e 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsaphanadatabaseprotectableitem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsaphanadatabaseprotectableitem.go @@ -1,4 +1,4 @@ -package backupprotectableitems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurevmworkloadsaphanadatabaseprotecteditem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsaphanadatabaseprotecteditem.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurevmworkloadsaphanadatabaseprotecteditem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsaphanadatabaseprotecteditem.go index eac7abbdf01..a10b585b44b 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurevmworkloadsaphanadatabaseprotecteditem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsaphanadatabaseprotecteditem.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsaphanadbinstance.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsaphanadbinstance.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsaphanadbinstance.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsaphanadbinstance.go index 85180e35a05..ad7ae485cdb 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsaphanadbinstance.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsaphanadbinstance.go @@ -1,4 +1,4 @@ -package backupprotectableitems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurevmworkloadsaphanadbinstanceprotecteditem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsaphanadbinstanceprotecteditem.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurevmworkloadsaphanadbinstanceprotecteditem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsaphanadbinstanceprotecteditem.go index b2ea4f926ff..17b92c0f395 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurevmworkloadsaphanadbinstanceprotecteditem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsaphanadbinstanceprotecteditem.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsaphanahsrprotectableitem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsaphanahsrprotectableitem.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsaphanahsrprotectableitem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsaphanahsrprotectableitem.go index 946c7b496dc..a7b2c78023a 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsaphanahsrprotectableitem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsaphanahsrprotectableitem.go @@ -1,4 +1,4 @@ -package backupprotectableitems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsaphanasystemprotectableitem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsaphanasystemprotectableitem.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsaphanasystemprotectableitem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsaphanasystemprotectableitem.go index 95c289b65ad..aa63e5a886c 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsaphanasystemprotectableitem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsaphanasystemprotectableitem.go @@ -1,4 +1,4 @@ -package backupprotectableitems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsqlavailabilitygroupprotectableitem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsqlavailabilitygroupprotectableitem.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsqlavailabilitygroupprotectableitem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsqlavailabilitygroupprotectableitem.go index 24e77bff5b3..d01b2e1e6dd 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsqlavailabilitygroupprotectableitem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsqlavailabilitygroupprotectableitem.go @@ -1,4 +1,4 @@ -package backupprotectableitems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsqldatabaseprotectableitem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsqldatabaseprotectableitem.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsqldatabaseprotectableitem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsqldatabaseprotectableitem.go index 581f20e1b17..370fc76117c 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsqldatabaseprotectableitem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsqldatabaseprotectableitem.go @@ -1,4 +1,4 @@ -package backupprotectableitems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurevmworkloadsqldatabaseprotecteditem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsqldatabaseprotecteditem.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurevmworkloadsqldatabaseprotecteditem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsqldatabaseprotecteditem.go index 54b765018f5..87e6cfee694 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_azurevmworkloadsqldatabaseprotecteditem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsqldatabaseprotecteditem.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsqlinstanceprotectableitem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsqlinstanceprotectableitem.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsqlinstanceprotectableitem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsqlinstanceprotectableitem.go index c166cb7f847..f224c672326 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_azurevmworkloadsqlinstanceprotectableitem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azurevmworkloadsqlinstanceprotectableitem.go @@ -1,4 +1,4 @@ -package backupprotectableitems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_azureworkloadautoprotectionintent.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadautoprotectionintent.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_azureworkloadautoprotectionintent.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadautoprotectionintent.go index 013e10d9ec6..51b11e20b87 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_azureworkloadautoprotectionintent.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadautoprotectionintent.go @@ -1,4 +1,4 @@ -package protectionintent +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azureworkloadcontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadcontainer.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azureworkloadcontainer.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadcontainer.go index 9004ee18921..f0dc402d5e1 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azureworkloadcontainer.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadcontainer.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_azureworkloadcontainerautoprotectionintent.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadcontainerautoprotectionintent.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_azureworkloadcontainerautoprotectionintent.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadcontainerautoprotectionintent.go index c26eec72d7e..6a10a5467a7 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_azureworkloadcontainerautoprotectionintent.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadcontainerautoprotectionintent.go @@ -1,4 +1,4 @@ -package protectionintent +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azureworkloadcontainerextendedinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadcontainerextendedinfo.go similarity index 93% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azureworkloadcontainerextendedinfo.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadcontainerextendedinfo.go index 141007ebdda..fd8a882eae2 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_azureworkloadcontainerextendedinfo.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadcontainerextendedinfo.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadpointintimerestorerequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadpointintimerestorerequest.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadpointintimerestorerequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadpointintimerestorerequest.go index 151dbed826b..fc8b06e0e87 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadpointintimerestorerequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadpointintimerestorerequest.go @@ -1,4 +1,4 @@ -package operation +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadrestorerequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadrestorerequest.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadrestorerequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadrestorerequest.go index 5fe55046185..1a1e6433b07 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadrestorerequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadrestorerequest.go @@ -1,4 +1,4 @@ -package operation +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsapasepointintimerestorerequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsapasepointintimerestorerequest.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsapasepointintimerestorerequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsapasepointintimerestorerequest.go index b61c2118864..6749382ef85 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsapasepointintimerestorerequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsapasepointintimerestorerequest.go @@ -1,4 +1,4 @@ -package operation +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsapaserestorerequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsapaserestorerequest.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsapaserestorerequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsapaserestorerequest.go index 37d3c4db792..6984af66145 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsapaserestorerequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsapaserestorerequest.go @@ -1,4 +1,4 @@ -package operation +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsaphanapointintimerestorerequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsaphanapointintimerestorerequest.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsaphanapointintimerestorerequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsaphanapointintimerestorerequest.go index 0aab6e728c2..8152b6a39b2 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsaphanapointintimerestorerequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsaphanapointintimerestorerequest.go @@ -1,4 +1,4 @@ -package operation +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsaphanapointintimerestorewithrehydraterequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsaphanapointintimerestorewithrehydraterequest.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsaphanapointintimerestorewithrehydraterequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsaphanapointintimerestorewithrehydraterequest.go index cf33fa588c6..e08194b7876 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsaphanapointintimerestorewithrehydraterequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsaphanapointintimerestorewithrehydraterequest.go @@ -1,4 +1,4 @@ -package operation +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsaphanarestorerequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsaphanarestorerequest.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsaphanarestorerequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsaphanarestorerequest.go index 94a74050cf7..28ac892f0d8 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsaphanarestorerequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsaphanarestorerequest.go @@ -1,4 +1,4 @@ -package operation +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsaphanarestorewithrehydraterequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsaphanarestorewithrehydraterequest.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsaphanarestorewithrehydraterequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsaphanarestorewithrehydraterequest.go index 3188bc547b0..2069f4727a5 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsaphanarestorewithrehydraterequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsaphanarestorewithrehydraterequest.go @@ -1,4 +1,4 @@ -package operation +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_azureworkloadsqlautoprotectionintent.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsqlautoprotectionintent.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_azureworkloadsqlautoprotectionintent.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsqlautoprotectionintent.go index 57b98ad3c99..57b01a35ae1 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_azureworkloadsqlautoprotectionintent.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsqlautoprotectionintent.go @@ -1,4 +1,4 @@ -package protectionintent +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsqlpointintimerestorerequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsqlpointintimerestorerequest.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsqlpointintimerestorerequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsqlpointintimerestorerequest.go index ac99c3316c6..e063f668062 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsqlpointintimerestorerequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsqlpointintimerestorerequest.go @@ -1,4 +1,4 @@ -package operation +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsqlpointintimerestorewithrehydraterequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsqlpointintimerestorewithrehydraterequest.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsqlpointintimerestorewithrehydraterequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsqlpointintimerestorewithrehydraterequest.go index b00fdea950a..224ae420681 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsqlpointintimerestorewithrehydraterequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsqlpointintimerestorewithrehydraterequest.go @@ -1,4 +1,4 @@ -package operation +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsqlrestorerequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsqlrestorerequest.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsqlrestorerequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsqlrestorerequest.go index ac2c490d397..21f29417331 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsqlrestorerequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsqlrestorerequest.go @@ -1,4 +1,4 @@ -package operation +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsqlrestorewithrehydraterequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsqlrestorewithrehydraterequest.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsqlrestorewithrehydraterequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsqlrestorewithrehydraterequest.go index 941f53d1277..5246b938bd9 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_azureworkloadsqlrestorewithrehydraterequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_azureworkloadsqlrestorewithrehydraterequest.go @@ -1,4 +1,4 @@ -package operation +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/model_backupmanagementusage.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_backupmanagementusage.go similarity index 97% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/model_backupmanagementusage.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_backupmanagementusage.go index decb29b6951..250d4991678 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/model_backupmanagementusage.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_backupmanagementusage.go @@ -1,4 +1,4 @@ -package backupusagesummaries +package bms import ( "time" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/model_backupstatusrequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_backupstatusrequest.go similarity index 94% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/model_backupstatusrequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_backupstatusrequest.go index 18355d1d1a4..78eee6a49f3 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/model_backupstatusrequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_backupstatusrequest.go @@ -1,4 +1,4 @@ -package backupstatus +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/model_backupstatusresponse.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_backupstatusresponse.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/model_backupstatusresponse.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_backupstatusresponse.go index 18836147a5c..39f1e896e84 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus/model_backupstatusresponse.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_backupstatusresponse.go @@ -1,4 +1,4 @@ -package backupstatus +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_clientscriptforconnect.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_clientscriptforconnect.go new file mode 100644 index 00000000000..55a23bca65d --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_clientscriptforconnect.go @@ -0,0 +1,12 @@ +package bms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClientScriptForConnect struct { + OsType *string `json:"osType,omitempty"` + ScriptContent *string `json:"scriptContent,omitempty"` + ScriptExtension *string `json:"scriptExtension,omitempty"` + ScriptNameSuffix *string `json:"scriptNameSuffix,omitempty"` + Url *string `json:"url,omitempty"` +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_containeridentityinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_containeridentityinfo.go similarity index 93% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_containeridentityinfo.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_containeridentityinfo.go index 367cba6804a..633cf01383f 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_containeridentityinfo.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_containeridentityinfo.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_diskexclusionproperties.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_diskexclusionproperties.go similarity index 91% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_diskexclusionproperties.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_diskexclusionproperties.go index f12fc0030e2..46b7a149104 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_diskexclusionproperties.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_diskexclusionproperties.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_distributednodesinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_distributednodesinfo.go similarity index 93% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_distributednodesinfo.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_distributednodesinfo.go index 739b4bcf82a..e68c62c7ca4 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_distributednodesinfo.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_distributednodesinfo.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_dpmcontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_dpmcontainer.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_dpmcontainer.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_dpmcontainer.go index d0c9d4884ea..3383880bf32 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_dpmcontainer.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_dpmcontainer.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_dpmcontainerextendedinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_dpmcontainerextendedinfo.go similarity index 95% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_dpmcontainerextendedinfo.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_dpmcontainerextendedinfo.go index c0f911a34b6..f60f0539203 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_dpmcontainerextendedinfo.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_dpmcontainerextendedinfo.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms import ( "time" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_dpmprotecteditem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_dpmprotecteditem.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_dpmprotecteditem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_dpmprotecteditem.go index a6879fabc8c..4ad0da106af 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_dpmprotecteditem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_dpmprotecteditem.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_dpmprotecteditemextendedinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_dpmprotecteditemextendedinfo.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_dpmprotecteditemextendedinfo.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_dpmprotecteditemextendedinfo.go index c28c138b06e..3b0e9d5437c 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_dpmprotecteditemextendedinfo.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_dpmprotecteditemextendedinfo.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms import ( "time" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_encryptiondetails.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_encryptiondetails.go similarity index 96% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_encryptiondetails.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_encryptiondetails.go index 503730b066e..7691d566669 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_encryptiondetails.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_encryptiondetails.go @@ -1,4 +1,4 @@ -package operation +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_errordetail.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_errordetail.go similarity index 95% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_errordetail.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_errordetail.go index 2c609c87024..c779ce7f5bb 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_errordetail.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_errordetail.go @@ -1,4 +1,4 @@ -package operation +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_extendedlocation.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_extendedlocation.go similarity index 93% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_extendedlocation.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_extendedlocation.go index 42ab6a6a9d4..26cd4cef46b 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_extendedlocation.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_extendedlocation.go @@ -1,4 +1,4 @@ -package operation +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_extendedproperties.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_extendedproperties.go similarity index 92% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_extendedproperties.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_extendedproperties.go index bd52e28b60e..46a77e6478e 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_extendedproperties.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_extendedproperties.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/model_featuresupportrequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_featuresupportrequest.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/model_featuresupportrequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_featuresupportrequest.go index 2b8b431466e..5b26e286afe 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/model_featuresupportrequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_featuresupportrequest.go @@ -1,4 +1,4 @@ -package featuresupport +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_fetchtieringcostinfoforrehydrationrequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_fetchtieringcostinfoforrehydrationrequest.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_fetchtieringcostinfoforrehydrationrequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_fetchtieringcostinfoforrehydrationrequest.go index 4fb183b3f41..89cf72ae5cb 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_fetchtieringcostinfoforrehydrationrequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_fetchtieringcostinfoforrehydrationrequest.go @@ -1,4 +1,4 @@ -package fetchtieringcost +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_fetchtieringcostinforequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_fetchtieringcostinforequest.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_fetchtieringcostinforequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_fetchtieringcostinforequest.go index 1d6371e8a60..e7abf147871 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_fetchtieringcostinforequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_fetchtieringcostinforequest.go @@ -1,4 +1,4 @@ -package fetchtieringcost +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_fetchtieringcostsavingsinfoforpolicyrequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_fetchtieringcostsavingsinfoforpolicyrequest.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_fetchtieringcostsavingsinfoforpolicyrequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_fetchtieringcostsavingsinfoforpolicyrequest.go index e9c6afb7a3a..2bcb255f3ef 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_fetchtieringcostsavingsinfoforpolicyrequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_fetchtieringcostsavingsinfoforpolicyrequest.go @@ -1,4 +1,4 @@ -package fetchtieringcost +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_fetchtieringcostsavingsinfoforprotecteditemrequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_fetchtieringcostsavingsinfoforprotecteditemrequest.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_fetchtieringcostsavingsinfoforprotecteditemrequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_fetchtieringcostsavingsinfoforprotecteditemrequest.go index 26bebb45e79..d67f78375e2 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_fetchtieringcostsavingsinfoforprotecteditemrequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_fetchtieringcostsavingsinfoforprotecteditemrequest.go @@ -1,4 +1,4 @@ -package fetchtieringcost +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_fetchtieringcostsavingsinfoforvaultrequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_fetchtieringcostsavingsinfoforvaultrequest.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_fetchtieringcostsavingsinfoforvaultrequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_fetchtieringcostsavingsinfoforvaultrequest.go index 16df6347d82..7730b229b88 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_fetchtieringcostsavingsinfoforvaultrequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_fetchtieringcostsavingsinfoforvaultrequest.go @@ -1,4 +1,4 @@ -package fetchtieringcost +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_genericcontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_genericcontainer.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_genericcontainer.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_genericcontainer.go index 9c4a0613590..3f4625e11d9 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_genericcontainer.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_genericcontainer.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_genericcontainerextendedinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_genericcontainerextendedinfo.go similarity index 93% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_genericcontainerextendedinfo.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_genericcontainerextendedinfo.go index 79e66b1ffda..0086b604b4e 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_genericcontainerextendedinfo.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_genericcontainerextendedinfo.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_genericprotecteditem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_genericprotecteditem.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_genericprotecteditem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_genericprotecteditem.go index 3684d9f7e1d..d94226d36b2 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_genericprotecteditem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_genericprotecteditem.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_iaasvmcontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_iaasvmcontainer.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_iaasvmcontainer.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_iaasvmcontainer.go index 1688f64cf3f..6c1d4cd1334 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_iaasvmcontainer.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_iaasvmcontainer.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_iaasvmprotectableitem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_iaasvmprotectableitem.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_iaasvmprotectableitem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_iaasvmprotectableitem.go index 17559c25e6d..e819af666ac 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_iaasvmprotectableitem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_iaasvmprotectableitem.go @@ -1,4 +1,4 @@ -package backupprotectableitems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_iaasvmrestorerequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_iaasvmrestorerequest.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_iaasvmrestorerequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_iaasvmrestorerequest.go index b949f5784b5..7f3522f6a46 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_iaasvmrestorerequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_iaasvmrestorerequest.go @@ -1,4 +1,4 @@ -package operation +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_iaasvmrestorewithrehydrationrequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_iaasvmrestorewithrehydrationrequest.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_iaasvmrestorewithrehydrationrequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_iaasvmrestorewithrehydrationrequest.go index b9a50095b8f..f6226ba7a8f 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_iaasvmrestorewithrehydrationrequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_iaasvmrestorewithrehydrationrequest.go @@ -1,4 +1,4 @@ -package operation +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_identitybasedrestoredetails.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_identitybasedrestoredetails.go similarity index 94% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_identitybasedrestoredetails.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_identitybasedrestoredetails.go index dd5d66a7e1c..c9c51bf00f5 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_identitybasedrestoredetails.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_identitybasedrestoredetails.go @@ -1,4 +1,4 @@ -package operation +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_identityinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_identityinfo.go similarity index 95% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_identityinfo.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_identityinfo.go index e6971151557..eaec946fd98 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_identityinfo.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_identityinfo.go @@ -1,4 +1,4 @@ -package operation +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_inquiryinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_inquiryinfo.go similarity index 93% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_inquiryinfo.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_inquiryinfo.go index c4d9f8360b5..ef1a923f7b8 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_inquiryinfo.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_inquiryinfo.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_inquiryvalidation.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_inquiryvalidation.go similarity index 93% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_inquiryvalidation.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_inquiryvalidation.go index 5d9553ccad7..d4ddf8ca59b 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_inquiryvalidation.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_inquiryvalidation.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_instantitemrecoverytarget.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_instantitemrecoverytarget.go new file mode 100644 index 00000000000..d421f80aad5 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_instantitemrecoverytarget.go @@ -0,0 +1,8 @@ +package bms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstantItemRecoveryTarget struct { + ClientScripts *[]ClientScriptForConnect `json:"clientScripts,omitempty"` +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_kpiresourcehealthdetails.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_kpiresourcehealthdetails.go similarity index 92% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_kpiresourcehealthdetails.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_kpiresourcehealthdetails.go index 42a11e535b9..845a0de8fa7 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_kpiresourcehealthdetails.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_kpiresourcehealthdetails.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_mabcontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_mabcontainer.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_mabcontainer.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_mabcontainer.go index df406541f1b..3354f902a3a 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_mabcontainer.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_mabcontainer.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_mabcontainerextendedinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_mabcontainerextendedinfo.go similarity index 97% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_mabcontainerextendedinfo.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_mabcontainerextendedinfo.go index a5bc672fcf2..08a8f3bab48 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_mabcontainerextendedinfo.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_mabcontainerextendedinfo.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms import ( "time" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_mabcontainerhealthdetails.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_mabcontainerhealthdetails.go similarity index 93% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_mabcontainerhealthdetails.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_mabcontainerhealthdetails.go index 8e91b126cc6..91e73f53a8d 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_mabcontainerhealthdetails.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_mabcontainerhealthdetails.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_mabfilefolderprotecteditem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_mabfilefolderprotecteditem.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_mabfilefolderprotecteditem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_mabfilefolderprotecteditem.go index e6e6d98b4ca..2a164a1801c 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_mabfilefolderprotecteditem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_mabfilefolderprotecteditem.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_mabfilefolderprotecteditemextendedinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_mabfilefolderprotecteditemextendedinfo.go similarity index 97% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_mabfilefolderprotecteditemextendedinfo.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_mabfilefolderprotecteditemextendedinfo.go index 30f88b5c2ac..1be2d3141dd 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_mabfilefolderprotecteditemextendedinfo.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_mabfilefolderprotecteditemextendedinfo.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms import ( "time" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/model_nameinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_nameinfo.go similarity index 90% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/model_nameinfo.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_nameinfo.go index 68fde56d864..4658887ae5e 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries/model_nameinfo.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_nameinfo.go @@ -1,4 +1,4 @@ -package backupusagesummaries +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatus.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatus.go new file mode 100644 index 00000000000..fd5a966bb28 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatus.go @@ -0,0 +1,84 @@ +package bms + +import ( + "encoding/json" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OperationStatus struct { + EndTime *string `json:"endTime,omitempty"` + Error *OperationStatusError `json:"error,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties OperationStatusExtendedInfo `json:"properties"` + StartTime *string `json:"startTime,omitempty"` + Status *OperationStatusValues `json:"status,omitempty"` +} + +func (o *OperationStatus) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OperationStatus) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *OperationStatus) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OperationStatus) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} + +var _ json.Unmarshaler = &OperationStatus{} + +func (s *OperationStatus) UnmarshalJSON(bytes []byte) error { + var decoded struct { + EndTime *string `json:"endTime,omitempty"` + Error *OperationStatusError `json:"error,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status *OperationStatusValues `json:"status,omitempty"` + } + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + + s.EndTime = decoded.EndTime + s.Error = decoded.Error + s.Id = decoded.Id + s.Name = decoded.Name + s.StartTime = decoded.StartTime + s.Status = decoded.Status + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling OperationStatus into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["properties"]; ok { + impl, err := UnmarshalOperationStatusExtendedInfoImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Properties' for 'OperationStatus': %+v", err) + } + s.Properties = impl + } + + return nil +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatuserror.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatuserror.go new file mode 100644 index 00000000000..d2f1b80b43d --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatuserror.go @@ -0,0 +1,9 @@ +package bms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OperationStatusError struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatusextendedinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatusextendedinfo.go new file mode 100644 index 00000000000..df313fa4657 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatusextendedinfo.go @@ -0,0 +1,99 @@ +package bms + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OperationStatusExtendedInfo interface { + OperationStatusExtendedInfo() BaseOperationStatusExtendedInfoImpl +} + +var _ OperationStatusExtendedInfo = BaseOperationStatusExtendedInfoImpl{} + +type BaseOperationStatusExtendedInfoImpl struct { + ObjectType string `json:"objectType"` +} + +func (s BaseOperationStatusExtendedInfoImpl) OperationStatusExtendedInfo() BaseOperationStatusExtendedInfoImpl { + return s +} + +var _ OperationStatusExtendedInfo = RawOperationStatusExtendedInfoImpl{} + +// RawOperationStatusExtendedInfoImpl is returned when the Discriminated Value doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawOperationStatusExtendedInfoImpl struct { + operationStatusExtendedInfo BaseOperationStatusExtendedInfoImpl + Type string + Values map[string]interface{} +} + +func (s RawOperationStatusExtendedInfoImpl) OperationStatusExtendedInfo() BaseOperationStatusExtendedInfoImpl { + return s.operationStatusExtendedInfo +} + +func UnmarshalOperationStatusExtendedInfoImplementation(input []byte) (OperationStatusExtendedInfo, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling OperationStatusExtendedInfo into map[string]interface: %+v", err) + } + + var value string + if v, ok := temp["objectType"]; ok { + value = fmt.Sprintf("%v", v) + } + + if strings.EqualFold(value, "OperationStatusJobExtendedInfo") { + var out OperationStatusJobExtendedInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into OperationStatusJobExtendedInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "OperationStatusJobsExtendedInfo") { + var out OperationStatusJobsExtendedInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into OperationStatusJobsExtendedInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "OperationStatusProvisionILRExtendedInfo") { + var out OperationStatusProvisionILRExtendedInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into OperationStatusProvisionILRExtendedInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "OperationStatusValidateOperationExtendedInfo") { + var out OperationStatusValidateOperationExtendedInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into OperationStatusValidateOperationExtendedInfo: %+v", err) + } + return out, nil + } + + var parent BaseOperationStatusExtendedInfoImpl + if err := json.Unmarshal(input, &parent); err != nil { + return nil, fmt.Errorf("unmarshaling into BaseOperationStatusExtendedInfoImpl: %+v", err) + } + + return RawOperationStatusExtendedInfoImpl{ + operationStatusExtendedInfo: parent, + Type: value, + Values: temp, + }, nil + +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatusjobextendedinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatusjobextendedinfo.go new file mode 100644 index 00000000000..afa71b5f7e7 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatusjobextendedinfo.go @@ -0,0 +1,50 @@ +package bms + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ OperationStatusExtendedInfo = OperationStatusJobExtendedInfo{} + +type OperationStatusJobExtendedInfo struct { + JobId *string `json:"jobId,omitempty"` + + // Fields inherited from OperationStatusExtendedInfo + + ObjectType string `json:"objectType"` +} + +func (s OperationStatusJobExtendedInfo) OperationStatusExtendedInfo() BaseOperationStatusExtendedInfoImpl { + return BaseOperationStatusExtendedInfoImpl{ + ObjectType: s.ObjectType, + } +} + +var _ json.Marshaler = OperationStatusJobExtendedInfo{} + +func (s OperationStatusJobExtendedInfo) MarshalJSON() ([]byte, error) { + type wrapper OperationStatusJobExtendedInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling OperationStatusJobExtendedInfo: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling OperationStatusJobExtendedInfo: %+v", err) + } + + decoded["objectType"] = "OperationStatusJobExtendedInfo" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling OperationStatusJobExtendedInfo: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatusjobsextendedinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatusjobsextendedinfo.go new file mode 100644 index 00000000000..fcfbf97284c --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatusjobsextendedinfo.go @@ -0,0 +1,51 @@ +package bms + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ OperationStatusExtendedInfo = OperationStatusJobsExtendedInfo{} + +type OperationStatusJobsExtendedInfo struct { + FailedJobsError *map[string]string `json:"failedJobsError,omitempty"` + JobIds *[]string `json:"jobIds,omitempty"` + + // Fields inherited from OperationStatusExtendedInfo + + ObjectType string `json:"objectType"` +} + +func (s OperationStatusJobsExtendedInfo) OperationStatusExtendedInfo() BaseOperationStatusExtendedInfoImpl { + return BaseOperationStatusExtendedInfoImpl{ + ObjectType: s.ObjectType, + } +} + +var _ json.Marshaler = OperationStatusJobsExtendedInfo{} + +func (s OperationStatusJobsExtendedInfo) MarshalJSON() ([]byte, error) { + type wrapper OperationStatusJobsExtendedInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling OperationStatusJobsExtendedInfo: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling OperationStatusJobsExtendedInfo: %+v", err) + } + + decoded["objectType"] = "OperationStatusJobsExtendedInfo" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling OperationStatusJobsExtendedInfo: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatusprovisionilrextendedinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatusprovisionilrextendedinfo.go new file mode 100644 index 00000000000..017304c82db --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatusprovisionilrextendedinfo.go @@ -0,0 +1,50 @@ +package bms + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ OperationStatusExtendedInfo = OperationStatusProvisionILRExtendedInfo{} + +type OperationStatusProvisionILRExtendedInfo struct { + RecoveryTarget *InstantItemRecoveryTarget `json:"recoveryTarget,omitempty"` + + // Fields inherited from OperationStatusExtendedInfo + + ObjectType string `json:"objectType"` +} + +func (s OperationStatusProvisionILRExtendedInfo) OperationStatusExtendedInfo() BaseOperationStatusExtendedInfoImpl { + return BaseOperationStatusExtendedInfoImpl{ + ObjectType: s.ObjectType, + } +} + +var _ json.Marshaler = OperationStatusProvisionILRExtendedInfo{} + +func (s OperationStatusProvisionILRExtendedInfo) MarshalJSON() ([]byte, error) { + type wrapper OperationStatusProvisionILRExtendedInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling OperationStatusProvisionILRExtendedInfo: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling OperationStatusProvisionILRExtendedInfo: %+v", err) + } + + decoded["objectType"] = "OperationStatusProvisionILRExtendedInfo" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling OperationStatusProvisionILRExtendedInfo: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatusvalidateoperationextendedinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatusvalidateoperationextendedinfo.go new file mode 100644 index 00000000000..902d2d1b885 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_operationstatusvalidateoperationextendedinfo.go @@ -0,0 +1,50 @@ +package bms + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ OperationStatusExtendedInfo = OperationStatusValidateOperationExtendedInfo{} + +type OperationStatusValidateOperationExtendedInfo struct { + ValidateOperationResponse *ValidateOperationResponse `json:"validateOperationResponse,omitempty"` + + // Fields inherited from OperationStatusExtendedInfo + + ObjectType string `json:"objectType"` +} + +func (s OperationStatusValidateOperationExtendedInfo) OperationStatusExtendedInfo() BaseOperationStatusExtendedInfoImpl { + return BaseOperationStatusExtendedInfoImpl{ + ObjectType: s.ObjectType, + } +} + +var _ json.Marshaler = OperationStatusValidateOperationExtendedInfo{} + +func (s OperationStatusValidateOperationExtendedInfo) MarshalJSON() ([]byte, error) { + type wrapper OperationStatusValidateOperationExtendedInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling OperationStatusValidateOperationExtendedInfo: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling OperationStatusValidateOperationExtendedInfo: %+v", err) + } + + decoded["objectType"] = "OperationStatusValidateOperationExtendedInfo" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling OperationStatusValidateOperationExtendedInfo: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_prebackupvalidation.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_prebackupvalidation.go similarity index 91% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_prebackupvalidation.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_prebackupvalidation.go index 955dd612808..2be72291afe 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_prebackupvalidation.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_prebackupvalidation.go @@ -1,4 +1,4 @@ -package backupprotectableitems +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_prevalidateenablebackuprequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_prevalidateenablebackuprequest.go similarity index 94% rename from resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_prevalidateenablebackuprequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_prevalidateenablebackuprequest.go index 58ac0096b74..a28dca24a5d 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_prevalidateenablebackuprequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_prevalidateenablebackuprequest.go @@ -1,4 +1,4 @@ -package protectionintent +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_prevalidateenablebackupresponse.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_prevalidateenablebackupresponse.go similarity index 96% rename from resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_prevalidateenablebackupresponse.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_prevalidateenablebackupresponse.go index 456761b757d..70c7ecca116 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_prevalidateenablebackupresponse.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_prevalidateenablebackupresponse.go @@ -1,4 +1,4 @@ -package protectionintent +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/model_protectablecontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protectablecontainer.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/model_protectablecontainer.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protectablecontainer.go index 7fb55011f30..63d0c441fed 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/model_protectablecontainer.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protectablecontainer.go @@ -1,4 +1,4 @@ -package protectablecontainers +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/model_protectablecontainerresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protectablecontainerresource.go similarity index 52% rename from resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/model_protectablecontainerresource.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protectablecontainerresource.go index 836f11dc6e9..1b61bf2934d 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/model_protectablecontainerresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protectablecontainerresource.go @@ -1,33 +1,37 @@ -package protectablecontainers +package bms import ( "encoding/json" "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" ) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProtectableContainerResource struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties ProtectableContainer `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties ProtectableContainer `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } var _ json.Unmarshaler = &ProtectableContainerResource{} func (s *ProtectableContainerResource) UnmarshalJSON(bytes []byte) error { var decoded struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -37,6 +41,7 @@ func (s *ProtectableContainerResource) UnmarshalJSON(bytes []byte) error { s.Id = decoded.Id s.Location = decoded.Location s.Name = decoded.Name + s.SystemData = decoded.SystemData s.Tags = decoded.Tags s.Type = decoded.Type diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_protecteditem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protecteditem.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_protecteditem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protecteditem.go index b825095987f..1e098b9296a 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_protecteditem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protecteditem.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_protecteditemresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protecteditemresource.go similarity index 51% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_protecteditemresource.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protecteditemresource.go index c0bee8d014a..085a777bfc8 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_protecteditemresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protecteditemresource.go @@ -1,33 +1,37 @@ -package backupprotecteditems +package bms import ( "encoding/json" "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" ) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProtectedItemResource struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties ProtectedItem `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties ProtectedItem `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } var _ json.Unmarshaler = &ProtectedItemResource{} func (s *ProtectedItemResource) UnmarshalJSON(bytes []byte) error { var decoded struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -37,6 +41,7 @@ func (s *ProtectedItemResource) UnmarshalJSON(bytes []byte) error { s.Id = decoded.Id s.Location = decoded.Location s.Name = decoded.Name + s.SystemData = decoded.SystemData s.Tags = decoded.Tags s.Type = decoded.Type diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_protectioncontainer.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protectioncontainer.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_protectioncontainer.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protectioncontainer.go index d8facb14a2f..b1a019d2d15 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_protectioncontainer.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protectioncontainer.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_protectioncontainerresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protectioncontainerresource.go similarity index 52% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_protectioncontainerresource.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protectioncontainerresource.go index 4972f653359..e712dfc40db 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers/model_protectioncontainerresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protectioncontainerresource.go @@ -1,33 +1,37 @@ -package backupprotectioncontainers +package bms import ( "encoding/json" "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" ) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProtectionContainerResource struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties ProtectionContainer `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties ProtectionContainer `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } var _ json.Unmarshaler = &ProtectionContainerResource{} func (s *ProtectionContainerResource) UnmarshalJSON(bytes []byte) error { var decoded struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -37,6 +41,7 @@ func (s *ProtectionContainerResource) UnmarshalJSON(bytes []byte) error { s.Id = decoded.Id s.Location = decoded.Location s.Name = decoded.Name + s.SystemData = decoded.SystemData s.Tags = decoded.Tags s.Type = decoded.Type diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_protectionintent.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protectionintent.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_protectionintent.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protectionintent.go index 7b15854f3c2..1f92529944d 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_protectionintent.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protectionintent.go @@ -1,4 +1,4 @@ -package protectionintent +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_protectionintentresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protectionintentresource.go similarity index 51% rename from resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_protectionintentresource.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protectionintentresource.go index c92be6a6af3..d550e8460b7 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/model_protectionintentresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_protectionintentresource.go @@ -1,33 +1,37 @@ -package protectionintent +package bms import ( "encoding/json" "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" ) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProtectionIntentResource struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties ProtectionIntent `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties ProtectionIntent `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } var _ json.Unmarshaler = &ProtectionIntentResource{} func (s *ProtectionIntentResource) UnmarshalJSON(bytes []byte) error { var decoded struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -37,6 +41,7 @@ func (s *ProtectionIntentResource) UnmarshalJSON(bytes []byte) error { s.Id = decoded.Id s.Location = decoded.Location s.Name = decoded.Name + s.SystemData = decoded.SystemData s.Tags = decoded.Tags s.Type = decoded.Type diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_recoverypointrehydrationinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_recoverypointrehydrationinfo.go similarity index 95% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_recoverypointrehydrationinfo.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_recoverypointrehydrationinfo.go index d5d028a3fe7..06b6fe7d6d9 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_recoverypointrehydrationinfo.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_recoverypointrehydrationinfo.go @@ -1,4 +1,4 @@ -package operation +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_resourcehealthdetails.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_resourcehealthdetails.go similarity index 93% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_resourcehealthdetails.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_resourcehealthdetails.go index 34cb35fbf15..b84bc5074af 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/model_resourcehealthdetails.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_resourcehealthdetails.go @@ -1,4 +1,4 @@ -package backupprotecteditems +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_restorefilespecs.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_restorefilespecs.go similarity index 95% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_restorefilespecs.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_restorefilespecs.go index 74e8852a5f7..ea7255afc8f 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_restorefilespecs.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_restorefilespecs.go @@ -1,4 +1,4 @@ -package operation +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_restorerequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_restorerequest.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_restorerequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_restorerequest.go index 3fd35747e0c..0b11f0a39c2 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_restorerequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_restorerequest.go @@ -1,4 +1,4 @@ -package operation +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_securedvmdetails.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_securedvmdetails.go similarity index 93% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_securedvmdetails.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_securedvmdetails.go index 3f5c4c4f17a..10259779ff1 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_securedvmdetails.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_securedvmdetails.go @@ -1,4 +1,4 @@ -package operation +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/securitypins/model_securitypinbase.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_securitypinbase.go similarity index 93% rename from resource-manager/recoveryservicesbackup/2025-02-01/securitypins/model_securitypinbase.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_securitypinbase.go index acc76db8d99..26d90a0c652 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/securitypins/model_securitypinbase.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_securitypinbase.go @@ -1,4 +1,4 @@ -package securitypins +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_snapshotrestoreparameters.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_snapshotrestoreparameters.go similarity index 95% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_snapshotrestoreparameters.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_snapshotrestoreparameters.go index 100aca8fc56..337dc43fb75 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_snapshotrestoreparameters.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_snapshotrestoreparameters.go @@ -1,4 +1,4 @@ -package operation +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_sqldatadirectorymapping.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_sqldatadirectorymapping.go similarity index 96% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_sqldatadirectorymapping.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_sqldatadirectorymapping.go index 9de6dd3d184..02e2a584ae3 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_sqldatadirectorymapping.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_sqldatadirectorymapping.go @@ -1,4 +1,4 @@ -package operation +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_targetafsrestoreinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_targetafsrestoreinfo.go similarity index 94% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_targetafsrestoreinfo.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_targetafsrestoreinfo.go index 56b7218e6de..5c5a2f8967e 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_targetafsrestoreinfo.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_targetafsrestoreinfo.go @@ -1,4 +1,4 @@ -package operation +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_targetdisknetworkaccesssettings.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_targetdisknetworkaccesssettings.go similarity index 95% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_targetdisknetworkaccesssettings.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_targetdisknetworkaccesssettings.go index a900401068b..2f6ad819b31 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_targetdisknetworkaccesssettings.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_targetdisknetworkaccesssettings.go @@ -1,4 +1,4 @@ -package operation +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_targetrestoreinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_targetrestoreinfo.go similarity index 96% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_targetrestoreinfo.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_targetrestoreinfo.go index 4d4171906ed..0a02e94c19f 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_targetrestoreinfo.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_targetrestoreinfo.go @@ -1,4 +1,4 @@ -package operation +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_tieringcostinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_tieringcostinfo.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_tieringcostinfo.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_tieringcostinfo.go index d0e495ce0f4..a0883f2381a 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_tieringcostinfo.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_tieringcostinfo.go @@ -1,4 +1,4 @@ -package fetchtieringcost +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_tieringcostrehydrationinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_tieringcostrehydrationinfo.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_tieringcostrehydrationinfo.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_tieringcostrehydrationinfo.go index 1fe2415f033..4e860ff83db 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_tieringcostrehydrationinfo.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_tieringcostrehydrationinfo.go @@ -1,4 +1,4 @@ -package fetchtieringcost +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_tieringcostsavinginfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_tieringcostsavinginfo.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_tieringcostsavinginfo.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_tieringcostsavinginfo.go index e9b5dbd5fc3..f8649e637c2 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/model_tieringcostsavinginfo.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_tieringcostsavinginfo.go @@ -1,4 +1,4 @@ -package fetchtieringcost +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/securitypins/model_tokeninformation.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_tokeninformation.go similarity index 94% rename from resource-manager/recoveryservicesbackup/2025-02-01/securitypins/model_tokeninformation.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_tokeninformation.go index cfebb48a56d..2b0a9275d82 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/securitypins/model_tokeninformation.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_tokeninformation.go @@ -1,4 +1,4 @@ -package securitypins +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_userassignedidentityproperties.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_userassignedidentityproperties.go similarity index 94% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_userassignedidentityproperties.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_userassignedidentityproperties.go index d0776af4b85..771f69dae7b 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_userassignedidentityproperties.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_userassignedidentityproperties.go @@ -1,4 +1,4 @@ -package operation +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_userassignedmanagedidentitydetails.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_userassignedmanagedidentitydetails.go similarity index 96% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_userassignedmanagedidentitydetails.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_userassignedmanagedidentitydetails.go index 4000e7813ed..5afcb028441 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_userassignedmanagedidentitydetails.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_userassignedmanagedidentitydetails.go @@ -1,4 +1,4 @@ -package operation +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_validateiaasvmrestoreoperationrequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_validateiaasvmrestoreoperationrequest.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_validateiaasvmrestoreoperationrequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_validateiaasvmrestoreoperationrequest.go index 01d55fc3961..f19da006822 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_validateiaasvmrestoreoperationrequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_validateiaasvmrestoreoperationrequest.go @@ -1,4 +1,4 @@ -package operation +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_validateoperationrequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_validateoperationrequest.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_validateoperationrequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_validateoperationrequest.go index 6097db60112..699d85b8ca8 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_validateoperationrequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_validateoperationrequest.go @@ -1,4 +1,4 @@ -package operation +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_validateoperationrequestresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_validateoperationrequestresource.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_validateoperationrequestresource.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_validateoperationrequestresource.go index da017bc172d..4fc3c46c1f6 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_validateoperationrequestresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_validateoperationrequestresource.go @@ -1,4 +1,4 @@ -package operation +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_validateoperationresponse.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_validateoperationresponse.go similarity index 93% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_validateoperationresponse.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_validateoperationresponse.go index 0be2ef4af18..8cba50e3d69 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_validateoperationresponse.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_validateoperationresponse.go @@ -1,4 +1,4 @@ -package operation +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_validateoperationsresponse.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_validateoperationsresponse.go similarity index 94% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_validateoperationsresponse.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_validateoperationsresponse.go index 8b9f3991c07..6d4f8902744 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_validateoperationsresponse.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_validateoperationsresponse.go @@ -1,4 +1,4 @@ -package operation +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_validaterestoreoperationrequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_validaterestoreoperationrequest.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/operation/model_validaterestoreoperationrequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_validaterestoreoperationrequest.go index 20e3be73bd3..c0a916fd55d 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/model_validaterestoreoperationrequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_validaterestoreoperationrequest.go @@ -1,4 +1,4 @@ -package operation +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_workloadinquirydetails.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_workloadinquirydetails.go similarity index 93% rename from resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_workloadinquirydetails.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_workloadinquirydetails.go index ca519886a94..53e16a1b77a 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_workloadinquirydetails.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_workloadinquirydetails.go @@ -1,4 +1,4 @@ -package softdeletedcontainers +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_workloadprotectableitem.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_workloadprotectableitem.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_workloadprotectableitem.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_workloadprotectableitem.go index 4b17f521940..6065ab80b5f 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_workloadprotectableitem.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_workloadprotectableitem.go @@ -1,4 +1,4 @@ -package backupprotectableitems +package bms import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_workloadprotectableitemresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_workloadprotectableitemresource.go similarity index 71% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_workloadprotectableitemresource.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/model_workloadprotectableitemresource.go index 279be78ea02..787f05d0a3b 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_workloadprotectableitemresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/model_workloadprotectableitemresource.go @@ -1,8 +1,10 @@ -package backupprotectableitems +package bms import ( "encoding/json" "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" ) // Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,6 +16,7 @@ type WorkloadProtectableItemResource struct { Location *string `json:"location,omitempty"` Name *string `json:"name,omitempty"` Properties WorkloadProtectableItem `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` Tags *map[string]string `json:"tags,omitempty"` Type *string `json:"type,omitempty"` } @@ -22,12 +25,13 @@ var _ json.Unmarshaler = &WorkloadProtectableItemResource{} func (s *WorkloadProtectableItemResource) UnmarshalJSON(bytes []byte) error { var decoded struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -37,6 +41,7 @@ func (s *WorkloadProtectableItemResource) UnmarshalJSON(bytes []byte) error { s.Id = decoded.Id s.Location = decoded.Location s.Name = decoded.Name + s.SystemData = decoded.SystemData s.Tags = decoded.Tags s.Type = decoded.Type diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/bms/predicates.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/predicates.go new file mode 100644 index 00000000000..5e69d7c54b3 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/predicates.go @@ -0,0 +1,197 @@ +package bms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupManagementUsageOperationPredicate struct { + CurrentValue *int64 + Limit *int64 + NextResetTime *string + QuotaPeriod *string +} + +func (p BackupManagementUsageOperationPredicate) Matches(input BackupManagementUsage) bool { + + if p.CurrentValue != nil && (input.CurrentValue == nil || *p.CurrentValue != *input.CurrentValue) { + return false + } + + if p.Limit != nil && (input.Limit == nil || *p.Limit != *input.Limit) { + return false + } + + if p.NextResetTime != nil && (input.NextResetTime == nil || *p.NextResetTime != *input.NextResetTime) { + return false + } + + if p.QuotaPeriod != nil && (input.QuotaPeriod == nil || *p.QuotaPeriod != *input.QuotaPeriod) { + return false + } + + return true +} + +type ProtectableContainerResourceOperationPredicate struct { + ETag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p ProtectableContainerResourceOperationPredicate) Matches(input ProtectableContainerResource) bool { + + if p.ETag != nil && (input.ETag == nil || *p.ETag != *input.ETag) { + return false + } + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} + +type ProtectedItemResourceOperationPredicate struct { + ETag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p ProtectedItemResourceOperationPredicate) Matches(input ProtectedItemResource) bool { + + if p.ETag != nil && (input.ETag == nil || *p.ETag != *input.ETag) { + return false + } + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} + +type ProtectionContainerResourceOperationPredicate struct { + ETag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p ProtectionContainerResourceOperationPredicate) Matches(input ProtectionContainerResource) bool { + + if p.ETag != nil && (input.ETag == nil || *p.ETag != *input.ETag) { + return false + } + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} + +type ProtectionIntentResourceOperationPredicate struct { + ETag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p ProtectionIntentResourceOperationPredicate) Matches(input ProtectionIntentResource) bool { + + if p.ETag != nil && (input.ETag == nil || *p.ETag != *input.ETag) { + return false + } + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} + +type WorkloadProtectableItemResourceOperationPredicate struct { + ETag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p WorkloadProtectableItemResourceOperationPredicate) Matches(input WorkloadProtectableItemResource) bool { + + if p.ETag != nil && (input.ETag == nil || *p.ETag != *input.ETag) { + return false + } + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/jobs/version.go b/resource-manager/recoveryservicesbackup/2025-02-01/bms/version.go similarity index 78% rename from resource-manager/recoveryservicesbackup/2025-02-01/jobs/version.go rename to resource-manager/recoveryservicesbackup/2025-02-01/bms/version.go index c819ecf6252..579fb89489d 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/jobs/version.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/bms/version.go @@ -1,4 +1,4 @@ -package jobs +package bms // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -6,5 +6,5 @@ package jobs const defaultApiVersion = "2025-02-01" func userAgent() string { - return "hashicorp/go-azure-sdk/jobs/2025-02-01" + return "hashicorp/go-azure-sdk/bms/2025-02-01" } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/client.go b/resource-manager/recoveryservicesbackup/2025-02-01/client.go index 4c24abb0bd1..93753c77181 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/client.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/client.go @@ -8,80 +8,50 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupengines" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupjobs" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backuppolicies" - "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems" - "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems" - "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectioncontainers" - "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupresourceencryptionconfigs" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcestorageconfigsnoncrr" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupresourcevaultconfigs" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backups" - "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupstatus" - "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupusagesummaries" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/backupworkloaditems" - "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/datamove" - "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport" - "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/bms" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/itemlevelrecoveryconnections" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/jobcancellations" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/jobdetails" - "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/jobs" - "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/operation" - "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection" - "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/protecteditems" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/protectioncontainers" - "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/protectionpolicies" - "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoints" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/recoverypointsrecommendedformove" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/resourceguardproxies" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/resourceguardproxy" "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/restores" - "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/securitypins" - "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers" - "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation" ) type Client struct { BackupEngines *backupengines.BackupEnginesClient BackupJobs *backupjobs.BackupJobsClient BackupPolicies *backuppolicies.BackupPoliciesClient - BackupProtectableItems *backupprotectableitems.BackupProtectableItemsClient - BackupProtectedItems *backupprotecteditems.BackupProtectedItemsClient - BackupProtectionContainers *backupprotectioncontainers.BackupProtectionContainersClient - BackupProtectionIntent *backupprotectionintent.BackupProtectionIntentClient BackupResourceEncryptionConfigs *backupresourceencryptionconfigs.BackupResourceEncryptionConfigsClient BackupResourceStorageConfigsNonCRR *backupresourcestorageconfigsnoncrr.BackupResourceStorageConfigsNonCRRClient BackupResourceVaultConfigs *backupresourcevaultconfigs.BackupResourceVaultConfigsClient - BackupStatus *backupstatus.BackupStatusClient - BackupUsageSummaries *backupusagesummaries.BackupUsageSummariesClient BackupWorkloadItems *backupworkloaditems.BackupWorkloadItemsClient Backups *backups.BackupsClient - DataMove *datamove.DataMoveClient - FeatureSupport *featuresupport.FeatureSupportClient - FetchTieringCost *fetchtieringcost.FetchTieringCostClient + Bms *bms.BmsClient ItemLevelRecoveryConnections *itemlevelrecoveryconnections.ItemLevelRecoveryConnectionsClient JobCancellations *jobcancellations.JobCancellationsClient JobDetails *jobdetails.JobDetailsClient - Jobs *jobs.JobsClient - Operation *operation.OperationClient - PrivateEndpointConnection *privateendpointconnection.PrivateEndpointConnectionClient - ProtectableContainers *protectablecontainers.ProtectableContainersClient + PrivateEndpointConnectionResources *privateendpointconnectionresources.PrivateEndpointConnectionResourcesClient ProtectedItems *protecteditems.ProtectedItemsClient ProtectionContainers *protectioncontainers.ProtectionContainersClient - ProtectionIntent *protectionintent.ProtectionIntentClient + ProtectionIntentResources *protectionintentresources.ProtectionIntentResourcesClient ProtectionPolicies *protectionpolicies.ProtectionPoliciesClient - RecoveryPoint *recoverypoint.RecoveryPointClient RecoveryPoints *recoverypoints.RecoveryPointsClient RecoveryPointsRecommendedForMove *recoverypointsrecommendedformove.RecoveryPointsRecommendedForMoveClient ResourceGuardProxies *resourceguardproxies.ResourceGuardProxiesClient ResourceGuardProxy *resourceguardproxy.ResourceGuardProxyClient Restores *restores.RestoresClient - SecurityPINs *securitypins.SecurityPINsClient - SoftDeletedContainers *softdeletedcontainers.SoftDeletedContainersClient - ValidateOperation *validateoperation.ValidateOperationClient } func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Client)) Client { @@ -95,18 +65,6 @@ func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Cl backupPoliciesClient := backuppolicies.NewBackupPoliciesClientWithBaseURI(endpoint) configureAuthFunc(&backupPoliciesClient.Client) - backupProtectableItemsClient := backupprotectableitems.NewBackupProtectableItemsClientWithBaseURI(endpoint) - configureAuthFunc(&backupProtectableItemsClient.Client) - - backupProtectedItemsClient := backupprotecteditems.NewBackupProtectedItemsClientWithBaseURI(endpoint) - configureAuthFunc(&backupProtectedItemsClient.Client) - - backupProtectionContainersClient := backupprotectioncontainers.NewBackupProtectionContainersClientWithBaseURI(endpoint) - configureAuthFunc(&backupProtectionContainersClient.Client) - - backupProtectionIntentClient := backupprotectionintent.NewBackupProtectionIntentClientWithBaseURI(endpoint) - configureAuthFunc(&backupProtectionIntentClient.Client) - backupResourceEncryptionConfigsClient := backupresourceencryptionconfigs.NewBackupResourceEncryptionConfigsClientWithBaseURI(endpoint) configureAuthFunc(&backupResourceEncryptionConfigsClient.Client) @@ -116,26 +74,14 @@ func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Cl backupResourceVaultConfigsClient := backupresourcevaultconfigs.NewBackupResourceVaultConfigsClientWithBaseURI(endpoint) configureAuthFunc(&backupResourceVaultConfigsClient.Client) - backupStatusClient := backupstatus.NewBackupStatusClientWithBaseURI(endpoint) - configureAuthFunc(&backupStatusClient.Client) - - backupUsageSummariesClient := backupusagesummaries.NewBackupUsageSummariesClientWithBaseURI(endpoint) - configureAuthFunc(&backupUsageSummariesClient.Client) - backupWorkloadItemsClient := backupworkloaditems.NewBackupWorkloadItemsClientWithBaseURI(endpoint) configureAuthFunc(&backupWorkloadItemsClient.Client) backupsClient := backups.NewBackupsClientWithBaseURI(endpoint) configureAuthFunc(&backupsClient.Client) - dataMoveClient := datamove.NewDataMoveClientWithBaseURI(endpoint) - configureAuthFunc(&dataMoveClient.Client) - - featureSupportClient := featuresupport.NewFeatureSupportClientWithBaseURI(endpoint) - configureAuthFunc(&featureSupportClient.Client) - - fetchTieringCostClient := fetchtieringcost.NewFetchTieringCostClientWithBaseURI(endpoint) - configureAuthFunc(&fetchTieringCostClient.Client) + bmsClient := bms.NewBmsClientWithBaseURI(endpoint) + configureAuthFunc(&bmsClient.Client) itemLevelRecoveryConnectionsClient := itemlevelrecoveryconnections.NewItemLevelRecoveryConnectionsClientWithBaseURI(endpoint) configureAuthFunc(&itemLevelRecoveryConnectionsClient.Client) @@ -146,17 +92,8 @@ func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Cl jobDetailsClient := jobdetails.NewJobDetailsClientWithBaseURI(endpoint) configureAuthFunc(&jobDetailsClient.Client) - jobsClient := jobs.NewJobsClientWithBaseURI(endpoint) - configureAuthFunc(&jobsClient.Client) - - operationClient := operation.NewOperationClientWithBaseURI(endpoint) - configureAuthFunc(&operationClient.Client) - - privateEndpointConnectionClient := privateendpointconnection.NewPrivateEndpointConnectionClientWithBaseURI(endpoint) - configureAuthFunc(&privateEndpointConnectionClient.Client) - - protectableContainersClient := protectablecontainers.NewProtectableContainersClientWithBaseURI(endpoint) - configureAuthFunc(&protectableContainersClient.Client) + privateEndpointConnectionResourcesClient := privateendpointconnectionresources.NewPrivateEndpointConnectionResourcesClientWithBaseURI(endpoint) + configureAuthFunc(&privateEndpointConnectionResourcesClient.Client) protectedItemsClient := protecteditems.NewProtectedItemsClientWithBaseURI(endpoint) configureAuthFunc(&protectedItemsClient.Client) @@ -164,15 +101,12 @@ func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Cl protectionContainersClient := protectioncontainers.NewProtectionContainersClientWithBaseURI(endpoint) configureAuthFunc(&protectionContainersClient.Client) - protectionIntentClient := protectionintent.NewProtectionIntentClientWithBaseURI(endpoint) - configureAuthFunc(&protectionIntentClient.Client) + protectionIntentResourcesClient := protectionintentresources.NewProtectionIntentResourcesClientWithBaseURI(endpoint) + configureAuthFunc(&protectionIntentResourcesClient.Client) protectionPoliciesClient := protectionpolicies.NewProtectionPoliciesClientWithBaseURI(endpoint) configureAuthFunc(&protectionPoliciesClient.Client) - recoveryPointClient := recoverypoint.NewRecoveryPointClientWithBaseURI(endpoint) - configureAuthFunc(&recoveryPointClient.Client) - recoveryPointsClient := recoverypoints.NewRecoveryPointsClientWithBaseURI(endpoint) configureAuthFunc(&recoveryPointsClient.Client) @@ -188,52 +122,28 @@ func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Cl restoresClient := restores.NewRestoresClientWithBaseURI(endpoint) configureAuthFunc(&restoresClient.Client) - securityPINsClient := securitypins.NewSecurityPINsClientWithBaseURI(endpoint) - configureAuthFunc(&securityPINsClient.Client) - - softDeletedContainersClient := softdeletedcontainers.NewSoftDeletedContainersClientWithBaseURI(endpoint) - configureAuthFunc(&softDeletedContainersClient.Client) - - validateOperationClient := validateoperation.NewValidateOperationClientWithBaseURI(endpoint) - configureAuthFunc(&validateOperationClient.Client) - return Client{ BackupEngines: &backupEnginesClient, BackupJobs: &backupJobsClient, BackupPolicies: &backupPoliciesClient, - BackupProtectableItems: &backupProtectableItemsClient, - BackupProtectedItems: &backupProtectedItemsClient, - BackupProtectionContainers: &backupProtectionContainersClient, - BackupProtectionIntent: &backupProtectionIntentClient, BackupResourceEncryptionConfigs: &backupResourceEncryptionConfigsClient, BackupResourceStorageConfigsNonCRR: &backupResourceStorageConfigsNonCRRClient, BackupResourceVaultConfigs: &backupResourceVaultConfigsClient, - BackupStatus: &backupStatusClient, - BackupUsageSummaries: &backupUsageSummariesClient, BackupWorkloadItems: &backupWorkloadItemsClient, Backups: &backupsClient, - DataMove: &dataMoveClient, - FeatureSupport: &featureSupportClient, - FetchTieringCost: &fetchTieringCostClient, + Bms: &bmsClient, ItemLevelRecoveryConnections: &itemLevelRecoveryConnectionsClient, JobCancellations: &jobCancellationsClient, JobDetails: &jobDetailsClient, - Jobs: &jobsClient, - Operation: &operationClient, - PrivateEndpointConnection: &privateEndpointConnectionClient, - ProtectableContainers: &protectableContainersClient, + PrivateEndpointConnectionResources: &privateEndpointConnectionResourcesClient, ProtectedItems: &protectedItemsClient, ProtectionContainers: &protectionContainersClient, - ProtectionIntent: &protectionIntentClient, + ProtectionIntentResources: &protectionIntentResourcesClient, ProtectionPolicies: &protectionPoliciesClient, - RecoveryPoint: &recoveryPointClient, RecoveryPoints: &recoveryPointsClient, RecoveryPointsRecommendedForMove: &recoveryPointsRecommendedForMoveClient, ResourceGuardProxies: &resourceGuardProxiesClient, ResourceGuardProxy: &resourceGuardProxyClient, Restores: &restoresClient, - SecurityPINs: &securityPINsClient, - SoftDeletedContainers: &softDeletedContainersClient, - ValidateOperation: &validateOperationClient, } } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/datamove/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/datamove/README.md deleted file mode 100644 index b4cc71b6a4a..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/datamove/README.md +++ /dev/null @@ -1,54 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/datamove` Documentation - -The `datamove` SDK allows for interaction with Azure Resource Manager `recoveryservicesbackup` (API Version `2025-02-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/datamove" -``` - - -### Client Initialization - -```go -client := datamove.NewDataMoveClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `DataMoveClient.BMSPrepareDataMove` - -```go -ctx := context.TODO() -id := datamove.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") - -payload := datamove.PrepareDataMoveRequest{ - // ... -} - - -if err := client.BMSPrepareDataMoveThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `DataMoveClient.BMSTriggerDataMove` - -```go -ctx := context.TODO() -id := datamove.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") - -payload := datamove.TriggerDataMoveRequest{ - // ... -} - - -if err := client.BMSTriggerDataMoveThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/datamove/client.go b/resource-manager/recoveryservicesbackup/2025-02-01/datamove/client.go deleted file mode 100644 index bca13a32cd6..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/datamove/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package datamove - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DataMoveClient struct { - Client autorest.Client - baseUri string -} - -func NewDataMoveClientWithBaseURI(endpoint string) DataMoveClient { - return DataMoveClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/datamove/constants.go b/resource-manager/recoveryservicesbackup/2025-02-01/datamove/constants.go deleted file mode 100644 index 394d00d9a0f..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/datamove/constants.go +++ /dev/null @@ -1,39 +0,0 @@ -package datamove - -import ( - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DataMoveLevel string - -const ( - DataMoveLevelContainer DataMoveLevel = "Container" - DataMoveLevelInvalid DataMoveLevel = "Invalid" - DataMoveLevelVault DataMoveLevel = "Vault" -) - -func PossibleValuesForDataMoveLevel() []string { - return []string{ - string(DataMoveLevelContainer), - string(DataMoveLevelInvalid), - string(DataMoveLevelVault), - } -} - -func parseDataMoveLevel(input string) (*DataMoveLevel, error) { - vals := map[string]DataMoveLevel{ - "container": DataMoveLevelContainer, - "invalid": DataMoveLevelInvalid, - "vault": DataMoveLevelVault, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := DataMoveLevel(input) - return &out, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/datamove/id_vault.go b/resource-manager/recoveryservicesbackup/2025-02-01/datamove/id_vault.go deleted file mode 100644 index b2b8b1a07c2..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/datamove/id_vault.go +++ /dev/null @@ -1,130 +0,0 @@ -package datamove - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -func init() { - recaser.RegisterResourceId(&VaultId{}) -} - -var _ resourceids.ResourceId = &VaultId{} - -// VaultId is a struct representing the Resource ID for a Vault -type VaultId struct { - SubscriptionId string - ResourceGroupName string - VaultName string -} - -// NewVaultID returns a new VaultId struct -func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { - return VaultId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - VaultName: vaultName, - } -} - -// ParseVaultID parses 'input' into a VaultId -func ParseVaultID(input string) (*VaultId, error) { - parser := resourceids.NewParserFromResourceIdType(&VaultId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VaultId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseVaultIDInsensitively parses 'input' case-insensitively into a VaultId -// note: this method should only be used for API response data and not user input -func ParseVaultIDInsensitively(input string) (*VaultId, error) { - parser := resourceids.NewParserFromResourceIdType(&VaultId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VaultId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *VaultId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) - } - - if id.VaultName, ok = input.Parsed["vaultName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) - } - - return nil -} - -// ValidateVaultID checks that 'input' can be parsed as a Vault ID -func ValidateVaultID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseVaultID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Vault ID -func (id VaultId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Vault ID -func (id VaultId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), - resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("vaultName", "vaultName"), - } -} - -// String returns a human-readable description of this Vault ID -func (id VaultId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Vault Name: %q", id.VaultName), - } - return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/datamove/id_vault_test.go b/resource-manager/recoveryservicesbackup/2025-02-01/datamove/id_vault_test.go deleted file mode 100644 index 03a886c800d..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/datamove/id_vault_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package datamove - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ resourceids.ResourceId = &VaultId{} - -func TestNewVaultID(t *testing.T) { - id := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.VaultName != "vaultName" { - t.Fatalf("Expected %q but got %q for Segment 'VaultName'", id.VaultName, "vaultName") - } -} - -func TestFormatVaultID(t *testing.T) { - actual := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVaultID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VaultId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VaultName: "vaultName", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVaultID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.VaultName != v.Expected.VaultName { - t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) - } - - } -} - -func TestParseVaultIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VaultId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VaultName: "vaultName", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - VaultName: "vAuLtNaMe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVaultIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.VaultName != v.Expected.VaultName { - t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) - } - - } -} - -func TestSegmentsForVaultId(t *testing.T) { - segments := VaultId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VaultId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/README.md deleted file mode 100644 index 3df573ca56b..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/README.md +++ /dev/null @@ -1,41 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport` Documentation - -The `featuresupport` SDK allows for interaction with Azure Resource Manager `recoveryservicesbackup` (API Version `2025-02-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport" -``` - - -### Client Initialization - -```go -client := featuresupport.NewFeatureSupportClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `FeatureSupportClient.Validate` - -```go -ctx := context.TODO() -id := featuresupport.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") - -payload := featuresupport.FeatureSupportRequest{ - // ... -} - - -read, err := client.Validate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/client.go b/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/client.go deleted file mode 100644 index b4f22ceed18..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package featuresupport - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type FeatureSupportClient struct { - Client autorest.Client - baseUri string -} - -func NewFeatureSupportClientWithBaseURI(endpoint string) FeatureSupportClient { - return FeatureSupportClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/constants.go b/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/constants.go deleted file mode 100644 index de57933a730..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/constants.go +++ /dev/null @@ -1,45 +0,0 @@ -package featuresupport - -import ( - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SupportStatus string - -const ( - SupportStatusDefaultOFF SupportStatus = "DefaultOFF" - SupportStatusDefaultON SupportStatus = "DefaultON" - SupportStatusInvalid SupportStatus = "Invalid" - SupportStatusNotSupported SupportStatus = "NotSupported" - SupportStatusSupported SupportStatus = "Supported" -) - -func PossibleValuesForSupportStatus() []string { - return []string{ - string(SupportStatusDefaultOFF), - string(SupportStatusDefaultON), - string(SupportStatusInvalid), - string(SupportStatusNotSupported), - string(SupportStatusSupported), - } -} - -func parseSupportStatus(input string) (*SupportStatus, error) { - vals := map[string]SupportStatus{ - "defaultoff": SupportStatusDefaultOFF, - "defaulton": SupportStatusDefaultON, - "invalid": SupportStatusInvalid, - "notsupported": SupportStatusNotSupported, - "supported": SupportStatusSupported, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SupportStatus(input) - return &out, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/method_validate_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/method_validate_autorest.go deleted file mode 100644 index 71e04fc843f..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/featuresupport/method_validate_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package featuresupport - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ValidateOperationResponse struct { - HttpResponse *http.Response - Model *AzureVMResourceFeatureSupportResponse -} - -// Validate ... -func (c FeatureSupportClient) Validate(ctx context.Context, id LocationId, input FeatureSupportRequest) (result ValidateOperationResponse, err error) { - req, err := c.preparerForValidate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "featuresupport.FeatureSupportClient", "Validate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "featuresupport.FeatureSupportClient", "Validate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForValidate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "featuresupport.FeatureSupportClient", "Validate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForValidate prepares the Validate request. -func (c FeatureSupportClient) preparerForValidate(ctx context.Context, id LocationId, input FeatureSupportRequest) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/backupValidateFeatures", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForValidate handles the response to the Validate request. The method always -// closes the http.Response Body. -func (c FeatureSupportClient) responderForValidate(resp *http.Response) (result ValidateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/README.md deleted file mode 100644 index 28e74c7132d..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost` Documentation - -The `fetchtieringcost` SDK allows for interaction with Azure Resource Manager `recoveryservicesbackup` (API Version `2025-02-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost" -``` - - -### Client Initialization - -```go -client := fetchtieringcost.NewFetchTieringCostClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `FetchTieringCostClient.Post` - -```go -ctx := context.TODO() -id := fetchtieringcost.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") - -payload := fetchtieringcost.FetchTieringCostInfoRequest{ - // ... -} - - -if err := client.PostThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/client.go b/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/client.go deleted file mode 100644 index c3df44f183a..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package fetchtieringcost - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type FetchTieringCostClient struct { - Client autorest.Client - baseUri string -} - -func NewFetchTieringCostClientWithBaseURI(endpoint string) FetchTieringCostClient { - return FetchTieringCostClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/constants.go b/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/constants.go deleted file mode 100644 index 7dcbbbe9712..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/constants.go +++ /dev/null @@ -1,70 +0,0 @@ -package fetchtieringcost - -import ( - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RecoveryPointTierType string - -const ( - RecoveryPointTierTypeArchivedRP RecoveryPointTierType = "ArchivedRP" - RecoveryPointTierTypeHardenedRP RecoveryPointTierType = "HardenedRP" - RecoveryPointTierTypeInstantRP RecoveryPointTierType = "InstantRP" - RecoveryPointTierTypeInvalid RecoveryPointTierType = "Invalid" -) - -func PossibleValuesForRecoveryPointTierType() []string { - return []string{ - string(RecoveryPointTierTypeArchivedRP), - string(RecoveryPointTierTypeHardenedRP), - string(RecoveryPointTierTypeInstantRP), - string(RecoveryPointTierTypeInvalid), - } -} - -func parseRecoveryPointTierType(input string) (*RecoveryPointTierType, error) { - vals := map[string]RecoveryPointTierType{ - "archivedrp": RecoveryPointTierTypeArchivedRP, - "hardenedrp": RecoveryPointTierTypeHardenedRP, - "instantrp": RecoveryPointTierTypeInstantRP, - "invalid": RecoveryPointTierTypeInvalid, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RecoveryPointTierType(input) - return &out, nil -} - -type RehydrationPriority string - -const ( - RehydrationPriorityHigh RehydrationPriority = "High" - RehydrationPriorityStandard RehydrationPriority = "Standard" -) - -func PossibleValuesForRehydrationPriority() []string { - return []string{ - string(RehydrationPriorityHigh), - string(RehydrationPriorityStandard), - } -} - -func parseRehydrationPriority(input string) (*RehydrationPriority, error) { - vals := map[string]RehydrationPriority{ - "high": RehydrationPriorityHigh, - "standard": RehydrationPriorityStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RehydrationPriority(input) - return &out, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/id_vault.go b/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/id_vault.go deleted file mode 100644 index b4b71eafca4..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/id_vault.go +++ /dev/null @@ -1,130 +0,0 @@ -package fetchtieringcost - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -func init() { - recaser.RegisterResourceId(&VaultId{}) -} - -var _ resourceids.ResourceId = &VaultId{} - -// VaultId is a struct representing the Resource ID for a Vault -type VaultId struct { - SubscriptionId string - ResourceGroupName string - VaultName string -} - -// NewVaultID returns a new VaultId struct -func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { - return VaultId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - VaultName: vaultName, - } -} - -// ParseVaultID parses 'input' into a VaultId -func ParseVaultID(input string) (*VaultId, error) { - parser := resourceids.NewParserFromResourceIdType(&VaultId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VaultId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseVaultIDInsensitively parses 'input' case-insensitively into a VaultId -// note: this method should only be used for API response data and not user input -func ParseVaultIDInsensitively(input string) (*VaultId, error) { - parser := resourceids.NewParserFromResourceIdType(&VaultId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VaultId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *VaultId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) - } - - if id.VaultName, ok = input.Parsed["vaultName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) - } - - return nil -} - -// ValidateVaultID checks that 'input' can be parsed as a Vault ID -func ValidateVaultID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseVaultID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Vault ID -func (id VaultId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Vault ID -func (id VaultId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), - resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("vaultName", "vaultName"), - } -} - -// String returns a human-readable description of this Vault ID -func (id VaultId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Vault Name: %q", id.VaultName), - } - return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/id_vault_test.go b/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/id_vault_test.go deleted file mode 100644 index 995ddf194df..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/id_vault_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package fetchtieringcost - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ resourceids.ResourceId = &VaultId{} - -func TestNewVaultID(t *testing.T) { - id := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.VaultName != "vaultName" { - t.Fatalf("Expected %q but got %q for Segment 'VaultName'", id.VaultName, "vaultName") - } -} - -func TestFormatVaultID(t *testing.T) { - actual := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVaultID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VaultId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VaultName: "vaultName", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVaultID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.VaultName != v.Expected.VaultName { - t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) - } - - } -} - -func TestParseVaultIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VaultId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VaultName: "vaultName", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - VaultName: "vAuLtNaMe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVaultIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.VaultName != v.Expected.VaultName { - t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) - } - - } -} - -func TestSegmentsForVaultId(t *testing.T) { - segments := VaultId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VaultId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/method_post_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/method_post_autorest.go deleted file mode 100644 index 388a3bbc273..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/fetchtieringcost/method_post_autorest.go +++ /dev/null @@ -1,80 +0,0 @@ -package fetchtieringcost - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PostOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response - Model *TieringCostInfo -} - -// Post ... -func (c FetchTieringCostClient) Post(ctx context.Context, id VaultId, input FetchTieringCostInfoRequest) (result PostOperationResponse, err error) { - req, err := c.preparerForPost(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "fetchtieringcost.FetchTieringCostClient", "Post", nil, "Failure preparing request") - return - } - - result, err = c.senderForPost(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "fetchtieringcost.FetchTieringCostClient", "Post", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// PostThenPoll performs Post then polls until it's completed -func (c FetchTieringCostClient) PostThenPoll(ctx context.Context, id VaultId, input FetchTieringCostInfoRequest) error { - result, err := c.Post(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Post: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Post: %+v", err) - } - - return nil -} - -// preparerForPost prepares the Post request. -func (c FetchTieringCostClient) preparerForPost(ctx context.Context, id VaultId, input FetchTieringCostInfoRequest) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/backupTieringCost/default/fetchTieringCost", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForPost sends the Post request. The method will close the -// http.Response Body if it receives an error. -func (c FetchTieringCostClient) senderForPost(ctx context.Context, req *http.Request) (future PostOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/itemlevelrecoveryconnections/model_ilrrequestresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/itemlevelrecoveryconnections/model_ilrrequestresource.go index 78a909a753c..ae6d307e1ff 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/itemlevelrecoveryconnections/model_ilrrequestresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/itemlevelrecoveryconnections/model_ilrrequestresource.go @@ -3,31 +3,35 @@ package itemlevelrecoveryconnections import ( "encoding/json" "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" ) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ILRRequestResource struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties ILRRequest `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties ILRRequest `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } var _ json.Unmarshaler = &ILRRequestResource{} func (s *ILRRequestResource) UnmarshalJSON(bytes []byte) error { var decoded struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -37,6 +41,7 @@ func (s *ILRRequestResource) UnmarshalJSON(bytes []byte) error { s.Id = decoded.Id s.Location = decoded.Location s.Name = decoded.Name + s.SystemData = decoded.SystemData s.Tags = decoded.Tags s.Type = decoded.Type diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/jobdetails/model_jobresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/jobdetails/model_jobresource.go index 8019865441e..11180f92a4b 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/jobdetails/model_jobresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/jobdetails/model_jobresource.go @@ -3,31 +3,35 @@ package jobdetails import ( "encoding/json" "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" ) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type JobResource struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties Job `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties Job `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } var _ json.Unmarshaler = &JobResource{} func (s *JobResource) UnmarshalJSON(bytes []byte) error { var decoded struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -37,6 +41,7 @@ func (s *JobResource) UnmarshalJSON(bytes []byte) error { s.Id = decoded.Id s.Location = decoded.Location s.Name = decoded.Name + s.SystemData = decoded.SystemData s.Tags = decoded.Tags s.Type = decoded.Type diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/operation/README.md deleted file mode 100644 index 65c332562cd..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/README.md +++ /dev/null @@ -1,41 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/operation` Documentation - -The `operation` SDK allows for interaction with Azure Resource Manager `recoveryservicesbackup` (API Version `2025-02-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/operation" -``` - - -### Client Initialization - -```go -client := operation.NewOperationClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `OperationClient.Validate` - -```go -ctx := context.TODO() -id := operation.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") - -payload := operation.ValidateOperationRequestResource{ - // ... -} - - -read, err := client.Validate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/client.go b/resource-manager/recoveryservicesbackup/2025-02-01/operation/client.go deleted file mode 100644 index 3a57d0e0d4c..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package operation - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type OperationClient struct { - Client autorest.Client - baseUri string -} - -func NewOperationClientWithBaseURI(endpoint string) OperationClient { - return OperationClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/constants.go b/resource-manager/recoveryservicesbackup/2025-02-01/operation/constants.go deleted file mode 100644 index 23a685aa283..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/constants.go +++ /dev/null @@ -1,274 +0,0 @@ -package operation - -import ( - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CopyOptions string - -const ( - CopyOptionsCreateCopy CopyOptions = "CreateCopy" - CopyOptionsFailOnConflict CopyOptions = "FailOnConflict" - CopyOptionsInvalid CopyOptions = "Invalid" - CopyOptionsOverwrite CopyOptions = "Overwrite" - CopyOptionsSkip CopyOptions = "Skip" -) - -func PossibleValuesForCopyOptions() []string { - return []string{ - string(CopyOptionsCreateCopy), - string(CopyOptionsFailOnConflict), - string(CopyOptionsInvalid), - string(CopyOptionsOverwrite), - string(CopyOptionsSkip), - } -} - -func parseCopyOptions(input string) (*CopyOptions, error) { - vals := map[string]CopyOptions{ - "createcopy": CopyOptionsCreateCopy, - "failonconflict": CopyOptionsFailOnConflict, - "invalid": CopyOptionsInvalid, - "overwrite": CopyOptionsOverwrite, - "skip": CopyOptionsSkip, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CopyOptions(input) - return &out, nil -} - -type OverwriteOptions string - -const ( - OverwriteOptionsFailOnConflict OverwriteOptions = "FailOnConflict" - OverwriteOptionsInvalid OverwriteOptions = "Invalid" - OverwriteOptionsOverwrite OverwriteOptions = "Overwrite" -) - -func PossibleValuesForOverwriteOptions() []string { - return []string{ - string(OverwriteOptionsFailOnConflict), - string(OverwriteOptionsInvalid), - string(OverwriteOptionsOverwrite), - } -} - -func parseOverwriteOptions(input string) (*OverwriteOptions, error) { - vals := map[string]OverwriteOptions{ - "failonconflict": OverwriteOptionsFailOnConflict, - "invalid": OverwriteOptionsInvalid, - "overwrite": OverwriteOptionsOverwrite, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := OverwriteOptions(input) - return &out, nil -} - -type RecoveryMode string - -const ( - RecoveryModeFileRecovery RecoveryMode = "FileRecovery" - RecoveryModeInvalid RecoveryMode = "Invalid" - RecoveryModeRecoveryUsingSnapshot RecoveryMode = "RecoveryUsingSnapshot" - RecoveryModeSnapshotAttach RecoveryMode = "SnapshotAttach" - RecoveryModeSnapshotAttachAndRecover RecoveryMode = "SnapshotAttachAndRecover" - RecoveryModeWorkloadRecovery RecoveryMode = "WorkloadRecovery" -) - -func PossibleValuesForRecoveryMode() []string { - return []string{ - string(RecoveryModeFileRecovery), - string(RecoveryModeInvalid), - string(RecoveryModeRecoveryUsingSnapshot), - string(RecoveryModeSnapshotAttach), - string(RecoveryModeSnapshotAttachAndRecover), - string(RecoveryModeWorkloadRecovery), - } -} - -func parseRecoveryMode(input string) (*RecoveryMode, error) { - vals := map[string]RecoveryMode{ - "filerecovery": RecoveryModeFileRecovery, - "invalid": RecoveryModeInvalid, - "recoveryusingsnapshot": RecoveryModeRecoveryUsingSnapshot, - "snapshotattach": RecoveryModeSnapshotAttach, - "snapshotattachandrecover": RecoveryModeSnapshotAttachAndRecover, - "workloadrecovery": RecoveryModeWorkloadRecovery, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RecoveryMode(input) - return &out, nil -} - -type RecoveryType string - -const ( - RecoveryTypeAlternateLocation RecoveryType = "AlternateLocation" - RecoveryTypeInvalid RecoveryType = "Invalid" - RecoveryTypeOffline RecoveryType = "Offline" - RecoveryTypeOriginalLocation RecoveryType = "OriginalLocation" - RecoveryTypeRestoreDisks RecoveryType = "RestoreDisks" -) - -func PossibleValuesForRecoveryType() []string { - return []string{ - string(RecoveryTypeAlternateLocation), - string(RecoveryTypeInvalid), - string(RecoveryTypeOffline), - string(RecoveryTypeOriginalLocation), - string(RecoveryTypeRestoreDisks), - } -} - -func parseRecoveryType(input string) (*RecoveryType, error) { - vals := map[string]RecoveryType{ - "alternatelocation": RecoveryTypeAlternateLocation, - "invalid": RecoveryTypeInvalid, - "offline": RecoveryTypeOffline, - "originallocation": RecoveryTypeOriginalLocation, - "restoredisks": RecoveryTypeRestoreDisks, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RecoveryType(input) - return &out, nil -} - -type RehydrationPriority string - -const ( - RehydrationPriorityHigh RehydrationPriority = "High" - RehydrationPriorityStandard RehydrationPriority = "Standard" -) - -func PossibleValuesForRehydrationPriority() []string { - return []string{ - string(RehydrationPriorityHigh), - string(RehydrationPriorityStandard), - } -} - -func parseRehydrationPriority(input string) (*RehydrationPriority, error) { - vals := map[string]RehydrationPriority{ - "high": RehydrationPriorityHigh, - "standard": RehydrationPriorityStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RehydrationPriority(input) - return &out, nil -} - -type RestoreRequestType string - -const ( - RestoreRequestTypeFullShareRestore RestoreRequestType = "FullShareRestore" - RestoreRequestTypeInvalid RestoreRequestType = "Invalid" - RestoreRequestTypeItemLevelRestore RestoreRequestType = "ItemLevelRestore" -) - -func PossibleValuesForRestoreRequestType() []string { - return []string{ - string(RestoreRequestTypeFullShareRestore), - string(RestoreRequestTypeInvalid), - string(RestoreRequestTypeItemLevelRestore), - } -} - -func parseRestoreRequestType(input string) (*RestoreRequestType, error) { - vals := map[string]RestoreRequestType{ - "fullsharerestore": RestoreRequestTypeFullShareRestore, - "invalid": RestoreRequestTypeInvalid, - "itemlevelrestore": RestoreRequestTypeItemLevelRestore, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RestoreRequestType(input) - return &out, nil -} - -type SQLDataDirectoryType string - -const ( - SQLDataDirectoryTypeData SQLDataDirectoryType = "Data" - SQLDataDirectoryTypeInvalid SQLDataDirectoryType = "Invalid" - SQLDataDirectoryTypeLog SQLDataDirectoryType = "Log" -) - -func PossibleValuesForSQLDataDirectoryType() []string { - return []string{ - string(SQLDataDirectoryTypeData), - string(SQLDataDirectoryTypeInvalid), - string(SQLDataDirectoryTypeLog), - } -} - -func parseSQLDataDirectoryType(input string) (*SQLDataDirectoryType, error) { - vals := map[string]SQLDataDirectoryType{ - "data": SQLDataDirectoryTypeData, - "invalid": SQLDataDirectoryTypeInvalid, - "log": SQLDataDirectoryTypeLog, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SQLDataDirectoryType(input) - return &out, nil -} - -type TargetDiskNetworkAccessOption string - -const ( - TargetDiskNetworkAccessOptionEnablePrivateAccessForAllDisks TargetDiskNetworkAccessOption = "EnablePrivateAccessForAllDisks" - TargetDiskNetworkAccessOptionEnablePublicAccessForAllDisks TargetDiskNetworkAccessOption = "EnablePublicAccessForAllDisks" - TargetDiskNetworkAccessOptionSameAsOnSourceDisks TargetDiskNetworkAccessOption = "SameAsOnSourceDisks" -) - -func PossibleValuesForTargetDiskNetworkAccessOption() []string { - return []string{ - string(TargetDiskNetworkAccessOptionEnablePrivateAccessForAllDisks), - string(TargetDiskNetworkAccessOptionEnablePublicAccessForAllDisks), - string(TargetDiskNetworkAccessOptionSameAsOnSourceDisks), - } -} - -func parseTargetDiskNetworkAccessOption(input string) (*TargetDiskNetworkAccessOption, error) { - vals := map[string]TargetDiskNetworkAccessOption{ - "enableprivateaccessforalldisks": TargetDiskNetworkAccessOptionEnablePrivateAccessForAllDisks, - "enablepublicaccessforalldisks": TargetDiskNetworkAccessOptionEnablePublicAccessForAllDisks, - "sameasonsourcedisks": TargetDiskNetworkAccessOptionSameAsOnSourceDisks, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := TargetDiskNetworkAccessOption(input) - return &out, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/id_vault.go b/resource-manager/recoveryservicesbackup/2025-02-01/operation/id_vault.go deleted file mode 100644 index 05d054e5c41..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/id_vault.go +++ /dev/null @@ -1,130 +0,0 @@ -package operation - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -func init() { - recaser.RegisterResourceId(&VaultId{}) -} - -var _ resourceids.ResourceId = &VaultId{} - -// VaultId is a struct representing the Resource ID for a Vault -type VaultId struct { - SubscriptionId string - ResourceGroupName string - VaultName string -} - -// NewVaultID returns a new VaultId struct -func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { - return VaultId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - VaultName: vaultName, - } -} - -// ParseVaultID parses 'input' into a VaultId -func ParseVaultID(input string) (*VaultId, error) { - parser := resourceids.NewParserFromResourceIdType(&VaultId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VaultId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseVaultIDInsensitively parses 'input' case-insensitively into a VaultId -// note: this method should only be used for API response data and not user input -func ParseVaultIDInsensitively(input string) (*VaultId, error) { - parser := resourceids.NewParserFromResourceIdType(&VaultId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VaultId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *VaultId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) - } - - if id.VaultName, ok = input.Parsed["vaultName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) - } - - return nil -} - -// ValidateVaultID checks that 'input' can be parsed as a Vault ID -func ValidateVaultID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseVaultID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Vault ID -func (id VaultId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Vault ID -func (id VaultId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), - resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("vaultName", "vaultName"), - } -} - -// String returns a human-readable description of this Vault ID -func (id VaultId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Vault Name: %q", id.VaultName), - } - return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/operation/id_vault_test.go b/resource-manager/recoveryservicesbackup/2025-02-01/operation/id_vault_test.go deleted file mode 100644 index a6ba4e3a2c7..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/operation/id_vault_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package operation - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ resourceids.ResourceId = &VaultId{} - -func TestNewVaultID(t *testing.T) { - id := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.VaultName != "vaultName" { - t.Fatalf("Expected %q but got %q for Segment 'VaultName'", id.VaultName, "vaultName") - } -} - -func TestFormatVaultID(t *testing.T) { - actual := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVaultID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VaultId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VaultName: "vaultName", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVaultID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.VaultName != v.Expected.VaultName { - t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) - } - - } -} - -func TestParseVaultIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VaultId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VaultName: "vaultName", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - VaultName: "vAuLtNaMe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVaultIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.VaultName != v.Expected.VaultName { - t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) - } - - } -} - -func TestSegmentsForVaultId(t *testing.T) { - segments := VaultId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VaultId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/README.md deleted file mode 100644 index dfca1334974..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/README.md +++ /dev/null @@ -1,65 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection` Documentation - -The `privateendpointconnection` SDK allows for interaction with Azure Resource Manager `recoveryservicesbackup` (API Version `2025-02-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection" -``` - - -### Client Initialization - -```go -client := privateendpointconnection.NewPrivateEndpointConnectionClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `PrivateEndpointConnectionClient.Delete` - -```go -ctx := context.TODO() -id := privateendpointconnection.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "privateEndpointConnectionName") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `PrivateEndpointConnectionClient.Get` - -```go -ctx := context.TODO() -id := privateendpointconnection.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "privateEndpointConnectionName") - -read, err := client.Get(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `PrivateEndpointConnectionClient.Put` - -```go -ctx := context.TODO() -id := privateendpointconnection.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "privateEndpointConnectionName") - -payload := privateendpointconnection.PrivateEndpointConnectionResource{ - // ... -} - - -if err := client.PutThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/client.go b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/client.go deleted file mode 100644 index 6acd77b913c..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package privateendpointconnection - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PrivateEndpointConnectionClient struct { - Client autorest.Client - baseUri string -} - -func NewPrivateEndpointConnectionClientWithBaseURI(endpoint string) PrivateEndpointConnectionClient { - return PrivateEndpointConnectionClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/method_delete_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/method_delete_autorest.go deleted file mode 100644 index 7e8532d71b7..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/method_delete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package privateendpointconnection - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c PrivateEndpointConnectionClient) Delete(ctx context.Context, id PrivateEndpointConnectionId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnection.PrivateEndpointConnectionClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnection.PrivateEndpointConnectionClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c PrivateEndpointConnectionClient) DeleteThenPoll(ctx context.Context, id PrivateEndpointConnectionId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c PrivateEndpointConnectionClient) preparerForDelete(ctx context.Context, id PrivateEndpointConnectionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c PrivateEndpointConnectionClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/method_get_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/method_get_autorest.go deleted file mode 100644 index d5309175155..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package privateendpointconnection - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *PrivateEndpointConnectionResource -} - -// Get ... -func (c PrivateEndpointConnectionClient) Get(ctx context.Context, id PrivateEndpointConnectionId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnection.PrivateEndpointConnectionClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnection.PrivateEndpointConnectionClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnection.PrivateEndpointConnectionClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c PrivateEndpointConnectionClient) preparerForGet(ctx context.Context, id PrivateEndpointConnectionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c PrivateEndpointConnectionClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/method_put_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/method_put_autorest.go deleted file mode 100644 index 072a1c747d1..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/method_put_autorest.go +++ /dev/null @@ -1,80 +0,0 @@ -package privateendpointconnection - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PutOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response - Model *PrivateEndpointConnectionResource -} - -// Put ... -func (c PrivateEndpointConnectionClient) Put(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnectionResource) (result PutOperationResponse, err error) { - req, err := c.preparerForPut(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnection.PrivateEndpointConnectionClient", "Put", nil, "Failure preparing request") - return - } - - result, err = c.senderForPut(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "privateendpointconnection.PrivateEndpointConnectionClient", "Put", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// PutThenPoll performs Put then polls until it's completed -func (c PrivateEndpointConnectionClient) PutThenPoll(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnectionResource) error { - result, err := c.Put(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Put: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Put: %+v", err) - } - - return nil -} - -// preparerForPut prepares the Put request. -func (c PrivateEndpointConnectionClient) preparerForPut(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnectionResource) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForPut sends the Put request. The method will close the -// http.Response Body if it receives an error. -func (c PrivateEndpointConnectionClient) senderForPut(ctx context.Context, req *http.Request) (future PutOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/README.md new file mode 100644 index 00000000000..aa24dd8ecfa --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/README.md @@ -0,0 +1,65 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources` Documentation + +The `privateendpointconnectionresources` SDK allows for interaction with Azure Resource Manager `recoveryservicesbackup` (API Version `2025-02-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources" +``` + + +### Client Initialization + +```go +client := privateendpointconnectionresources.NewPrivateEndpointConnectionResourcesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PrivateEndpointConnectionResourcesClient.PrivateEndpointConnectionDelete` + +```go +ctx := context.TODO() +id := privateendpointconnectionresources.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "privateEndpointConnectionName") + +if err := client.PrivateEndpointConnectionDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `PrivateEndpointConnectionResourcesClient.PrivateEndpointConnectionGet` + +```go +ctx := context.TODO() +id := privateendpointconnectionresources.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "privateEndpointConnectionName") + +read, err := client.PrivateEndpointConnectionGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PrivateEndpointConnectionResourcesClient.PrivateEndpointConnectionPut` + +```go +ctx := context.TODO() +id := privateendpointconnectionresources.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "privateEndpointConnectionName") + +payload := privateendpointconnectionresources.PrivateEndpointConnectionResource{ + // ... +} + + +if err := client.PrivateEndpointConnectionPutThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/client.go b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/client.go similarity index 55% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/client.go rename to resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/client.go index a30b2396b90..e459573fbd8 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/client.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/client.go @@ -1,17 +1,17 @@ -package backupprotectableitems +package privateendpointconnectionresources import "github.com/Azure/go-autorest/autorest" // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type BackupProtectableItemsClient struct { +type PrivateEndpointConnectionResourcesClient struct { Client autorest.Client baseUri string } -func NewBackupProtectableItemsClientWithBaseURI(endpoint string) BackupProtectableItemsClient { - return BackupProtectableItemsClient{ +func NewPrivateEndpointConnectionResourcesClientWithBaseURI(endpoint string) PrivateEndpointConnectionResourcesClient { + return PrivateEndpointConnectionResourcesClient{ Client: autorest.NewClientWithUserAgent(userAgent()), baseUri: endpoint, } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/constants.go b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/constants.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/constants.go rename to resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/constants.go index 1b184d21326..0bb3d836419 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/constants.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/constants.go @@ -1,4 +1,4 @@ -package privateendpointconnection +package privateendpointconnectionresources import ( "strings" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/id_privateendpointconnection.go b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/id_privateendpointconnection.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/id_privateendpointconnection.go rename to resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/id_privateendpointconnection.go index ed2cf77fc70..f95066666d3 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/id_privateendpointconnection.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/id_privateendpointconnection.go @@ -1,4 +1,4 @@ -package privateendpointconnection +package privateendpointconnectionresources import ( "fmt" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/id_privateendpointconnection_test.go b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/id_privateendpointconnection_test.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/id_privateendpointconnection_test.go rename to resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/id_privateendpointconnection_test.go index 51fa0302d12..a63da432b50 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/id_privateendpointconnection_test.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/id_privateendpointconnection_test.go @@ -1,4 +1,4 @@ -package privateendpointconnection +package privateendpointconnectionresources import ( "testing" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/method_privateendpointconnectiondelete_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/method_privateendpointconnectiondelete_autorest.go new file mode 100644 index 00000000000..d0cf1b415b7 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/method_privateendpointconnectiondelete_autorest.go @@ -0,0 +1,78 @@ +package privateendpointconnectionresources + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// PrivateEndpointConnectionDelete ... +func (c PrivateEndpointConnectionResourcesClient) PrivateEndpointConnectionDelete(ctx context.Context, id PrivateEndpointConnectionId) (result PrivateEndpointConnectionDeleteOperationResponse, err error) { + req, err := c.preparerForPrivateEndpointConnectionDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnectionresources.PrivateEndpointConnectionResourcesClient", "PrivateEndpointConnectionDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForPrivateEndpointConnectionDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnectionresources.PrivateEndpointConnectionResourcesClient", "PrivateEndpointConnectionDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// PrivateEndpointConnectionDeleteThenPoll performs PrivateEndpointConnectionDelete then polls until it's completed +func (c PrivateEndpointConnectionResourcesClient) PrivateEndpointConnectionDeleteThenPoll(ctx context.Context, id PrivateEndpointConnectionId) error { + result, err := c.PrivateEndpointConnectionDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing PrivateEndpointConnectionDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after PrivateEndpointConnectionDelete: %+v", err) + } + + return nil +} + +// preparerForPrivateEndpointConnectionDelete prepares the PrivateEndpointConnectionDelete request. +func (c PrivateEndpointConnectionResourcesClient) preparerForPrivateEndpointConnectionDelete(ctx context.Context, id PrivateEndpointConnectionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForPrivateEndpointConnectionDelete sends the PrivateEndpointConnectionDelete request. The method will close the +// http.Response Body if it receives an error. +func (c PrivateEndpointConnectionResourcesClient) senderForPrivateEndpointConnectionDelete(ctx context.Context, req *http.Request) (future PrivateEndpointConnectionDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/method_privateendpointconnectionget_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/method_privateendpointconnectionget_autorest.go new file mode 100644 index 00000000000..4a9e0c14c91 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/method_privateendpointconnectionget_autorest.go @@ -0,0 +1,68 @@ +package privateendpointconnectionresources + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionGetOperationResponse struct { + HttpResponse *http.Response + Model *PrivateEndpointConnectionResource +} + +// PrivateEndpointConnectionGet ... +func (c PrivateEndpointConnectionResourcesClient) PrivateEndpointConnectionGet(ctx context.Context, id PrivateEndpointConnectionId) (result PrivateEndpointConnectionGetOperationResponse, err error) { + req, err := c.preparerForPrivateEndpointConnectionGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnectionresources.PrivateEndpointConnectionResourcesClient", "PrivateEndpointConnectionGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnectionresources.PrivateEndpointConnectionResourcesClient", "PrivateEndpointConnectionGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPrivateEndpointConnectionGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnectionresources.PrivateEndpointConnectionResourcesClient", "PrivateEndpointConnectionGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForPrivateEndpointConnectionGet prepares the PrivateEndpointConnectionGet request. +func (c PrivateEndpointConnectionResourcesClient) preparerForPrivateEndpointConnectionGet(ctx context.Context, id PrivateEndpointConnectionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForPrivateEndpointConnectionGet handles the response to the PrivateEndpointConnectionGet request. The method always +// closes the http.Response Body. +func (c PrivateEndpointConnectionResourcesClient) responderForPrivateEndpointConnectionGet(resp *http.Response) (result PrivateEndpointConnectionGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/method_privateendpointconnectionput_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/method_privateendpointconnectionput_autorest.go new file mode 100644 index 00000000000..632eff3bad0 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/method_privateendpointconnectionput_autorest.go @@ -0,0 +1,80 @@ +package privateendpointconnectionresources + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionPutOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response + Model *PrivateEndpointConnectionResource +} + +// PrivateEndpointConnectionPut ... +func (c PrivateEndpointConnectionResourcesClient) PrivateEndpointConnectionPut(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnectionResource) (result PrivateEndpointConnectionPutOperationResponse, err error) { + req, err := c.preparerForPrivateEndpointConnectionPut(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnectionresources.PrivateEndpointConnectionResourcesClient", "PrivateEndpointConnectionPut", nil, "Failure preparing request") + return + } + + result, err = c.senderForPrivateEndpointConnectionPut(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privateendpointconnectionresources.PrivateEndpointConnectionResourcesClient", "PrivateEndpointConnectionPut", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// PrivateEndpointConnectionPutThenPoll performs PrivateEndpointConnectionPut then polls until it's completed +func (c PrivateEndpointConnectionResourcesClient) PrivateEndpointConnectionPutThenPoll(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnectionResource) error { + result, err := c.PrivateEndpointConnectionPut(ctx, id, input) + if err != nil { + return fmt.Errorf("performing PrivateEndpointConnectionPut: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after PrivateEndpointConnectionPut: %+v", err) + } + + return nil +} + +// preparerForPrivateEndpointConnectionPut prepares the PrivateEndpointConnectionPut request. +func (c PrivateEndpointConnectionResourcesClient) preparerForPrivateEndpointConnectionPut(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnectionResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForPrivateEndpointConnectionPut sends the PrivateEndpointConnectionPut request. The method will close the +// http.Response Body if it receives an error. +func (c PrivateEndpointConnectionResourcesClient) senderForPrivateEndpointConnectionPut(ctx context.Context, req *http.Request) (future PrivateEndpointConnectionPutOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/model_privateendpoint.go b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/model_privateendpoint.go similarity index 83% rename from resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/model_privateendpoint.go rename to resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/model_privateendpoint.go index 36d044c72d1..76c0b12d421 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/model_privateendpoint.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/model_privateendpoint.go @@ -1,4 +1,4 @@ -package privateendpointconnection +package privateendpointconnectionresources // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/model_privateendpointconnection.go b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/model_privateendpointconnection.go similarity index 93% rename from resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/model_privateendpointconnection.go rename to resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/model_privateendpointconnection.go index 0acbbb1f932..322c0283856 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/model_privateendpointconnection.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/model_privateendpointconnection.go @@ -1,4 +1,4 @@ -package privateendpointconnection +package privateendpointconnectionresources // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/model_privateendpointconnectionresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/model_privateendpointconnectionresource.go similarity index 77% rename from resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/model_privateendpointconnectionresource.go rename to resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/model_privateendpointconnectionresource.go index e3f0f4f5c74..ce8229e2901 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/model_privateendpointconnectionresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/model_privateendpointconnectionresource.go @@ -1,4 +1,8 @@ -package privateendpointconnection +package privateendpointconnectionresources + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -9,6 +13,7 @@ type PrivateEndpointConnectionResource struct { Location *string `json:"location,omitempty"` Name *string `json:"name,omitempty"` Properties *PrivateEndpointConnection `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` Tags *map[string]string `json:"tags,omitempty"` Type *string `json:"type,omitempty"` } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/model_privatelinkserviceconnectionstate.go b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/model_privatelinkserviceconnectionstate.go similarity index 91% rename from resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/model_privatelinkserviceconnectionstate.go rename to resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/model_privatelinkserviceconnectionstate.go index 81c55145a70..0aec3b2f13f 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/model_privatelinkserviceconnectionstate.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/model_privatelinkserviceconnectionstate.go @@ -1,4 +1,4 @@ -package privateendpointconnection +package privateendpointconnectionresources // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/version.go b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/version.go similarity index 64% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/version.go rename to resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/version.go index a7ea9d67386..a3c8bcd0b56 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/version.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnectionresources/version.go @@ -1,4 +1,4 @@ -package backupprotectionintent +package privateendpointconnectionresources // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -6,5 +6,5 @@ package backupprotectionintent const defaultApiVersion = "2025-02-01" func userAgent() string { - return "hashicorp/go-azure-sdk/backupprotectionintent/2025-02-01" + return "hashicorp/go-azure-sdk/privateendpointconnectionresources/2025-02-01" } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/README.md deleted file mode 100644 index c07f5c35cf5..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers` Documentation - -The `protectablecontainers` SDK allows for interaction with Azure Resource Manager `recoveryservicesbackup` (API Version `2025-02-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers" -``` - - -### Client Initialization - -```go -client := protectablecontainers.NewProtectableContainersClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `ProtectableContainersClient.List` - -```go -ctx := context.TODO() -id := protectablecontainers.NewBackupFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "backupFabricName") - -// alternatively `client.List(ctx, id, protectablecontainers.DefaultListOperationOptions())` can be used to do batched pagination -items, err := client.ListComplete(ctx, id, protectablecontainers.DefaultListOperationOptions()) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/client.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/client.go deleted file mode 100644 index 3d5274d457a..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package protectablecontainers - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ProtectableContainersClient struct { - Client autorest.Client - baseUri string -} - -func NewProtectableContainersClientWithBaseURI(endpoint string) ProtectableContainersClient { - return ProtectableContainersClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/constants.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/constants.go deleted file mode 100644 index 0f5cac0dec3..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/constants.go +++ /dev/null @@ -1,133 +0,0 @@ -package protectablecontainers - -import ( - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BackupManagementType string - -const ( - BackupManagementTypeAzureBackupServer BackupManagementType = "AzureBackupServer" - BackupManagementTypeAzureIaasVM BackupManagementType = "AzureIaasVM" - BackupManagementTypeAzureSql BackupManagementType = "AzureSql" - BackupManagementTypeAzureStorage BackupManagementType = "AzureStorage" - BackupManagementTypeAzureWorkload BackupManagementType = "AzureWorkload" - BackupManagementTypeDPM BackupManagementType = "DPM" - BackupManagementTypeDefaultBackup BackupManagementType = "DefaultBackup" - BackupManagementTypeInvalid BackupManagementType = "Invalid" - BackupManagementTypeMAB BackupManagementType = "MAB" -) - -func PossibleValuesForBackupManagementType() []string { - return []string{ - string(BackupManagementTypeAzureBackupServer), - string(BackupManagementTypeAzureIaasVM), - string(BackupManagementTypeAzureSql), - string(BackupManagementTypeAzureStorage), - string(BackupManagementTypeAzureWorkload), - string(BackupManagementTypeDPM), - string(BackupManagementTypeDefaultBackup), - string(BackupManagementTypeInvalid), - string(BackupManagementTypeMAB), - } -} - -func parseBackupManagementType(input string) (*BackupManagementType, error) { - vals := map[string]BackupManagementType{ - "azurebackupserver": BackupManagementTypeAzureBackupServer, - "azureiaasvm": BackupManagementTypeAzureIaasVM, - "azuresql": BackupManagementTypeAzureSql, - "azurestorage": BackupManagementTypeAzureStorage, - "azureworkload": BackupManagementTypeAzureWorkload, - "dpm": BackupManagementTypeDPM, - "defaultbackup": BackupManagementTypeDefaultBackup, - "invalid": BackupManagementTypeInvalid, - "mab": BackupManagementTypeMAB, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := BackupManagementType(input) - return &out, nil -} - -type ProtectableContainerType string - -const ( - ProtectableContainerTypeAzureBackupServerContainer ProtectableContainerType = "AzureBackupServerContainer" - ProtectableContainerTypeAzureSqlContainer ProtectableContainerType = "AzureSqlContainer" - ProtectableContainerTypeAzureWorkloadContainer ProtectableContainerType = "AzureWorkloadContainer" - ProtectableContainerTypeCluster ProtectableContainerType = "Cluster" - ProtectableContainerTypeDPMContainer ProtectableContainerType = "DPMContainer" - ProtectableContainerTypeGenericContainer ProtectableContainerType = "GenericContainer" - ProtectableContainerTypeIaasVMContainer ProtectableContainerType = "IaasVMContainer" - ProtectableContainerTypeIaasVMServiceContainer ProtectableContainerType = "IaasVMServiceContainer" - ProtectableContainerTypeInvalid ProtectableContainerType = "Invalid" - ProtectableContainerTypeMABContainer ProtectableContainerType = "MABContainer" - ProtectableContainerTypeMicrosoftPointClassicComputeVirtualMachines ProtectableContainerType = "Microsoft.ClassicCompute/virtualMachines" - ProtectableContainerTypeMicrosoftPointComputeVirtualMachines ProtectableContainerType = "Microsoft.Compute/virtualMachines" - ProtectableContainerTypeSQLAGWorkLoadContainer ProtectableContainerType = "SQLAGWorkLoadContainer" - ProtectableContainerTypeStorageContainer ProtectableContainerType = "StorageContainer" - ProtectableContainerTypeUnknown ProtectableContainerType = "Unknown" - ProtectableContainerTypeVCenter ProtectableContainerType = "VCenter" - ProtectableContainerTypeVMAppContainer ProtectableContainerType = "VMAppContainer" - ProtectableContainerTypeWindows ProtectableContainerType = "Windows" -) - -func PossibleValuesForProtectableContainerType() []string { - return []string{ - string(ProtectableContainerTypeAzureBackupServerContainer), - string(ProtectableContainerTypeAzureSqlContainer), - string(ProtectableContainerTypeAzureWorkloadContainer), - string(ProtectableContainerTypeCluster), - string(ProtectableContainerTypeDPMContainer), - string(ProtectableContainerTypeGenericContainer), - string(ProtectableContainerTypeIaasVMContainer), - string(ProtectableContainerTypeIaasVMServiceContainer), - string(ProtectableContainerTypeInvalid), - string(ProtectableContainerTypeMABContainer), - string(ProtectableContainerTypeMicrosoftPointClassicComputeVirtualMachines), - string(ProtectableContainerTypeMicrosoftPointComputeVirtualMachines), - string(ProtectableContainerTypeSQLAGWorkLoadContainer), - string(ProtectableContainerTypeStorageContainer), - string(ProtectableContainerTypeUnknown), - string(ProtectableContainerTypeVCenter), - string(ProtectableContainerTypeVMAppContainer), - string(ProtectableContainerTypeWindows), - } -} - -func parseProtectableContainerType(input string) (*ProtectableContainerType, error) { - vals := map[string]ProtectableContainerType{ - "azurebackupservercontainer": ProtectableContainerTypeAzureBackupServerContainer, - "azuresqlcontainer": ProtectableContainerTypeAzureSqlContainer, - "azureworkloadcontainer": ProtectableContainerTypeAzureWorkloadContainer, - "cluster": ProtectableContainerTypeCluster, - "dpmcontainer": ProtectableContainerTypeDPMContainer, - "genericcontainer": ProtectableContainerTypeGenericContainer, - "iaasvmcontainer": ProtectableContainerTypeIaasVMContainer, - "iaasvmservicecontainer": ProtectableContainerTypeIaasVMServiceContainer, - "invalid": ProtectableContainerTypeInvalid, - "mabcontainer": ProtectableContainerTypeMABContainer, - "microsoft.classiccompute/virtualmachines": ProtectableContainerTypeMicrosoftPointClassicComputeVirtualMachines, - "microsoft.compute/virtualmachines": ProtectableContainerTypeMicrosoftPointComputeVirtualMachines, - "sqlagworkloadcontainer": ProtectableContainerTypeSQLAGWorkLoadContainer, - "storagecontainer": ProtectableContainerTypeStorageContainer, - "unknown": ProtectableContainerTypeUnknown, - "vcenter": ProtectableContainerTypeVCenter, - "vmappcontainer": ProtectableContainerTypeVMAppContainer, - "windows": ProtectableContainerTypeWindows, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProtectableContainerType(input) - return &out, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/method_list_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/method_list_autorest.go deleted file mode 100644 index bdea7c60f0c..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/method_list_autorest.go +++ /dev/null @@ -1,215 +0,0 @@ -package protectablecontainers - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]ProtectableContainerResource - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []ProtectableContainerResource -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListOperationOptions struct { - Filter *string -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - return out -} - -// List ... -func (c ProtectableContainersClient) List(ctx context.Context, id BackupFabricId, options ListOperationOptions) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "protectablecontainers.ProtectableContainersClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "protectablecontainers.ProtectableContainersClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "protectablecontainers.ProtectableContainersClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForList prepares the List request. -func (c ProtectableContainersClient) preparerForList(ctx context.Context, id BackupFabricId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/protectableContainers", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c ProtectableContainersClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c ProtectableContainersClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []ProtectableContainerResource `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "protectablecontainers.ProtectableContainersClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "protectablecontainers.ProtectableContainersClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "protectablecontainers.ProtectableContainersClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c ProtectableContainersClient) ListComplete(ctx context.Context, id BackupFabricId, options ListOperationOptions) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, options, ProtectableContainerResourceOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ProtectableContainersClient) ListCompleteMatchingPredicate(ctx context.Context, id BackupFabricId, options ListOperationOptions, predicate ProtectableContainerResourceOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]ProtectableContainerResource, 0) - - page, err := c.List(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/version.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/version.go deleted file mode 100644 index fe3233a6c8a..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectablecontainers/version.go +++ /dev/null @@ -1,10 +0,0 @@ -package protectablecontainers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2025-02-01" - -func userAgent() string { - return "hashicorp/go-azure-sdk/protectablecontainers/2025-02-01" -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protecteditems/model_protecteditemresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/protecteditems/model_protecteditemresource.go index 62666130ef1..3bbec2ebc09 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protecteditems/model_protecteditemresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/protecteditems/model_protecteditemresource.go @@ -3,31 +3,35 @@ package protecteditems import ( "encoding/json" "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" ) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProtectedItemResource struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties ProtectedItem `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties ProtectedItem `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } var _ json.Unmarshaler = &ProtectedItemResource{} func (s *ProtectedItemResource) UnmarshalJSON(bytes []byte) error { var decoded struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -37,6 +41,7 @@ func (s *ProtectedItemResource) UnmarshalJSON(bytes []byte) error { s.Id = decoded.Id s.Location = decoded.Location s.Name = decoded.Name + s.SystemData = decoded.SystemData s.Tags = decoded.Tags s.Type = decoded.Type diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectioncontainers/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/protectioncontainers/README.md index 0d6d5a7c984..d9e7f3a8b72 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectioncontainers/README.md +++ b/resource-manager/recoveryservicesbackup/2025-02-01/protectioncontainers/README.md @@ -52,22 +52,6 @@ if model := read.Model; model != nil { ``` -### Example Usage: `ProtectionContainersClient.Refresh` - -```go -ctx := context.TODO() -id := protectioncontainers.NewBackupFabricID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "backupFabricName") - -read, err := client.Refresh(ctx, id, protectioncontainers.DefaultRefreshOperationOptions()) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - ### Example Usage: `ProtectionContainersClient.Register` ```go diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectioncontainers/method_refresh_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectioncontainers/method_refresh_autorest.go deleted file mode 100644 index 2b4984af995..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectioncontainers/method_refresh_autorest.go +++ /dev/null @@ -1,96 +0,0 @@ -package protectioncontainers - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RefreshOperationResponse struct { - HttpResponse *http.Response -} - -type RefreshOperationOptions struct { - Filter *string -} - -func DefaultRefreshOperationOptions() RefreshOperationOptions { - return RefreshOperationOptions{} -} - -func (o RefreshOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o RefreshOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - return out -} - -// Refresh ... -func (c ProtectionContainersClient) Refresh(ctx context.Context, id BackupFabricId, options RefreshOperationOptions) (result RefreshOperationResponse, err error) { - req, err := c.preparerForRefresh(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "protectioncontainers.ProtectionContainersClient", "Refresh", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "protectioncontainers.ProtectionContainersClient", "Refresh", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRefresh(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "protectioncontainers.ProtectionContainersClient", "Refresh", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRefresh prepares the Refresh request. -func (c ProtectionContainersClient) preparerForRefresh(ctx context.Context, id BackupFabricId, options RefreshOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/refreshContainers", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRefresh handles the response to the Refresh request. The method always -// closes the http.Response Body. -func (c ProtectionContainersClient) responderForRefresh(resp *http.Response) (result RefreshOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusAccepted), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectioncontainers/model_protectioncontainerresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectioncontainers/model_protectioncontainerresource.go index b8370f71280..31f78c4c733 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectioncontainers/model_protectioncontainerresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/protectioncontainers/model_protectioncontainerresource.go @@ -3,31 +3,35 @@ package protectioncontainers import ( "encoding/json" "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" ) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProtectionContainerResource struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties ProtectionContainer `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties ProtectionContainer `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } var _ json.Unmarshaler = &ProtectionContainerResource{} func (s *ProtectionContainerResource) UnmarshalJSON(bytes []byte) error { var decoded struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -37,6 +41,7 @@ func (s *ProtectionContainerResource) UnmarshalJSON(bytes []byte) error { s.Id = decoded.Id s.Location = decoded.Location s.Name = decoded.Name + s.SystemData = decoded.SystemData s.Tags = decoded.Tags s.Type = decoded.Type diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/README.md deleted file mode 100644 index fda2dd6c148..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/README.md +++ /dev/null @@ -1,94 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent` Documentation - -The `protectionintent` SDK allows for interaction with Azure Resource Manager `recoveryservicesbackup` (API Version `2025-02-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent" -``` - - -### Client Initialization - -```go -client := protectionintent.NewProtectionIntentClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `ProtectionIntentClient.CreateOrUpdate` - -```go -ctx := context.TODO() -id := protectionintent.NewBackupProtectionIntentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "backupFabricName", "backupProtectionIntentName") - -payload := protectionintent.ProtectionIntentResource{ - // ... -} - - -read, err := client.CreateOrUpdate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `ProtectionIntentClient.Delete` - -```go -ctx := context.TODO() -id := protectionintent.NewBackupProtectionIntentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "backupFabricName", "backupProtectionIntentName") - -read, err := client.Delete(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `ProtectionIntentClient.Get` - -```go -ctx := context.TODO() -id := protectionintent.NewBackupProtectionIntentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "backupFabricName", "backupProtectionIntentName") - -read, err := client.Get(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `ProtectionIntentClient.Validate` - -```go -ctx := context.TODO() -id := protectionintent.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") - -payload := protectionintent.PreValidateEnableBackupRequest{ - // ... -} - - -read, err := client.Validate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/client.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/client.go deleted file mode 100644 index 0ffe385d61d..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package protectionintent - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ProtectionIntentClient struct { - Client autorest.Client - baseUri string -} - -func NewProtectionIntentClientWithBaseURI(endpoint string) ProtectionIntentClient { - return ProtectionIntentClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/constants.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/constants.go deleted file mode 100644 index 5b115e24a59..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/constants.go +++ /dev/null @@ -1,281 +0,0 @@ -package protectionintent - -import ( - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BackupManagementType string - -const ( - BackupManagementTypeAzureBackupServer BackupManagementType = "AzureBackupServer" - BackupManagementTypeAzureIaasVM BackupManagementType = "AzureIaasVM" - BackupManagementTypeAzureSql BackupManagementType = "AzureSql" - BackupManagementTypeAzureStorage BackupManagementType = "AzureStorage" - BackupManagementTypeAzureWorkload BackupManagementType = "AzureWorkload" - BackupManagementTypeDPM BackupManagementType = "DPM" - BackupManagementTypeDefaultBackup BackupManagementType = "DefaultBackup" - BackupManagementTypeInvalid BackupManagementType = "Invalid" - BackupManagementTypeMAB BackupManagementType = "MAB" -) - -func PossibleValuesForBackupManagementType() []string { - return []string{ - string(BackupManagementTypeAzureBackupServer), - string(BackupManagementTypeAzureIaasVM), - string(BackupManagementTypeAzureSql), - string(BackupManagementTypeAzureStorage), - string(BackupManagementTypeAzureWorkload), - string(BackupManagementTypeDPM), - string(BackupManagementTypeDefaultBackup), - string(BackupManagementTypeInvalid), - string(BackupManagementTypeMAB), - } -} - -func parseBackupManagementType(input string) (*BackupManagementType, error) { - vals := map[string]BackupManagementType{ - "azurebackupserver": BackupManagementTypeAzureBackupServer, - "azureiaasvm": BackupManagementTypeAzureIaasVM, - "azuresql": BackupManagementTypeAzureSql, - "azurestorage": BackupManagementTypeAzureStorage, - "azureworkload": BackupManagementTypeAzureWorkload, - "dpm": BackupManagementTypeDPM, - "defaultbackup": BackupManagementTypeDefaultBackup, - "invalid": BackupManagementTypeInvalid, - "mab": BackupManagementTypeMAB, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := BackupManagementType(input) - return &out, nil -} - -type DataSourceType string - -const ( - DataSourceTypeAzureFileShare DataSourceType = "AzureFileShare" - DataSourceTypeAzureSqlDb DataSourceType = "AzureSqlDb" - DataSourceTypeClient DataSourceType = "Client" - DataSourceTypeExchange DataSourceType = "Exchange" - DataSourceTypeFileFolder DataSourceType = "FileFolder" - DataSourceTypeGenericDataSource DataSourceType = "GenericDataSource" - DataSourceTypeInvalid DataSourceType = "Invalid" - DataSourceTypeSAPAseDatabase DataSourceType = "SAPAseDatabase" - DataSourceTypeSAPHanaDBInstance DataSourceType = "SAPHanaDBInstance" - DataSourceTypeSAPHanaDatabase DataSourceType = "SAPHanaDatabase" - DataSourceTypeSQLDB DataSourceType = "SQLDB" - DataSourceTypeSQLDataBase DataSourceType = "SQLDataBase" - DataSourceTypeSharepoint DataSourceType = "Sharepoint" - DataSourceTypeSystemState DataSourceType = "SystemState" - DataSourceTypeVM DataSourceType = "VM" - DataSourceTypeVMwareVM DataSourceType = "VMwareVM" -) - -func PossibleValuesForDataSourceType() []string { - return []string{ - string(DataSourceTypeAzureFileShare), - string(DataSourceTypeAzureSqlDb), - string(DataSourceTypeClient), - string(DataSourceTypeExchange), - string(DataSourceTypeFileFolder), - string(DataSourceTypeGenericDataSource), - string(DataSourceTypeInvalid), - string(DataSourceTypeSAPAseDatabase), - string(DataSourceTypeSAPHanaDBInstance), - string(DataSourceTypeSAPHanaDatabase), - string(DataSourceTypeSQLDB), - string(DataSourceTypeSQLDataBase), - string(DataSourceTypeSharepoint), - string(DataSourceTypeSystemState), - string(DataSourceTypeVM), - string(DataSourceTypeVMwareVM), - } -} - -func parseDataSourceType(input string) (*DataSourceType, error) { - vals := map[string]DataSourceType{ - "azurefileshare": DataSourceTypeAzureFileShare, - "azuresqldb": DataSourceTypeAzureSqlDb, - "client": DataSourceTypeClient, - "exchange": DataSourceTypeExchange, - "filefolder": DataSourceTypeFileFolder, - "genericdatasource": DataSourceTypeGenericDataSource, - "invalid": DataSourceTypeInvalid, - "sapasedatabase": DataSourceTypeSAPAseDatabase, - "saphanadbinstance": DataSourceTypeSAPHanaDBInstance, - "saphanadatabase": DataSourceTypeSAPHanaDatabase, - "sqldb": DataSourceTypeSQLDB, - "sqldatabase": DataSourceTypeSQLDataBase, - "sharepoint": DataSourceTypeSharepoint, - "systemstate": DataSourceTypeSystemState, - "vm": DataSourceTypeVM, - "vmwarevm": DataSourceTypeVMwareVM, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := DataSourceType(input) - return &out, nil -} - -type ProtectionIntentItemType string - -const ( - ProtectionIntentItemTypeAzureResourceItem ProtectionIntentItemType = "AzureResourceItem" - ProtectionIntentItemTypeAzureWorkloadAutoProtectionIntent ProtectionIntentItemType = "AzureWorkloadAutoProtectionIntent" - ProtectionIntentItemTypeAzureWorkloadContainerAutoProtectionIntent ProtectionIntentItemType = "AzureWorkloadContainerAutoProtectionIntent" - ProtectionIntentItemTypeAzureWorkloadSQLAutoProtectionIntent ProtectionIntentItemType = "AzureWorkloadSQLAutoProtectionIntent" - ProtectionIntentItemTypeInvalid ProtectionIntentItemType = "Invalid" - ProtectionIntentItemTypeRecoveryServiceVaultItem ProtectionIntentItemType = "RecoveryServiceVaultItem" -) - -func PossibleValuesForProtectionIntentItemType() []string { - return []string{ - string(ProtectionIntentItemTypeAzureResourceItem), - string(ProtectionIntentItemTypeAzureWorkloadAutoProtectionIntent), - string(ProtectionIntentItemTypeAzureWorkloadContainerAutoProtectionIntent), - string(ProtectionIntentItemTypeAzureWorkloadSQLAutoProtectionIntent), - string(ProtectionIntentItemTypeInvalid), - string(ProtectionIntentItemTypeRecoveryServiceVaultItem), - } -} - -func parseProtectionIntentItemType(input string) (*ProtectionIntentItemType, error) { - vals := map[string]ProtectionIntentItemType{ - "azureresourceitem": ProtectionIntentItemTypeAzureResourceItem, - "azureworkloadautoprotectionintent": ProtectionIntentItemTypeAzureWorkloadAutoProtectionIntent, - "azureworkloadcontainerautoprotectionintent": ProtectionIntentItemTypeAzureWorkloadContainerAutoProtectionIntent, - "azureworkloadsqlautoprotectionintent": ProtectionIntentItemTypeAzureWorkloadSQLAutoProtectionIntent, - "invalid": ProtectionIntentItemTypeInvalid, - "recoveryservicevaultitem": ProtectionIntentItemTypeRecoveryServiceVaultItem, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProtectionIntentItemType(input) - return &out, nil -} - -type ProtectionStatus string - -const ( - ProtectionStatusInvalid ProtectionStatus = "Invalid" - ProtectionStatusNotProtected ProtectionStatus = "NotProtected" - ProtectionStatusProtected ProtectionStatus = "Protected" - ProtectionStatusProtecting ProtectionStatus = "Protecting" - ProtectionStatusProtectionFailed ProtectionStatus = "ProtectionFailed" -) - -func PossibleValuesForProtectionStatus() []string { - return []string{ - string(ProtectionStatusInvalid), - string(ProtectionStatusNotProtected), - string(ProtectionStatusProtected), - string(ProtectionStatusProtecting), - string(ProtectionStatusProtectionFailed), - } -} - -func parseProtectionStatus(input string) (*ProtectionStatus, error) { - vals := map[string]ProtectionStatus{ - "invalid": ProtectionStatusInvalid, - "notprotected": ProtectionStatusNotProtected, - "protected": ProtectionStatusProtected, - "protecting": ProtectionStatusProtecting, - "protectionfailed": ProtectionStatusProtectionFailed, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProtectionStatus(input) - return &out, nil -} - -type ValidationStatus string - -const ( - ValidationStatusFailed ValidationStatus = "Failed" - ValidationStatusInvalid ValidationStatus = "Invalid" - ValidationStatusSucceeded ValidationStatus = "Succeeded" -) - -func PossibleValuesForValidationStatus() []string { - return []string{ - string(ValidationStatusFailed), - string(ValidationStatusInvalid), - string(ValidationStatusSucceeded), - } -} - -func parseValidationStatus(input string) (*ValidationStatus, error) { - vals := map[string]ValidationStatus{ - "failed": ValidationStatusFailed, - "invalid": ValidationStatusInvalid, - "succeeded": ValidationStatusSucceeded, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ValidationStatus(input) - return &out, nil -} - -type WorkloadItemType string - -const ( - WorkloadItemTypeInvalid WorkloadItemType = "Invalid" - WorkloadItemTypeSAPAseDatabase WorkloadItemType = "SAPAseDatabase" - WorkloadItemTypeSAPAseSystem WorkloadItemType = "SAPAseSystem" - WorkloadItemTypeSAPHanaDBInstance WorkloadItemType = "SAPHanaDBInstance" - WorkloadItemTypeSAPHanaDatabase WorkloadItemType = "SAPHanaDatabase" - WorkloadItemTypeSAPHanaSystem WorkloadItemType = "SAPHanaSystem" - WorkloadItemTypeSQLDataBase WorkloadItemType = "SQLDataBase" - WorkloadItemTypeSQLInstance WorkloadItemType = "SQLInstance" -) - -func PossibleValuesForWorkloadItemType() []string { - return []string{ - string(WorkloadItemTypeInvalid), - string(WorkloadItemTypeSAPAseDatabase), - string(WorkloadItemTypeSAPAseSystem), - string(WorkloadItemTypeSAPHanaDBInstance), - string(WorkloadItemTypeSAPHanaDatabase), - string(WorkloadItemTypeSAPHanaSystem), - string(WorkloadItemTypeSQLDataBase), - string(WorkloadItemTypeSQLInstance), - } -} - -func parseWorkloadItemType(input string) (*WorkloadItemType, error) { - vals := map[string]WorkloadItemType{ - "invalid": WorkloadItemTypeInvalid, - "sapasedatabase": WorkloadItemTypeSAPAseDatabase, - "sapasesystem": WorkloadItemTypeSAPAseSystem, - "saphanadbinstance": WorkloadItemTypeSAPHanaDBInstance, - "saphanadatabase": WorkloadItemTypeSAPHanaDatabase, - "saphanasystem": WorkloadItemTypeSAPHanaSystem, - "sqldatabase": WorkloadItemTypeSQLDataBase, - "sqlinstance": WorkloadItemTypeSQLInstance, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := WorkloadItemType(input) - return &out, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/method_createorupdate_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/method_createorupdate_autorest.go deleted file mode 100644 index 119b9b9a38a..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/method_createorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package protectionintent - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *ProtectionIntentResource -} - -// CreateOrUpdate ... -func (c ProtectionIntentClient) CreateOrUpdate(ctx context.Context, id BackupProtectionIntentId, input ProtectionIntentResource) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "protectionintent.ProtectionIntentClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "protectionintent.ProtectionIntentClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "protectionintent.ProtectionIntentClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ProtectionIntentClient) preparerForCreateOrUpdate(ctx context.Context, id BackupProtectionIntentId, input ProtectionIntentResource) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ProtectionIntentClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/method_delete_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/method_delete_autorest.go deleted file mode 100644 index 2ed03771624..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package protectionintent - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c ProtectionIntentClient) Delete(ctx context.Context, id BackupProtectionIntentId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "protectionintent.ProtectionIntentClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "protectionintent.ProtectionIntentClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "protectionintent.ProtectionIntentClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ProtectionIntentClient) preparerForDelete(ctx context.Context, id BackupProtectionIntentId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ProtectionIntentClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/method_get_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/method_get_autorest.go deleted file mode 100644 index 0875ecb9ece..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package protectionintent - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *ProtectionIntentResource -} - -// Get ... -func (c ProtectionIntentClient) Get(ctx context.Context, id BackupProtectionIntentId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "protectionintent.ProtectionIntentClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "protectionintent.ProtectionIntentClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "protectionintent.ProtectionIntentClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ProtectionIntentClient) preparerForGet(ctx context.Context, id BackupProtectionIntentId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ProtectionIntentClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/method_validate_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/method_validate_autorest.go deleted file mode 100644 index 677f74de02b..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/method_validate_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package protectionintent - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ValidateOperationResponse struct { - HttpResponse *http.Response - Model *PreValidateEnableBackupResponse -} - -// Validate ... -func (c ProtectionIntentClient) Validate(ctx context.Context, id LocationId, input PreValidateEnableBackupRequest) (result ValidateOperationResponse, err error) { - req, err := c.preparerForValidate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "protectionintent.ProtectionIntentClient", "Validate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "protectionintent.ProtectionIntentClient", "Validate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForValidate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "protectionintent.ProtectionIntentClient", "Validate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForValidate prepares the Validate request. -func (c ProtectionIntentClient) preparerForValidate(ctx context.Context, id LocationId, input PreValidateEnableBackupRequest) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/backupPreValidateProtection", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForValidate handles the response to the Validate request. The method always -// closes the http.Response Body. -func (c ProtectionIntentClient) responderForValidate(resp *http.Response) (result ValidateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/version.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/version.go deleted file mode 100644 index d4fbb4728df..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/version.go +++ /dev/null @@ -1,10 +0,0 @@ -package protectionintent - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2025-02-01" - -func userAgent() string { - return "hashicorp/go-azure-sdk/protectionintent/2025-02-01" -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/README.md new file mode 100644 index 00000000000..56e7b04ed02 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/README.md @@ -0,0 +1,73 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources` Documentation + +The `protectionintentresources` SDK allows for interaction with Azure Resource Manager `recoveryservicesbackup` (API Version `2025-02-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources" +``` + + +### Client Initialization + +```go +client := protectionintentresources.NewProtectionIntentResourcesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ProtectionIntentResourcesClient.ProtectionIntentCreateOrUpdate` + +```go +ctx := context.TODO() +id := protectionintentresources.NewBackupProtectionIntentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "backupFabricName", "backupProtectionIntentName") + +payload := protectionintentresources.ProtectionIntentResource{ + // ... +} + + +read, err := client.ProtectionIntentCreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProtectionIntentResourcesClient.ProtectionIntentDelete` + +```go +ctx := context.TODO() +id := protectionintentresources.NewBackupProtectionIntentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "backupFabricName", "backupProtectionIntentName") + +read, err := client.ProtectionIntentDelete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProtectionIntentResourcesClient.ProtectionIntentGet` + +```go +ctx := context.TODO() +id := protectionintentresources.NewBackupProtectionIntentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "backupFabricName", "backupProtectionIntentName") + +read, err := client.ProtectionIntentGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/client.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/client.go similarity index 59% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/client.go rename to resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/client.go index 7bb37dd5d36..4fdc5046c01 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotecteditems/client.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/client.go @@ -1,17 +1,17 @@ -package backupprotecteditems +package protectionintentresources import "github.com/Azure/go-autorest/autorest" // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type BackupProtectedItemsClient struct { +type ProtectionIntentResourcesClient struct { Client autorest.Client baseUri string } -func NewBackupProtectedItemsClientWithBaseURI(endpoint string) BackupProtectedItemsClient { - return BackupProtectedItemsClient{ +func NewProtectionIntentResourcesClientWithBaseURI(endpoint string) ProtectionIntentResourcesClient { + return ProtectionIntentResourcesClient{ Client: autorest.NewClientWithUserAgent(userAgent()), baseUri: endpoint, } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/constants.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/constants.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/constants.go rename to resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/constants.go index 54a09b9ab92..49d492d4a96 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/constants.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/constants.go @@ -1,4 +1,4 @@ -package backupprotectionintent +package protectionintentresources import ( "strings" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/id_backupprotectionintent.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/id_backupprotectionintent.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/id_backupprotectionintent.go rename to resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/id_backupprotectionintent.go index 688d4fb97af..c06c8f79bc7 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/id_backupprotectionintent.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/id_backupprotectionintent.go @@ -1,4 +1,4 @@ -package protectionintent +package protectionintentresources import ( "fmt" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/id_backupprotectionintent_test.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/id_backupprotectionintent_test.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/id_backupprotectionintent_test.go rename to resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/id_backupprotectionintent_test.go index b2fd670a103..93776d53122 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintent/id_backupprotectionintent_test.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/id_backupprotectionintent_test.go @@ -1,4 +1,4 @@ -package protectionintent +package protectionintentresources import ( "testing" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/method_protectionintentcreateorupdate_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/method_protectionintentcreateorupdate_autorest.go new file mode 100644 index 00000000000..d43b87526b7 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/method_protectionintentcreateorupdate_autorest.go @@ -0,0 +1,69 @@ +package protectionintentresources + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProtectionIntentCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *ProtectionIntentResource +} + +// ProtectionIntentCreateOrUpdate ... +func (c ProtectionIntentResourcesClient) ProtectionIntentCreateOrUpdate(ctx context.Context, id BackupProtectionIntentId, input ProtectionIntentResource) (result ProtectionIntentCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForProtectionIntentCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "protectionintentresources.ProtectionIntentResourcesClient", "ProtectionIntentCreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "protectionintentresources.ProtectionIntentResourcesClient", "ProtectionIntentCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForProtectionIntentCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "protectionintentresources.ProtectionIntentResourcesClient", "ProtectionIntentCreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForProtectionIntentCreateOrUpdate prepares the ProtectionIntentCreateOrUpdate request. +func (c ProtectionIntentResourcesClient) preparerForProtectionIntentCreateOrUpdate(ctx context.Context, id BackupProtectionIntentId, input ProtectionIntentResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForProtectionIntentCreateOrUpdate handles the response to the ProtectionIntentCreateOrUpdate request. The method always +// closes the http.Response Body. +func (c ProtectionIntentResourcesClient) responderForProtectionIntentCreateOrUpdate(resp *http.Response) (result ProtectionIntentCreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/method_protectionintentdelete_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/method_protectionintentdelete_autorest.go new file mode 100644 index 00000000000..db11d23ea51 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/method_protectionintentdelete_autorest.go @@ -0,0 +1,66 @@ +package protectionintentresources + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProtectionIntentDeleteOperationResponse struct { + HttpResponse *http.Response +} + +// ProtectionIntentDelete ... +func (c ProtectionIntentResourcesClient) ProtectionIntentDelete(ctx context.Context, id BackupProtectionIntentId) (result ProtectionIntentDeleteOperationResponse, err error) { + req, err := c.preparerForProtectionIntentDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "protectionintentresources.ProtectionIntentResourcesClient", "ProtectionIntentDelete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "protectionintentresources.ProtectionIntentResourcesClient", "ProtectionIntentDelete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForProtectionIntentDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "protectionintentresources.ProtectionIntentResourcesClient", "ProtectionIntentDelete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForProtectionIntentDelete prepares the ProtectionIntentDelete request. +func (c ProtectionIntentResourcesClient) preparerForProtectionIntentDelete(ctx context.Context, id BackupProtectionIntentId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForProtectionIntentDelete handles the response to the ProtectionIntentDelete request. The method always +// closes the http.Response Body. +func (c ProtectionIntentResourcesClient) responderForProtectionIntentDelete(resp *http.Response) (result ProtectionIntentDeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/method_protectionintentget_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/method_protectionintentget_autorest.go new file mode 100644 index 00000000000..ebbc1b031e2 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/method_protectionintentget_autorest.go @@ -0,0 +1,68 @@ +package protectionintentresources + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProtectionIntentGetOperationResponse struct { + HttpResponse *http.Response + Model *ProtectionIntentResource +} + +// ProtectionIntentGet ... +func (c ProtectionIntentResourcesClient) ProtectionIntentGet(ctx context.Context, id BackupProtectionIntentId) (result ProtectionIntentGetOperationResponse, err error) { + req, err := c.preparerForProtectionIntentGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "protectionintentresources.ProtectionIntentResourcesClient", "ProtectionIntentGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "protectionintentresources.ProtectionIntentResourcesClient", "ProtectionIntentGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForProtectionIntentGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "protectionintentresources.ProtectionIntentResourcesClient", "ProtectionIntentGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForProtectionIntentGet prepares the ProtectionIntentGet request. +func (c ProtectionIntentResourcesClient) preparerForProtectionIntentGet(ctx context.Context, id BackupProtectionIntentId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForProtectionIntentGet handles the response to the ProtectionIntentGet request. The method always +// closes the http.Response Body. +func (c ProtectionIntentResourcesClient) responderForProtectionIntentGet(resp *http.Response) (result ProtectionIntentGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/model_azurerecoveryservicevaultprotectionintent.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/model_azurerecoveryservicevaultprotectionintent.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/model_azurerecoveryservicevaultprotectionintent.go rename to resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/model_azurerecoveryservicevaultprotectionintent.go index f3a96053fba..46f8cbd5627 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/model_azurerecoveryservicevaultprotectionintent.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/model_azurerecoveryservicevaultprotectionintent.go @@ -1,4 +1,4 @@ -package backupprotectionintent +package protectionintentresources import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/model_azureresourceprotectionintent.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/model_azureresourceprotectionintent.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/model_azureresourceprotectionintent.go rename to resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/model_azureresourceprotectionintent.go index 89e120970bd..133390c9ceb 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/model_azureresourceprotectionintent.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/model_azureresourceprotectionintent.go @@ -1,4 +1,4 @@ -package backupprotectionintent +package protectionintentresources import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/model_azureworkloadautoprotectionintent.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/model_azureworkloadautoprotectionintent.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/model_azureworkloadautoprotectionintent.go rename to resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/model_azureworkloadautoprotectionintent.go index c1bbfceb582..dd58ff438b7 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/model_azureworkloadautoprotectionintent.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/model_azureworkloadautoprotectionintent.go @@ -1,4 +1,4 @@ -package backupprotectionintent +package protectionintentresources import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/model_azureworkloadcontainerautoprotectionintent.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/model_azureworkloadcontainerautoprotectionintent.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/model_azureworkloadcontainerautoprotectionintent.go rename to resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/model_azureworkloadcontainerautoprotectionintent.go index 3210b6e43d6..35d67b807d2 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/model_azureworkloadcontainerautoprotectionintent.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/model_azureworkloadcontainerautoprotectionintent.go @@ -1,4 +1,4 @@ -package backupprotectionintent +package protectionintentresources import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/model_azureworkloadsqlautoprotectionintent.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/model_azureworkloadsqlautoprotectionintent.go similarity index 98% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/model_azureworkloadsqlautoprotectionintent.go rename to resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/model_azureworkloadsqlautoprotectionintent.go index 3f18fb6d200..fc2ffd785b0 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/model_azureworkloadsqlautoprotectionintent.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/model_azureworkloadsqlautoprotectionintent.go @@ -1,4 +1,4 @@ -package backupprotectionintent +package protectionintentresources import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/model_protectionintent.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/model_protectionintent.go similarity index 99% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/model_protectionintent.go rename to resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/model_protectionintent.go index c7eab3c3a81..dbacf3424e2 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/model_protectionintent.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/model_protectionintent.go @@ -1,4 +1,4 @@ -package backupprotectionintent +package protectionintentresources import ( "encoding/json" diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/model_protectionintentresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/model_protectionintentresource.go similarity index 51% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/model_protectionintentresource.go rename to resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/model_protectionintentresource.go index a88830d2741..19942bf3f1b 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectionintent/model_protectionintentresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/model_protectionintentresource.go @@ -1,33 +1,37 @@ -package backupprotectionintent +package protectionintentresources import ( "encoding/json" "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" ) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProtectionIntentResource struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties ProtectionIntent `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties ProtectionIntent `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } var _ json.Unmarshaler = &ProtectionIntentResource{} func (s *ProtectionIntentResource) UnmarshalJSON(bytes []byte) error { var decoded struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -37,6 +41,7 @@ func (s *ProtectionIntentResource) UnmarshalJSON(bytes []byte) error { s.Id = decoded.Id s.Location = decoded.Location s.Name = decoded.Name + s.SystemData = decoded.SystemData s.Tags = decoded.Tags s.Type = decoded.Type diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/version.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/version.go similarity index 70% rename from resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/version.go rename to resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/version.go index 804eb2e114b..cb2411696bd 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/privateendpointconnection/version.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/protectionintentresources/version.go @@ -1,4 +1,4 @@ -package privateendpointconnection +package protectionintentresources // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -6,5 +6,5 @@ package privateendpointconnection const defaultApiVersion = "2025-02-01" func userAgent() string { - return "hashicorp/go-azure-sdk/privateendpointconnection/2025-02-01" + return "hashicorp/go-azure-sdk/protectionintentresources/2025-02-01" } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protectionpolicies/model_protectionpolicyresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/protectionpolicies/model_protectionpolicyresource.go index 94fb7fdc439..f8baffdab33 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protectionpolicies/model_protectionpolicyresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/protectionpolicies/model_protectionpolicyresource.go @@ -3,31 +3,35 @@ package protectionpolicies import ( "encoding/json" "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" ) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ProtectionPolicyResource struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties ProtectionPolicy `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties ProtectionPolicy `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } var _ json.Unmarshaler = &ProtectionPolicyResource{} func (s *ProtectionPolicyResource) UnmarshalJSON(bytes []byte) error { var decoded struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -37,6 +41,7 @@ func (s *ProtectionPolicyResource) UnmarshalJSON(bytes []byte) error { s.Id = decoded.Id s.Location = decoded.Location s.Name = decoded.Name + s.SystemData = decoded.SystemData s.Tags = decoded.Tags s.Type = decoded.Type diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/README.md deleted file mode 100644 index e6a0ddae550..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint` Documentation - -The `recoverypoint` SDK allows for interaction with Azure Resource Manager `recoveryservicesbackup` (API Version `2025-02-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint" -``` - - -### Client Initialization - -```go -client := recoverypoint.NewRecoveryPointClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `RecoveryPointClient.MoveRecoveryPoint` - -```go -ctx := context.TODO() -id := recoverypoint.NewRecoveryPointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "backupFabricName", "protectionContainerName", "protectedItemName", "recoveryPointId") - -payload := recoverypoint.MoveRPAcrossTiersRequest{ - // ... -} - - -if err := client.MoveRecoveryPointThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/client.go b/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/client.go deleted file mode 100644 index 6c60cc292bc..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package recoverypoint - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RecoveryPointClient struct { - Client autorest.Client - baseUri string -} - -func NewRecoveryPointClientWithBaseURI(endpoint string) RecoveryPointClient { - return RecoveryPointClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/constants.go b/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/constants.go deleted file mode 100644 index 9c8da179e39..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/constants.go +++ /dev/null @@ -1,42 +0,0 @@ -package recoverypoint - -import ( - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RecoveryPointTierType string - -const ( - RecoveryPointTierTypeArchivedRP RecoveryPointTierType = "ArchivedRP" - RecoveryPointTierTypeHardenedRP RecoveryPointTierType = "HardenedRP" - RecoveryPointTierTypeInstantRP RecoveryPointTierType = "InstantRP" - RecoveryPointTierTypeInvalid RecoveryPointTierType = "Invalid" -) - -func PossibleValuesForRecoveryPointTierType() []string { - return []string{ - string(RecoveryPointTierTypeArchivedRP), - string(RecoveryPointTierTypeHardenedRP), - string(RecoveryPointTierTypeInstantRP), - string(RecoveryPointTierTypeInvalid), - } -} - -func parseRecoveryPointTierType(input string) (*RecoveryPointTierType, error) { - vals := map[string]RecoveryPointTierType{ - "archivedrp": RecoveryPointTierTypeArchivedRP, - "hardenedrp": RecoveryPointTierTypeHardenedRP, - "instantrp": RecoveryPointTierTypeInstantRP, - "invalid": RecoveryPointTierTypeInvalid, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RecoveryPointTierType(input) - return &out, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/id_recoverypoint.go b/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/id_recoverypoint.go deleted file mode 100644 index f39e95f0719..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/id_recoverypoint.go +++ /dev/null @@ -1,166 +0,0 @@ -package recoverypoint - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -func init() { - recaser.RegisterResourceId(&RecoveryPointId{}) -} - -var _ resourceids.ResourceId = &RecoveryPointId{} - -// RecoveryPointId is a struct representing the Resource ID for a Recovery Point -type RecoveryPointId struct { - SubscriptionId string - ResourceGroupName string - VaultName string - BackupFabricName string - ProtectionContainerName string - ProtectedItemName string - RecoveryPointId string -} - -// NewRecoveryPointID returns a new RecoveryPointId struct -func NewRecoveryPointID(subscriptionId string, resourceGroupName string, vaultName string, backupFabricName string, protectionContainerName string, protectedItemName string, recoveryPointId string) RecoveryPointId { - return RecoveryPointId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - VaultName: vaultName, - BackupFabricName: backupFabricName, - ProtectionContainerName: protectionContainerName, - ProtectedItemName: protectedItemName, - RecoveryPointId: recoveryPointId, - } -} - -// ParseRecoveryPointID parses 'input' into a RecoveryPointId -func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { - parser := resourceids.NewParserFromResourceIdType(&RecoveryPointId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := RecoveryPointId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseRecoveryPointIDInsensitively parses 'input' case-insensitively into a RecoveryPointId -// note: this method should only be used for API response data and not user input -func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { - parser := resourceids.NewParserFromResourceIdType(&RecoveryPointId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := RecoveryPointId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *RecoveryPointId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) - } - - if id.VaultName, ok = input.Parsed["vaultName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) - } - - if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) - } - - if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) - } - - if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) - } - - if id.RecoveryPointId, ok = input.Parsed["recoveryPointId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", input) - } - - return nil -} - -// ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID -func ValidateRecoveryPointID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseRecoveryPointID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Recovery Point ID -func (id RecoveryPointId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s/backupFabrics/%s/protectionContainers/%s/protectedItems/%s/recoveryPoints/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.BackupFabricName, id.ProtectionContainerName, id.ProtectedItemName, id.RecoveryPointId) -} - -// Segments returns a slice of Resource ID Segments which comprise this Recovery Point ID -func (id RecoveryPointId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), - resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("vaultName", "vaultName"), - resourceids.StaticSegment("staticBackupFabrics", "backupFabrics", "backupFabrics"), - resourceids.UserSpecifiedSegment("backupFabricName", "backupFabricName"), - resourceids.StaticSegment("staticProtectionContainers", "protectionContainers", "protectionContainers"), - resourceids.UserSpecifiedSegment("protectionContainerName", "protectionContainerName"), - resourceids.StaticSegment("staticProtectedItems", "protectedItems", "protectedItems"), - resourceids.UserSpecifiedSegment("protectedItemName", "protectedItemName"), - resourceids.StaticSegment("staticRecoveryPoints", "recoveryPoints", "recoveryPoints"), - resourceids.UserSpecifiedSegment("recoveryPointId", "recoveryPointId"), - } -} - -// String returns a human-readable description of this Recovery Point ID -func (id RecoveryPointId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Vault Name: %q", id.VaultName), - fmt.Sprintf("Backup Fabric Name: %q", id.BackupFabricName), - fmt.Sprintf("Protection Container Name: %q", id.ProtectionContainerName), - fmt.Sprintf("Protected Item Name: %q", id.ProtectedItemName), - fmt.Sprintf("Recovery Point: %q", id.RecoveryPointId), - } - return fmt.Sprintf("Recovery Point (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/id_recoverypoint_test.go b/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/id_recoverypoint_test.go deleted file mode 100644 index d06d7a3f935..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/id_recoverypoint_test.go +++ /dev/null @@ -1,462 +0,0 @@ -package recoverypoint - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ resourceids.ResourceId = &RecoveryPointId{} - -func TestNewRecoveryPointID(t *testing.T) { - id := NewRecoveryPointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "backupFabricName", "protectionContainerName", "protectedItemName", "recoveryPointId") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.VaultName != "vaultName" { - t.Fatalf("Expected %q but got %q for Segment 'VaultName'", id.VaultName, "vaultName") - } - - if id.BackupFabricName != "backupFabricName" { - t.Fatalf("Expected %q but got %q for Segment 'BackupFabricName'", id.BackupFabricName, "backupFabricName") - } - - if id.ProtectionContainerName != "protectionContainerName" { - t.Fatalf("Expected %q but got %q for Segment 'ProtectionContainerName'", id.ProtectionContainerName, "protectionContainerName") - } - - if id.ProtectedItemName != "protectedItemName" { - t.Fatalf("Expected %q but got %q for Segment 'ProtectedItemName'", id.ProtectedItemName, "protectedItemName") - } - - if id.RecoveryPointId != "recoveryPointId" { - t.Fatalf("Expected %q but got %q for Segment 'RecoveryPointId'", id.RecoveryPointId, "recoveryPointId") - } -} - -func TestFormatRecoveryPointID(t *testing.T) { - actual := NewRecoveryPointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "backupFabricName", "protectionContainerName", "protectedItemName", "recoveryPointId").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics/backupFabricName/protectionContainers/protectionContainerName/protectedItems/protectedItemName/recoveryPoints/recoveryPointId" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseRecoveryPointID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *RecoveryPointId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics/backupFabricName", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics/backupFabricName/protectionContainers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics/backupFabricName/protectionContainers/protectionContainerName", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics/backupFabricName/protectionContainers/protectionContainerName/protectedItems", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics/backupFabricName/protectionContainers/protectionContainerName/protectedItems/protectedItemName", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics/backupFabricName/protectionContainers/protectionContainerName/protectedItems/protectedItemName/recoveryPoints", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics/backupFabricName/protectionContainers/protectionContainerName/protectedItems/protectedItemName/recoveryPoints/recoveryPointId", - Expected: &RecoveryPointId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VaultName: "vaultName", - BackupFabricName: "backupFabricName", - ProtectionContainerName: "protectionContainerName", - ProtectedItemName: "protectedItemName", - RecoveryPointId: "recoveryPointId", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics/backupFabricName/protectionContainers/protectionContainerName/protectedItems/protectedItemName/recoveryPoints/recoveryPointId/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseRecoveryPointID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.VaultName != v.Expected.VaultName { - t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) - } - - if actual.BackupFabricName != v.Expected.BackupFabricName { - t.Fatalf("Expected %q but got %q for BackupFabricName", v.Expected.BackupFabricName, actual.BackupFabricName) - } - - if actual.ProtectionContainerName != v.Expected.ProtectionContainerName { - t.Fatalf("Expected %q but got %q for ProtectionContainerName", v.Expected.ProtectionContainerName, actual.ProtectionContainerName) - } - - if actual.ProtectedItemName != v.Expected.ProtectedItemName { - t.Fatalf("Expected %q but got %q for ProtectedItemName", v.Expected.ProtectedItemName, actual.ProtectedItemName) - } - - if actual.RecoveryPointId != v.Expected.RecoveryPointId { - t.Fatalf("Expected %q but got %q for RecoveryPointId", v.Expected.RecoveryPointId, actual.RecoveryPointId) - } - - } -} - -func TestParseRecoveryPointIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *RecoveryPointId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/bAcKuPfAbRiCs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics/backupFabricName", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/bAcKuPfAbRiCs/bAcKuPfAbRiCnAmE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics/backupFabricName/protectionContainers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/bAcKuPfAbRiCs/bAcKuPfAbRiCnAmE/pRoTeCtIoNcOnTaInErS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics/backupFabricName/protectionContainers/protectionContainerName", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/bAcKuPfAbRiCs/bAcKuPfAbRiCnAmE/pRoTeCtIoNcOnTaInErS/pRoTeCtIoNcOnTaInErNaMe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics/backupFabricName/protectionContainers/protectionContainerName/protectedItems", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/bAcKuPfAbRiCs/bAcKuPfAbRiCnAmE/pRoTeCtIoNcOnTaInErS/pRoTeCtIoNcOnTaInErNaMe/pRoTeCtEdItEmS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics/backupFabricName/protectionContainers/protectionContainerName/protectedItems/protectedItemName", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/bAcKuPfAbRiCs/bAcKuPfAbRiCnAmE/pRoTeCtIoNcOnTaInErS/pRoTeCtIoNcOnTaInErNaMe/pRoTeCtEdItEmS/pRoTeCtEdItEmNaMe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics/backupFabricName/protectionContainers/protectionContainerName/protectedItems/protectedItemName/recoveryPoints", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/bAcKuPfAbRiCs/bAcKuPfAbRiCnAmE/pRoTeCtIoNcOnTaInErS/pRoTeCtIoNcOnTaInErNaMe/pRoTeCtEdItEmS/pRoTeCtEdItEmNaMe/rEcOvErYpOiNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics/backupFabricName/protectionContainers/protectionContainerName/protectedItems/protectedItemName/recoveryPoints/recoveryPointId", - Expected: &RecoveryPointId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VaultName: "vaultName", - BackupFabricName: "backupFabricName", - ProtectionContainerName: "protectionContainerName", - ProtectedItemName: "protectedItemName", - RecoveryPointId: "recoveryPointId", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/backupFabrics/backupFabricName/protectionContainers/protectionContainerName/protectedItems/protectedItemName/recoveryPoints/recoveryPointId/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/bAcKuPfAbRiCs/bAcKuPfAbRiCnAmE/pRoTeCtIoNcOnTaInErS/pRoTeCtIoNcOnTaInErNaMe/pRoTeCtEdItEmS/pRoTeCtEdItEmNaMe/rEcOvErYpOiNtS/rEcOvErYpOiNtId", - Expected: &RecoveryPointId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - VaultName: "vAuLtNaMe", - BackupFabricName: "bAcKuPfAbRiCnAmE", - ProtectionContainerName: "pRoTeCtIoNcOnTaInErNaMe", - ProtectedItemName: "pRoTeCtEdItEmNaMe", - RecoveryPointId: "rEcOvErYpOiNtId", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/bAcKuPfAbRiCs/bAcKuPfAbRiCnAmE/pRoTeCtIoNcOnTaInErS/pRoTeCtIoNcOnTaInErNaMe/pRoTeCtEdItEmS/pRoTeCtEdItEmNaMe/rEcOvErYpOiNtS/rEcOvErYpOiNtId/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseRecoveryPointIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.VaultName != v.Expected.VaultName { - t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) - } - - if actual.BackupFabricName != v.Expected.BackupFabricName { - t.Fatalf("Expected %q but got %q for BackupFabricName", v.Expected.BackupFabricName, actual.BackupFabricName) - } - - if actual.ProtectionContainerName != v.Expected.ProtectionContainerName { - t.Fatalf("Expected %q but got %q for ProtectionContainerName", v.Expected.ProtectionContainerName, actual.ProtectionContainerName) - } - - if actual.ProtectedItemName != v.Expected.ProtectedItemName { - t.Fatalf("Expected %q but got %q for ProtectedItemName", v.Expected.ProtectedItemName, actual.ProtectedItemName) - } - - if actual.RecoveryPointId != v.Expected.RecoveryPointId { - t.Fatalf("Expected %q but got %q for RecoveryPointId", v.Expected.RecoveryPointId, actual.RecoveryPointId) - } - - } -} - -func TestSegmentsForRecoveryPointId(t *testing.T) { - segments := RecoveryPointId{}.Segments() - if len(segments) == 0 { - t.Fatalf("RecoveryPointId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/version.go b/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/version.go deleted file mode 100644 index 0b9f884f94c..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/version.go +++ /dev/null @@ -1,10 +0,0 @@ -package recoverypoint - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2025-02-01" - -func userAgent() string { - return "hashicorp/go-azure-sdk/recoverypoint/2025-02-01" -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoints/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoints/README.md index e9a54f4f127..15a40b07c04 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoints/README.md +++ b/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoints/README.md @@ -51,3 +51,20 @@ for _, item := range items { // do something } ``` + + +### Example Usage: `RecoveryPointsClient.MoveRecoveryPoint` + +```go +ctx := context.TODO() +id := recoverypoints.NewRecoveryPointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "backupFabricName", "protectionContainerName", "protectedItemName", "recoveryPointId") + +payload := recoverypoints.MoveRPAcrossTiersRequest{ + // ... +} + + +if err := client.MoveRecoveryPointThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/method_moverecoverypoint_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoints/method_moverecoverypoint_autorest.go similarity index 67% rename from resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/method_moverecoverypoint_autorest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/recoverypoints/method_moverecoverypoint_autorest.go index 77b6f679042..356e0de98c7 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/method_moverecoverypoint_autorest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoints/method_moverecoverypoint_autorest.go @@ -1,4 +1,4 @@ -package recoverypoint +package recoverypoints import ( "context" @@ -19,16 +19,16 @@ type MoveRecoveryPointOperationResponse struct { } // MoveRecoveryPoint ... -func (c RecoveryPointClient) MoveRecoveryPoint(ctx context.Context, id RecoveryPointId, input MoveRPAcrossTiersRequest) (result MoveRecoveryPointOperationResponse, err error) { +func (c RecoveryPointsClient) MoveRecoveryPoint(ctx context.Context, id RecoveryPointId, input MoveRPAcrossTiersRequest) (result MoveRecoveryPointOperationResponse, err error) { req, err := c.preparerForMoveRecoveryPoint(ctx, id, input) if err != nil { - err = autorest.NewErrorWithError(err, "recoverypoint.RecoveryPointClient", "MoveRecoveryPoint", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "recoverypoints.RecoveryPointsClient", "MoveRecoveryPoint", nil, "Failure preparing request") return } result, err = c.senderForMoveRecoveryPoint(ctx, req) if err != nil { - err = autorest.NewErrorWithError(err, "recoverypoint.RecoveryPointClient", "MoveRecoveryPoint", result.HttpResponse, "Failure sending request") + err = autorest.NewErrorWithError(err, "recoverypoints.RecoveryPointsClient", "MoveRecoveryPoint", result.HttpResponse, "Failure sending request") return } @@ -36,7 +36,7 @@ func (c RecoveryPointClient) MoveRecoveryPoint(ctx context.Context, id RecoveryP } // MoveRecoveryPointThenPoll performs MoveRecoveryPoint then polls until it's completed -func (c RecoveryPointClient) MoveRecoveryPointThenPoll(ctx context.Context, id RecoveryPointId, input MoveRPAcrossTiersRequest) error { +func (c RecoveryPointsClient) MoveRecoveryPointThenPoll(ctx context.Context, id RecoveryPointId, input MoveRPAcrossTiersRequest) error { result, err := c.MoveRecoveryPoint(ctx, id, input) if err != nil { return fmt.Errorf("performing MoveRecoveryPoint: %+v", err) @@ -50,7 +50,7 @@ func (c RecoveryPointClient) MoveRecoveryPointThenPoll(ctx context.Context, id R } // preparerForMoveRecoveryPoint prepares the MoveRecoveryPoint request. -func (c RecoveryPointClient) preparerForMoveRecoveryPoint(ctx context.Context, id RecoveryPointId, input MoveRPAcrossTiersRequest) (*http.Request, error) { +func (c RecoveryPointsClient) preparerForMoveRecoveryPoint(ctx context.Context, id RecoveryPointId, input MoveRPAcrossTiersRequest) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -67,7 +67,7 @@ func (c RecoveryPointClient) preparerForMoveRecoveryPoint(ctx context.Context, i // senderForMoveRecoveryPoint sends the MoveRecoveryPoint request. The method will close the // http.Response Body if it receives an error. -func (c RecoveryPointClient) senderForMoveRecoveryPoint(ctx context.Context, req *http.Request) (future MoveRecoveryPointOperationResponse, err error) { +func (c RecoveryPointsClient) senderForMoveRecoveryPoint(ctx context.Context, req *http.Request) (future MoveRecoveryPointOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/model_moverpacrosstiersrequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoints/model_moverpacrosstiersrequest.go similarity index 94% rename from resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/model_moverpacrosstiersrequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/recoverypoints/model_moverpacrosstiersrequest.go index c90154ae670..bae42cec232 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoint/model_moverpacrosstiersrequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoints/model_moverpacrosstiersrequest.go @@ -1,4 +1,4 @@ -package recoverypoint +package recoverypoints // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoints/model_recoverypointresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoints/model_recoverypointresource.go index b5dfebfca85..0bb6145ad4e 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoints/model_recoverypointresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/recoverypoints/model_recoverypointresource.go @@ -3,31 +3,35 @@ package recoverypoints import ( "encoding/json" "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" ) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type RecoveryPointResource struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties RecoveryPoint `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties RecoveryPoint `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } var _ json.Unmarshaler = &RecoveryPointResource{} func (s *RecoveryPointResource) UnmarshalJSON(bytes []byte) error { var decoded struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -37,6 +41,7 @@ func (s *RecoveryPointResource) UnmarshalJSON(bytes []byte) error { s.Id = decoded.Id s.Location = decoded.Location s.Name = decoded.Name + s.SystemData = decoded.SystemData s.Tags = decoded.Tags s.Type = decoded.Type diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/recoverypointsrecommendedformove/model_recoverypointresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/recoverypointsrecommendedformove/model_recoverypointresource.go index 55de0ec114d..e0d3ee36680 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/recoverypointsrecommendedformove/model_recoverypointresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/recoverypointsrecommendedformove/model_recoverypointresource.go @@ -3,31 +3,35 @@ package recoverypointsrecommendedformove import ( "encoding/json" "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" ) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type RecoveryPointResource struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties RecoveryPoint `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties RecoveryPoint `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } var _ json.Unmarshaler = &RecoveryPointResource{} func (s *RecoveryPointResource) UnmarshalJSON(bytes []byte) error { var decoded struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -37,6 +41,7 @@ func (s *RecoveryPointResource) UnmarshalJSON(bytes []byte) error { s.Id = decoded.Id s.Location = decoded.Location s.Name = decoded.Name + s.SystemData = decoded.SystemData s.Tags = decoded.Tags s.Type = decoded.Type diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/resourceguardproxies/model_resourceguardproxybaseresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/resourceguardproxies/model_resourceguardproxybaseresource.go index bc307c162c1..03757380904 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/resourceguardproxies/model_resourceguardproxybaseresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/resourceguardproxies/model_resourceguardproxybaseresource.go @@ -1,5 +1,9 @@ package resourceguardproxies +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -9,6 +13,7 @@ type ResourceGuardProxyBaseResource struct { Location *string `json:"location,omitempty"` Name *string `json:"name,omitempty"` Properties *ResourceGuardProxyBase `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` Tags *map[string]string `json:"tags,omitempty"` Type *string `json:"type,omitempty"` } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/resourceguardproxy/model_resourceguardproxybaseresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/resourceguardproxy/model_resourceguardproxybaseresource.go index f68fdd803b7..02d117ec491 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/resourceguardproxy/model_resourceguardproxybaseresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/resourceguardproxy/model_resourceguardproxybaseresource.go @@ -1,5 +1,9 @@ package resourceguardproxy +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -9,6 +13,7 @@ type ResourceGuardProxyBaseResource struct { Location *string `json:"location,omitempty"` Name *string `json:"name,omitempty"` Properties *ResourceGuardProxyBase `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` Tags *map[string]string `json:"tags,omitempty"` Type *string `json:"type,omitempty"` } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/restores/model_restorerequestresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/restores/model_restorerequestresource.go index 2b5b7e15157..52420efd9e8 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/restores/model_restorerequestresource.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/restores/model_restorerequestresource.go @@ -3,31 +3,35 @@ package restores import ( "encoding/json" "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" ) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type RestoreRequestResource struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties RestoreRequest `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties RestoreRequest `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } var _ json.Unmarshaler = &RestoreRequestResource{} func (s *RestoreRequestResource) UnmarshalJSON(bytes []byte) error { var decoded struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -37,6 +41,7 @@ func (s *RestoreRequestResource) UnmarshalJSON(bytes []byte) error { s.Id = decoded.Id s.Location = decoded.Location s.Name = decoded.Name + s.SystemData = decoded.SystemData s.Tags = decoded.Tags s.Type = decoded.Type diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/securitypins/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/securitypins/README.md deleted file mode 100644 index 3ac93961208..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/securitypins/README.md +++ /dev/null @@ -1,41 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/securitypins` Documentation - -The `securitypins` SDK allows for interaction with Azure Resource Manager `recoveryservicesbackup` (API Version `2025-02-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/securitypins" -``` - - -### Client Initialization - -```go -client := securitypins.NewSecurityPINsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `SecurityPINsClient.Get` - -```go -ctx := context.TODO() -id := securitypins.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") - -payload := securitypins.SecurityPinBase{ - // ... -} - - -read, err := client.Get(ctx, id, payload, securitypins.DefaultGetOperationOptions()) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/securitypins/client.go b/resource-manager/recoveryservicesbackup/2025-02-01/securitypins/client.go deleted file mode 100644 index 117208a5554..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/securitypins/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package securitypins - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SecurityPINsClient struct { - Client autorest.Client - baseUri string -} - -func NewSecurityPINsClientWithBaseURI(endpoint string) SecurityPINsClient { - return SecurityPINsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/securitypins/id_vault.go b/resource-manager/recoveryservicesbackup/2025-02-01/securitypins/id_vault.go deleted file mode 100644 index 1c836e9efd5..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/securitypins/id_vault.go +++ /dev/null @@ -1,130 +0,0 @@ -package securitypins - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -func init() { - recaser.RegisterResourceId(&VaultId{}) -} - -var _ resourceids.ResourceId = &VaultId{} - -// VaultId is a struct representing the Resource ID for a Vault -type VaultId struct { - SubscriptionId string - ResourceGroupName string - VaultName string -} - -// NewVaultID returns a new VaultId struct -func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { - return VaultId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - VaultName: vaultName, - } -} - -// ParseVaultID parses 'input' into a VaultId -func ParseVaultID(input string) (*VaultId, error) { - parser := resourceids.NewParserFromResourceIdType(&VaultId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VaultId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseVaultIDInsensitively parses 'input' case-insensitively into a VaultId -// note: this method should only be used for API response data and not user input -func ParseVaultIDInsensitively(input string) (*VaultId, error) { - parser := resourceids.NewParserFromResourceIdType(&VaultId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VaultId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *VaultId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) - } - - if id.VaultName, ok = input.Parsed["vaultName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) - } - - return nil -} - -// ValidateVaultID checks that 'input' can be parsed as a Vault ID -func ValidateVaultID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseVaultID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Vault ID -func (id VaultId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Vault ID -func (id VaultId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), - resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("vaultName", "vaultName"), - } -} - -// String returns a human-readable description of this Vault ID -func (id VaultId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Vault Name: %q", id.VaultName), - } - return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/securitypins/id_vault_test.go b/resource-manager/recoveryservicesbackup/2025-02-01/securitypins/id_vault_test.go deleted file mode 100644 index 823ad306d4b..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/securitypins/id_vault_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package securitypins - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ resourceids.ResourceId = &VaultId{} - -func TestNewVaultID(t *testing.T) { - id := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.VaultName != "vaultName" { - t.Fatalf("Expected %q but got %q for Segment 'VaultName'", id.VaultName, "vaultName") - } -} - -func TestFormatVaultID(t *testing.T) { - actual := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVaultID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VaultId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VaultName: "vaultName", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVaultID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.VaultName != v.Expected.VaultName { - t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) - } - - } -} - -func TestParseVaultIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VaultId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VaultName: "vaultName", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - VaultName: "vAuLtNaMe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVaultIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.VaultName != v.Expected.VaultName { - t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) - } - - } -} - -func TestSegmentsForVaultId(t *testing.T) { - segments := VaultId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VaultId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/securitypins/version.go b/resource-manager/recoveryservicesbackup/2025-02-01/securitypins/version.go deleted file mode 100644 index adf6e0080b8..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/securitypins/version.go +++ /dev/null @@ -1,10 +0,0 @@ -package securitypins - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2025-02-01" - -func userAgent() string { - return "hashicorp/go-azure-sdk/securitypins/2025-02-01" -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/README.md deleted file mode 100644 index 08067b323b2..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers` Documentation - -The `softdeletedcontainers` SDK allows for interaction with Azure Resource Manager `recoveryservicesbackup` (API Version `2025-02-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers" -``` - - -### Client Initialization - -```go -client := softdeletedcontainers.NewSoftDeletedContainersClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `SoftDeletedContainersClient.DeletedProtectionContainersList` - -```go -ctx := context.TODO() -id := softdeletedcontainers.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") - -// alternatively `client.DeletedProtectionContainersList(ctx, id, softdeletedcontainers.DefaultDeletedProtectionContainersListOperationOptions())` can be used to do batched pagination -items, err := client.DeletedProtectionContainersListComplete(ctx, id, softdeletedcontainers.DefaultDeletedProtectionContainersListOperationOptions()) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/client.go b/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/client.go deleted file mode 100644 index a671a0559b3..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package softdeletedcontainers - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SoftDeletedContainersClient struct { - Client autorest.Client - baseUri string -} - -func NewSoftDeletedContainersClientWithBaseURI(endpoint string) SoftDeletedContainersClient { - return SoftDeletedContainersClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/constants.go b/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/constants.go deleted file mode 100644 index 14f08fb8156..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/constants.go +++ /dev/null @@ -1,335 +0,0 @@ -package softdeletedcontainers - -import ( - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AcquireStorageAccountLock string - -const ( - AcquireStorageAccountLockAcquire AcquireStorageAccountLock = "Acquire" - AcquireStorageAccountLockNotAcquire AcquireStorageAccountLock = "NotAcquire" -) - -func PossibleValuesForAcquireStorageAccountLock() []string { - return []string{ - string(AcquireStorageAccountLockAcquire), - string(AcquireStorageAccountLockNotAcquire), - } -} - -func parseAcquireStorageAccountLock(input string) (*AcquireStorageAccountLock, error) { - vals := map[string]AcquireStorageAccountLock{ - "acquire": AcquireStorageAccountLockAcquire, - "notacquire": AcquireStorageAccountLockNotAcquire, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AcquireStorageAccountLock(input) - return &out, nil -} - -type BackupItemType string - -const ( - BackupItemTypeAzureFileShare BackupItemType = "AzureFileShare" - BackupItemTypeAzureSqlDb BackupItemType = "AzureSqlDb" - BackupItemTypeClient BackupItemType = "Client" - BackupItemTypeExchange BackupItemType = "Exchange" - BackupItemTypeFileFolder BackupItemType = "FileFolder" - BackupItemTypeGenericDataSource BackupItemType = "GenericDataSource" - BackupItemTypeInvalid BackupItemType = "Invalid" - BackupItemTypeSAPAseDatabase BackupItemType = "SAPAseDatabase" - BackupItemTypeSAPHanaDBInstance BackupItemType = "SAPHanaDBInstance" - BackupItemTypeSAPHanaDatabase BackupItemType = "SAPHanaDatabase" - BackupItemTypeSQLDB BackupItemType = "SQLDB" - BackupItemTypeSQLDataBase BackupItemType = "SQLDataBase" - BackupItemTypeSharepoint BackupItemType = "Sharepoint" - BackupItemTypeSystemState BackupItemType = "SystemState" - BackupItemTypeVM BackupItemType = "VM" - BackupItemTypeVMwareVM BackupItemType = "VMwareVM" -) - -func PossibleValuesForBackupItemType() []string { - return []string{ - string(BackupItemTypeAzureFileShare), - string(BackupItemTypeAzureSqlDb), - string(BackupItemTypeClient), - string(BackupItemTypeExchange), - string(BackupItemTypeFileFolder), - string(BackupItemTypeGenericDataSource), - string(BackupItemTypeInvalid), - string(BackupItemTypeSAPAseDatabase), - string(BackupItemTypeSAPHanaDBInstance), - string(BackupItemTypeSAPHanaDatabase), - string(BackupItemTypeSQLDB), - string(BackupItemTypeSQLDataBase), - string(BackupItemTypeSharepoint), - string(BackupItemTypeSystemState), - string(BackupItemTypeVM), - string(BackupItemTypeVMwareVM), - } -} - -func parseBackupItemType(input string) (*BackupItemType, error) { - vals := map[string]BackupItemType{ - "azurefileshare": BackupItemTypeAzureFileShare, - "azuresqldb": BackupItemTypeAzureSqlDb, - "client": BackupItemTypeClient, - "exchange": BackupItemTypeExchange, - "filefolder": BackupItemTypeFileFolder, - "genericdatasource": BackupItemTypeGenericDataSource, - "invalid": BackupItemTypeInvalid, - "sapasedatabase": BackupItemTypeSAPAseDatabase, - "saphanadbinstance": BackupItemTypeSAPHanaDBInstance, - "saphanadatabase": BackupItemTypeSAPHanaDatabase, - "sqldb": BackupItemTypeSQLDB, - "sqldatabase": BackupItemTypeSQLDataBase, - "sharepoint": BackupItemTypeSharepoint, - "systemstate": BackupItemTypeSystemState, - "vm": BackupItemTypeVM, - "vmwarevm": BackupItemTypeVMwareVM, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := BackupItemType(input) - return &out, nil -} - -type BackupManagementType string - -const ( - BackupManagementTypeAzureBackupServer BackupManagementType = "AzureBackupServer" - BackupManagementTypeAzureIaasVM BackupManagementType = "AzureIaasVM" - BackupManagementTypeAzureSql BackupManagementType = "AzureSql" - BackupManagementTypeAzureStorage BackupManagementType = "AzureStorage" - BackupManagementTypeAzureWorkload BackupManagementType = "AzureWorkload" - BackupManagementTypeDPM BackupManagementType = "DPM" - BackupManagementTypeDefaultBackup BackupManagementType = "DefaultBackup" - BackupManagementTypeInvalid BackupManagementType = "Invalid" - BackupManagementTypeMAB BackupManagementType = "MAB" -) - -func PossibleValuesForBackupManagementType() []string { - return []string{ - string(BackupManagementTypeAzureBackupServer), - string(BackupManagementTypeAzureIaasVM), - string(BackupManagementTypeAzureSql), - string(BackupManagementTypeAzureStorage), - string(BackupManagementTypeAzureWorkload), - string(BackupManagementTypeDPM), - string(BackupManagementTypeDefaultBackup), - string(BackupManagementTypeInvalid), - string(BackupManagementTypeMAB), - } -} - -func parseBackupManagementType(input string) (*BackupManagementType, error) { - vals := map[string]BackupManagementType{ - "azurebackupserver": BackupManagementTypeAzureBackupServer, - "azureiaasvm": BackupManagementTypeAzureIaasVM, - "azuresql": BackupManagementTypeAzureSql, - "azurestorage": BackupManagementTypeAzureStorage, - "azureworkload": BackupManagementTypeAzureWorkload, - "dpm": BackupManagementTypeDPM, - "defaultbackup": BackupManagementTypeDefaultBackup, - "invalid": BackupManagementTypeInvalid, - "mab": BackupManagementTypeMAB, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := BackupManagementType(input) - return &out, nil -} - -type OperationType string - -const ( - OperationTypeInvalid OperationType = "Invalid" - OperationTypeRegister OperationType = "Register" - OperationTypeRehydrate OperationType = "Rehydrate" - OperationTypeReregister OperationType = "Reregister" -) - -func PossibleValuesForOperationType() []string { - return []string{ - string(OperationTypeInvalid), - string(OperationTypeRegister), - string(OperationTypeRehydrate), - string(OperationTypeReregister), - } -} - -func parseOperationType(input string) (*OperationType, error) { - vals := map[string]OperationType{ - "invalid": OperationTypeInvalid, - "register": OperationTypeRegister, - "rehydrate": OperationTypeRehydrate, - "reregister": OperationTypeReregister, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := OperationType(input) - return &out, nil -} - -type ProtectableContainerType string - -const ( - ProtectableContainerTypeAzureBackupServerContainer ProtectableContainerType = "AzureBackupServerContainer" - ProtectableContainerTypeAzureSqlContainer ProtectableContainerType = "AzureSqlContainer" - ProtectableContainerTypeAzureWorkloadContainer ProtectableContainerType = "AzureWorkloadContainer" - ProtectableContainerTypeCluster ProtectableContainerType = "Cluster" - ProtectableContainerTypeDPMContainer ProtectableContainerType = "DPMContainer" - ProtectableContainerTypeGenericContainer ProtectableContainerType = "GenericContainer" - ProtectableContainerTypeIaasVMContainer ProtectableContainerType = "IaasVMContainer" - ProtectableContainerTypeIaasVMServiceContainer ProtectableContainerType = "IaasVMServiceContainer" - ProtectableContainerTypeInvalid ProtectableContainerType = "Invalid" - ProtectableContainerTypeMABContainer ProtectableContainerType = "MABContainer" - ProtectableContainerTypeMicrosoftPointClassicComputeVirtualMachines ProtectableContainerType = "Microsoft.ClassicCompute/virtualMachines" - ProtectableContainerTypeMicrosoftPointComputeVirtualMachines ProtectableContainerType = "Microsoft.Compute/virtualMachines" - ProtectableContainerTypeSQLAGWorkLoadContainer ProtectableContainerType = "SQLAGWorkLoadContainer" - ProtectableContainerTypeStorageContainer ProtectableContainerType = "StorageContainer" - ProtectableContainerTypeUnknown ProtectableContainerType = "Unknown" - ProtectableContainerTypeVCenter ProtectableContainerType = "VCenter" - ProtectableContainerTypeVMAppContainer ProtectableContainerType = "VMAppContainer" - ProtectableContainerTypeWindows ProtectableContainerType = "Windows" -) - -func PossibleValuesForProtectableContainerType() []string { - return []string{ - string(ProtectableContainerTypeAzureBackupServerContainer), - string(ProtectableContainerTypeAzureSqlContainer), - string(ProtectableContainerTypeAzureWorkloadContainer), - string(ProtectableContainerTypeCluster), - string(ProtectableContainerTypeDPMContainer), - string(ProtectableContainerTypeGenericContainer), - string(ProtectableContainerTypeIaasVMContainer), - string(ProtectableContainerTypeIaasVMServiceContainer), - string(ProtectableContainerTypeInvalid), - string(ProtectableContainerTypeMABContainer), - string(ProtectableContainerTypeMicrosoftPointClassicComputeVirtualMachines), - string(ProtectableContainerTypeMicrosoftPointComputeVirtualMachines), - string(ProtectableContainerTypeSQLAGWorkLoadContainer), - string(ProtectableContainerTypeStorageContainer), - string(ProtectableContainerTypeUnknown), - string(ProtectableContainerTypeVCenter), - string(ProtectableContainerTypeVMAppContainer), - string(ProtectableContainerTypeWindows), - } -} - -func parseProtectableContainerType(input string) (*ProtectableContainerType, error) { - vals := map[string]ProtectableContainerType{ - "azurebackupservercontainer": ProtectableContainerTypeAzureBackupServerContainer, - "azuresqlcontainer": ProtectableContainerTypeAzureSqlContainer, - "azureworkloadcontainer": ProtectableContainerTypeAzureWorkloadContainer, - "cluster": ProtectableContainerTypeCluster, - "dpmcontainer": ProtectableContainerTypeDPMContainer, - "genericcontainer": ProtectableContainerTypeGenericContainer, - "iaasvmcontainer": ProtectableContainerTypeIaasVMContainer, - "iaasvmservicecontainer": ProtectableContainerTypeIaasVMServiceContainer, - "invalid": ProtectableContainerTypeInvalid, - "mabcontainer": ProtectableContainerTypeMABContainer, - "microsoft.classiccompute/virtualmachines": ProtectableContainerTypeMicrosoftPointClassicComputeVirtualMachines, - "microsoft.compute/virtualmachines": ProtectableContainerTypeMicrosoftPointComputeVirtualMachines, - "sqlagworkloadcontainer": ProtectableContainerTypeSQLAGWorkLoadContainer, - "storagecontainer": ProtectableContainerTypeStorageContainer, - "unknown": ProtectableContainerTypeUnknown, - "vcenter": ProtectableContainerTypeVCenter, - "vmappcontainer": ProtectableContainerTypeVMAppContainer, - "windows": ProtectableContainerTypeWindows, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProtectableContainerType(input) - return &out, nil -} - -type WorkloadType string - -const ( - WorkloadTypeAzureFileShare WorkloadType = "AzureFileShare" - WorkloadTypeAzureSqlDb WorkloadType = "AzureSqlDb" - WorkloadTypeClient WorkloadType = "Client" - WorkloadTypeExchange WorkloadType = "Exchange" - WorkloadTypeFileFolder WorkloadType = "FileFolder" - WorkloadTypeGenericDataSource WorkloadType = "GenericDataSource" - WorkloadTypeInvalid WorkloadType = "Invalid" - WorkloadTypeSAPAseDatabase WorkloadType = "SAPAseDatabase" - WorkloadTypeSAPHanaDBInstance WorkloadType = "SAPHanaDBInstance" - WorkloadTypeSAPHanaDatabase WorkloadType = "SAPHanaDatabase" - WorkloadTypeSQLDB WorkloadType = "SQLDB" - WorkloadTypeSQLDataBase WorkloadType = "SQLDataBase" - WorkloadTypeSharepoint WorkloadType = "Sharepoint" - WorkloadTypeSystemState WorkloadType = "SystemState" - WorkloadTypeVM WorkloadType = "VM" - WorkloadTypeVMwareVM WorkloadType = "VMwareVM" -) - -func PossibleValuesForWorkloadType() []string { - return []string{ - string(WorkloadTypeAzureFileShare), - string(WorkloadTypeAzureSqlDb), - string(WorkloadTypeClient), - string(WorkloadTypeExchange), - string(WorkloadTypeFileFolder), - string(WorkloadTypeGenericDataSource), - string(WorkloadTypeInvalid), - string(WorkloadTypeSAPAseDatabase), - string(WorkloadTypeSAPHanaDBInstance), - string(WorkloadTypeSAPHanaDatabase), - string(WorkloadTypeSQLDB), - string(WorkloadTypeSQLDataBase), - string(WorkloadTypeSharepoint), - string(WorkloadTypeSystemState), - string(WorkloadTypeVM), - string(WorkloadTypeVMwareVM), - } -} - -func parseWorkloadType(input string) (*WorkloadType, error) { - vals := map[string]WorkloadType{ - "azurefileshare": WorkloadTypeAzureFileShare, - "azuresqldb": WorkloadTypeAzureSqlDb, - "client": WorkloadTypeClient, - "exchange": WorkloadTypeExchange, - "filefolder": WorkloadTypeFileFolder, - "genericdatasource": WorkloadTypeGenericDataSource, - "invalid": WorkloadTypeInvalid, - "sapasedatabase": WorkloadTypeSAPAseDatabase, - "saphanadbinstance": WorkloadTypeSAPHanaDBInstance, - "saphanadatabase": WorkloadTypeSAPHanaDatabase, - "sqldb": WorkloadTypeSQLDB, - "sqldatabase": WorkloadTypeSQLDataBase, - "sharepoint": WorkloadTypeSharepoint, - "systemstate": WorkloadTypeSystemState, - "vm": WorkloadTypeVM, - "vmwarevm": WorkloadTypeVMwareVM, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := WorkloadType(input) - return &out, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/id_vault.go b/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/id_vault.go deleted file mode 100644 index d4caae9a90c..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/id_vault.go +++ /dev/null @@ -1,130 +0,0 @@ -package softdeletedcontainers - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -func init() { - recaser.RegisterResourceId(&VaultId{}) -} - -var _ resourceids.ResourceId = &VaultId{} - -// VaultId is a struct representing the Resource ID for a Vault -type VaultId struct { - SubscriptionId string - ResourceGroupName string - VaultName string -} - -// NewVaultID returns a new VaultId struct -func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { - return VaultId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - VaultName: vaultName, - } -} - -// ParseVaultID parses 'input' into a VaultId -func ParseVaultID(input string) (*VaultId, error) { - parser := resourceids.NewParserFromResourceIdType(&VaultId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VaultId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseVaultIDInsensitively parses 'input' case-insensitively into a VaultId -// note: this method should only be used for API response data and not user input -func ParseVaultIDInsensitively(input string) (*VaultId, error) { - parser := resourceids.NewParserFromResourceIdType(&VaultId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VaultId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *VaultId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) - } - - if id.VaultName, ok = input.Parsed["vaultName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) - } - - return nil -} - -// ValidateVaultID checks that 'input' can be parsed as a Vault ID -func ValidateVaultID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseVaultID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Vault ID -func (id VaultId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Vault ID -func (id VaultId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), - resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("vaultName", "vaultName"), - } -} - -// String returns a human-readable description of this Vault ID -func (id VaultId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Vault Name: %q", id.VaultName), - } - return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/id_vault_test.go b/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/id_vault_test.go deleted file mode 100644 index c1ea724ab7c..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/id_vault_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package softdeletedcontainers - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ resourceids.ResourceId = &VaultId{} - -func TestNewVaultID(t *testing.T) { - id := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.VaultName != "vaultName" { - t.Fatalf("Expected %q but got %q for Segment 'VaultName'", id.VaultName, "vaultName") - } -} - -func TestFormatVaultID(t *testing.T) { - actual := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVaultID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VaultId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VaultName: "vaultName", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVaultID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.VaultName != v.Expected.VaultName { - t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) - } - - } -} - -func TestParseVaultIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VaultId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VaultName: "vaultName", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - VaultName: "vAuLtNaMe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVaultIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.VaultName != v.Expected.VaultName { - t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) - } - - } -} - -func TestSegmentsForVaultId(t *testing.T) { - segments := VaultId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VaultId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_distributednodesinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_distributednodesinfo.go deleted file mode 100644 index 3e35634654c..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_distributednodesinfo.go +++ /dev/null @@ -1,11 +0,0 @@ -package softdeletedcontainers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DistributedNodesInfo struct { - ErrorDetail *ErrorDetail `json:"errorDetail,omitempty"` - NodeName *string `json:"nodeName,omitempty"` - SourceResourceId *string `json:"sourceResourceId,omitempty"` - Status *string `json:"status,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_errordetail.go b/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_errordetail.go deleted file mode 100644 index b76617c0e57..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_errordetail.go +++ /dev/null @@ -1,10 +0,0 @@ -package softdeletedcontainers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ErrorDetail struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Recommendations *[]string `json:"recommendations,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_protectioncontainerresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_protectioncontainerresource.go deleted file mode 100644 index c3d8898f9df..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/model_protectioncontainerresource.go +++ /dev/null @@ -1,57 +0,0 @@ -package softdeletedcontainers - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ProtectionContainerResource struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties ProtectionContainer `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} - -var _ json.Unmarshaler = &ProtectionContainerResource{} - -func (s *ProtectionContainerResource) UnmarshalJSON(bytes []byte) error { - var decoded struct { - ETag *string `json:"eTag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` - } - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - - s.ETag = decoded.ETag - s.Id = decoded.Id - s.Location = decoded.Location - s.Name = decoded.Name - s.Tags = decoded.Tags - s.Type = decoded.Type - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling ProtectionContainerResource into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["properties"]; ok { - impl, err := UnmarshalProtectionContainerImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'Properties' for 'ProtectionContainerResource': %+v", err) - } - s.Properties = impl - } - - return nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/version.go b/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/version.go deleted file mode 100644 index 98047842968..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/softdeletedcontainers/version.go +++ /dev/null @@ -1,10 +0,0 @@ -package softdeletedcontainers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2025-02-01" - -func userAgent() string { - return "hashicorp/go-azure-sdk/softdeletedcontainers/2025-02-01" -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/README.md b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/README.md deleted file mode 100644 index e277bafff92..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation` Documentation - -The `validateoperation` SDK allows for interaction with Azure Resource Manager `recoveryservicesbackup` (API Version `2025-02-01`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation" -``` - - -### Client Initialization - -```go -client := validateoperation.NewValidateOperationClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `ValidateOperationClient.Trigger` - -```go -ctx := context.TODO() -id := validateoperation.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") - -payload := validateoperation.ValidateOperationRequestResource{ - // ... -} - - -if err := client.TriggerThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/client.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/client.go deleted file mode 100644 index e729f452d88..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package validateoperation - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ValidateOperationClient struct { - Client autorest.Client - baseUri string -} - -func NewValidateOperationClientWithBaseURI(endpoint string) ValidateOperationClient { - return ValidateOperationClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/constants.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/constants.go deleted file mode 100644 index cbbc4e1670c..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/constants.go +++ /dev/null @@ -1,274 +0,0 @@ -package validateoperation - -import ( - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CopyOptions string - -const ( - CopyOptionsCreateCopy CopyOptions = "CreateCopy" - CopyOptionsFailOnConflict CopyOptions = "FailOnConflict" - CopyOptionsInvalid CopyOptions = "Invalid" - CopyOptionsOverwrite CopyOptions = "Overwrite" - CopyOptionsSkip CopyOptions = "Skip" -) - -func PossibleValuesForCopyOptions() []string { - return []string{ - string(CopyOptionsCreateCopy), - string(CopyOptionsFailOnConflict), - string(CopyOptionsInvalid), - string(CopyOptionsOverwrite), - string(CopyOptionsSkip), - } -} - -func parseCopyOptions(input string) (*CopyOptions, error) { - vals := map[string]CopyOptions{ - "createcopy": CopyOptionsCreateCopy, - "failonconflict": CopyOptionsFailOnConflict, - "invalid": CopyOptionsInvalid, - "overwrite": CopyOptionsOverwrite, - "skip": CopyOptionsSkip, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CopyOptions(input) - return &out, nil -} - -type OverwriteOptions string - -const ( - OverwriteOptionsFailOnConflict OverwriteOptions = "FailOnConflict" - OverwriteOptionsInvalid OverwriteOptions = "Invalid" - OverwriteOptionsOverwrite OverwriteOptions = "Overwrite" -) - -func PossibleValuesForOverwriteOptions() []string { - return []string{ - string(OverwriteOptionsFailOnConflict), - string(OverwriteOptionsInvalid), - string(OverwriteOptionsOverwrite), - } -} - -func parseOverwriteOptions(input string) (*OverwriteOptions, error) { - vals := map[string]OverwriteOptions{ - "failonconflict": OverwriteOptionsFailOnConflict, - "invalid": OverwriteOptionsInvalid, - "overwrite": OverwriteOptionsOverwrite, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := OverwriteOptions(input) - return &out, nil -} - -type RecoveryMode string - -const ( - RecoveryModeFileRecovery RecoveryMode = "FileRecovery" - RecoveryModeInvalid RecoveryMode = "Invalid" - RecoveryModeRecoveryUsingSnapshot RecoveryMode = "RecoveryUsingSnapshot" - RecoveryModeSnapshotAttach RecoveryMode = "SnapshotAttach" - RecoveryModeSnapshotAttachAndRecover RecoveryMode = "SnapshotAttachAndRecover" - RecoveryModeWorkloadRecovery RecoveryMode = "WorkloadRecovery" -) - -func PossibleValuesForRecoveryMode() []string { - return []string{ - string(RecoveryModeFileRecovery), - string(RecoveryModeInvalid), - string(RecoveryModeRecoveryUsingSnapshot), - string(RecoveryModeSnapshotAttach), - string(RecoveryModeSnapshotAttachAndRecover), - string(RecoveryModeWorkloadRecovery), - } -} - -func parseRecoveryMode(input string) (*RecoveryMode, error) { - vals := map[string]RecoveryMode{ - "filerecovery": RecoveryModeFileRecovery, - "invalid": RecoveryModeInvalid, - "recoveryusingsnapshot": RecoveryModeRecoveryUsingSnapshot, - "snapshotattach": RecoveryModeSnapshotAttach, - "snapshotattachandrecover": RecoveryModeSnapshotAttachAndRecover, - "workloadrecovery": RecoveryModeWorkloadRecovery, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RecoveryMode(input) - return &out, nil -} - -type RecoveryType string - -const ( - RecoveryTypeAlternateLocation RecoveryType = "AlternateLocation" - RecoveryTypeInvalid RecoveryType = "Invalid" - RecoveryTypeOffline RecoveryType = "Offline" - RecoveryTypeOriginalLocation RecoveryType = "OriginalLocation" - RecoveryTypeRestoreDisks RecoveryType = "RestoreDisks" -) - -func PossibleValuesForRecoveryType() []string { - return []string{ - string(RecoveryTypeAlternateLocation), - string(RecoveryTypeInvalid), - string(RecoveryTypeOffline), - string(RecoveryTypeOriginalLocation), - string(RecoveryTypeRestoreDisks), - } -} - -func parseRecoveryType(input string) (*RecoveryType, error) { - vals := map[string]RecoveryType{ - "alternatelocation": RecoveryTypeAlternateLocation, - "invalid": RecoveryTypeInvalid, - "offline": RecoveryTypeOffline, - "originallocation": RecoveryTypeOriginalLocation, - "restoredisks": RecoveryTypeRestoreDisks, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RecoveryType(input) - return &out, nil -} - -type RehydrationPriority string - -const ( - RehydrationPriorityHigh RehydrationPriority = "High" - RehydrationPriorityStandard RehydrationPriority = "Standard" -) - -func PossibleValuesForRehydrationPriority() []string { - return []string{ - string(RehydrationPriorityHigh), - string(RehydrationPriorityStandard), - } -} - -func parseRehydrationPriority(input string) (*RehydrationPriority, error) { - vals := map[string]RehydrationPriority{ - "high": RehydrationPriorityHigh, - "standard": RehydrationPriorityStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RehydrationPriority(input) - return &out, nil -} - -type RestoreRequestType string - -const ( - RestoreRequestTypeFullShareRestore RestoreRequestType = "FullShareRestore" - RestoreRequestTypeInvalid RestoreRequestType = "Invalid" - RestoreRequestTypeItemLevelRestore RestoreRequestType = "ItemLevelRestore" -) - -func PossibleValuesForRestoreRequestType() []string { - return []string{ - string(RestoreRequestTypeFullShareRestore), - string(RestoreRequestTypeInvalid), - string(RestoreRequestTypeItemLevelRestore), - } -} - -func parseRestoreRequestType(input string) (*RestoreRequestType, error) { - vals := map[string]RestoreRequestType{ - "fullsharerestore": RestoreRequestTypeFullShareRestore, - "invalid": RestoreRequestTypeInvalid, - "itemlevelrestore": RestoreRequestTypeItemLevelRestore, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RestoreRequestType(input) - return &out, nil -} - -type SQLDataDirectoryType string - -const ( - SQLDataDirectoryTypeData SQLDataDirectoryType = "Data" - SQLDataDirectoryTypeInvalid SQLDataDirectoryType = "Invalid" - SQLDataDirectoryTypeLog SQLDataDirectoryType = "Log" -) - -func PossibleValuesForSQLDataDirectoryType() []string { - return []string{ - string(SQLDataDirectoryTypeData), - string(SQLDataDirectoryTypeInvalid), - string(SQLDataDirectoryTypeLog), - } -} - -func parseSQLDataDirectoryType(input string) (*SQLDataDirectoryType, error) { - vals := map[string]SQLDataDirectoryType{ - "data": SQLDataDirectoryTypeData, - "invalid": SQLDataDirectoryTypeInvalid, - "log": SQLDataDirectoryTypeLog, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SQLDataDirectoryType(input) - return &out, nil -} - -type TargetDiskNetworkAccessOption string - -const ( - TargetDiskNetworkAccessOptionEnablePrivateAccessForAllDisks TargetDiskNetworkAccessOption = "EnablePrivateAccessForAllDisks" - TargetDiskNetworkAccessOptionEnablePublicAccessForAllDisks TargetDiskNetworkAccessOption = "EnablePublicAccessForAllDisks" - TargetDiskNetworkAccessOptionSameAsOnSourceDisks TargetDiskNetworkAccessOption = "SameAsOnSourceDisks" -) - -func PossibleValuesForTargetDiskNetworkAccessOption() []string { - return []string{ - string(TargetDiskNetworkAccessOptionEnablePrivateAccessForAllDisks), - string(TargetDiskNetworkAccessOptionEnablePublicAccessForAllDisks), - string(TargetDiskNetworkAccessOptionSameAsOnSourceDisks), - } -} - -func parseTargetDiskNetworkAccessOption(input string) (*TargetDiskNetworkAccessOption, error) { - vals := map[string]TargetDiskNetworkAccessOption{ - "enableprivateaccessforalldisks": TargetDiskNetworkAccessOptionEnablePrivateAccessForAllDisks, - "enablepublicaccessforalldisks": TargetDiskNetworkAccessOptionEnablePublicAccessForAllDisks, - "sameasonsourcedisks": TargetDiskNetworkAccessOptionSameAsOnSourceDisks, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := TargetDiskNetworkAccessOption(input) - return &out, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/id_vault.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/id_vault.go deleted file mode 100644 index 39334989e8a..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/id_vault.go +++ /dev/null @@ -1,130 +0,0 @@ -package validateoperation - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -func init() { - recaser.RegisterResourceId(&VaultId{}) -} - -var _ resourceids.ResourceId = &VaultId{} - -// VaultId is a struct representing the Resource ID for a Vault -type VaultId struct { - SubscriptionId string - ResourceGroupName string - VaultName string -} - -// NewVaultID returns a new VaultId struct -func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { - return VaultId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - VaultName: vaultName, - } -} - -// ParseVaultID parses 'input' into a VaultId -func ParseVaultID(input string) (*VaultId, error) { - parser := resourceids.NewParserFromResourceIdType(&VaultId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VaultId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseVaultIDInsensitively parses 'input' case-insensitively into a VaultId -// note: this method should only be used for API response data and not user input -func ParseVaultIDInsensitively(input string) (*VaultId, error) { - parser := resourceids.NewParserFromResourceIdType(&VaultId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VaultId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *VaultId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) - } - - if id.VaultName, ok = input.Parsed["vaultName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) - } - - return nil -} - -// ValidateVaultID checks that 'input' can be parsed as a Vault ID -func ValidateVaultID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseVaultID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Vault ID -func (id VaultId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Vault ID -func (id VaultId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), - resourceids.StaticSegment("staticVaults", "vaults", "vaults"), - resourceids.UserSpecifiedSegment("vaultName", "vaultName"), - } -} - -// String returns a human-readable description of this Vault ID -func (id VaultId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Vault Name: %q", id.VaultName), - } - return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/id_vault_test.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/id_vault_test.go deleted file mode 100644 index bac4c9d026d..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/id_vault_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package validateoperation - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ resourceids.ResourceId = &VaultId{} - -func TestNewVaultID(t *testing.T) { - id := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.VaultName != "vaultName" { - t.Fatalf("Expected %q but got %q for Segment 'VaultName'", id.VaultName, "vaultName") - } -} - -func TestFormatVaultID(t *testing.T) { - actual := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVaultID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VaultId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VaultName: "vaultName", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVaultID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.VaultName != v.Expected.VaultName { - t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) - } - - } -} - -func TestParseVaultIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VaultId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VaultName: "vaultName", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe", - Expected: &VaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - VaultName: "vAuLtNaMe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVaultIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.VaultName != v.Expected.VaultName { - t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) - } - - } -} - -func TestSegmentsForVaultId(t *testing.T) { - segments := VaultId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VaultId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/method_trigger_autorest.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/method_trigger_autorest.go deleted file mode 100644 index 1255fd9377e..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/method_trigger_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package validateoperation - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TriggerOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Trigger ... -func (c ValidateOperationClient) Trigger(ctx context.Context, id VaultId, input ValidateOperationRequestResource) (result TriggerOperationResponse, err error) { - req, err := c.preparerForTrigger(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "validateoperation.ValidateOperationClient", "Trigger", nil, "Failure preparing request") - return - } - - result, err = c.senderForTrigger(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "validateoperation.ValidateOperationClient", "Trigger", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// TriggerThenPoll performs Trigger then polls until it's completed -func (c ValidateOperationClient) TriggerThenPoll(ctx context.Context, id VaultId, input ValidateOperationRequestResource) error { - result, err := c.Trigger(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Trigger: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Trigger: %+v", err) - } - - return nil -} - -// preparerForTrigger prepares the Trigger request. -func (c ValidateOperationClient) preparerForTrigger(ctx context.Context, id VaultId, input ValidateOperationRequestResource) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/backupTriggerValidateOperation", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForTrigger sends the Trigger request. The method will close the -// http.Response Body if it receives an error. -func (c ValidateOperationClient) senderForTrigger(ctx context.Context, req *http.Request) (future TriggerOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - - future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) - return -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azurefilesharerestorerequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azurefilesharerestorerequest.go deleted file mode 100644 index f5b6c3551e2..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azurefilesharerestorerequest.go +++ /dev/null @@ -1,57 +0,0 @@ -package validateoperation - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ RestoreRequest = AzureFileShareRestoreRequest{} - -type AzureFileShareRestoreRequest struct { - CopyOptions *CopyOptions `json:"copyOptions,omitempty"` - RecoveryType *RecoveryType `json:"recoveryType,omitempty"` - RestoreFileSpecs *[]RestoreFileSpecs `json:"restoreFileSpecs,omitempty"` - RestoreRequestType *RestoreRequestType `json:"restoreRequestType,omitempty"` - SourceResourceId *string `json:"sourceResourceId,omitempty"` - TargetDetails *TargetAFSRestoreInfo `json:"targetDetails,omitempty"` - - // Fields inherited from RestoreRequest - - ObjectType string `json:"objectType"` - ResourceGuardOperationRequests *[]string `json:"resourceGuardOperationRequests,omitempty"` -} - -func (s AzureFileShareRestoreRequest) RestoreRequest() BaseRestoreRequestImpl { - return BaseRestoreRequestImpl{ - ObjectType: s.ObjectType, - ResourceGuardOperationRequests: s.ResourceGuardOperationRequests, - } -} - -var _ json.Marshaler = AzureFileShareRestoreRequest{} - -func (s AzureFileShareRestoreRequest) MarshalJSON() ([]byte, error) { - type wrapper AzureFileShareRestoreRequest - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AzureFileShareRestoreRequest: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AzureFileShareRestoreRequest: %+v", err) - } - - decoded["objectType"] = "AzureFileShareRestoreRequest" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AzureFileShareRestoreRequest: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadpointintimerestorerequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadpointintimerestorerequest.go deleted file mode 100644 index e495e96b4a5..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadpointintimerestorerequest.go +++ /dev/null @@ -1,61 +0,0 @@ -package validateoperation - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ RestoreRequest = AzureWorkloadPointInTimeRestoreRequest{} - -type AzureWorkloadPointInTimeRestoreRequest struct { - PointInTime *string `json:"pointInTime,omitempty"` - PropertyBag *map[string]string `json:"propertyBag,omitempty"` - RecoveryMode *RecoveryMode `json:"recoveryMode,omitempty"` - RecoveryType *RecoveryType `json:"recoveryType,omitempty"` - SnapshotRestoreParameters *SnapshotRestoreParameters `json:"snapshotRestoreParameters,omitempty"` - SourceResourceId *string `json:"sourceResourceId,omitempty"` - TargetInfo *TargetRestoreInfo `json:"targetInfo,omitempty"` - TargetResourceGroupName *string `json:"targetResourceGroupName,omitempty"` - TargetVirtualMachineId *string `json:"targetVirtualMachineId,omitempty"` - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails `json:"userAssignedManagedIdentityDetails,omitempty"` - - // Fields inherited from RestoreRequest - - ObjectType string `json:"objectType"` - ResourceGuardOperationRequests *[]string `json:"resourceGuardOperationRequests,omitempty"` -} - -func (s AzureWorkloadPointInTimeRestoreRequest) RestoreRequest() BaseRestoreRequestImpl { - return BaseRestoreRequestImpl{ - ObjectType: s.ObjectType, - ResourceGuardOperationRequests: s.ResourceGuardOperationRequests, - } -} - -var _ json.Marshaler = AzureWorkloadPointInTimeRestoreRequest{} - -func (s AzureWorkloadPointInTimeRestoreRequest) MarshalJSON() ([]byte, error) { - type wrapper AzureWorkloadPointInTimeRestoreRequest - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AzureWorkloadPointInTimeRestoreRequest: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AzureWorkloadPointInTimeRestoreRequest: %+v", err) - } - - decoded["objectType"] = "AzureWorkloadPointInTimeRestoreRequest" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AzureWorkloadPointInTimeRestoreRequest: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadrestorerequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadrestorerequest.go deleted file mode 100644 index d084e2d68e8..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadrestorerequest.go +++ /dev/null @@ -1,60 +0,0 @@ -package validateoperation - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ RestoreRequest = AzureWorkloadRestoreRequest{} - -type AzureWorkloadRestoreRequest struct { - PropertyBag *map[string]string `json:"propertyBag,omitempty"` - RecoveryMode *RecoveryMode `json:"recoveryMode,omitempty"` - RecoveryType *RecoveryType `json:"recoveryType,omitempty"` - SnapshotRestoreParameters *SnapshotRestoreParameters `json:"snapshotRestoreParameters,omitempty"` - SourceResourceId *string `json:"sourceResourceId,omitempty"` - TargetInfo *TargetRestoreInfo `json:"targetInfo,omitempty"` - TargetResourceGroupName *string `json:"targetResourceGroupName,omitempty"` - TargetVirtualMachineId *string `json:"targetVirtualMachineId,omitempty"` - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails `json:"userAssignedManagedIdentityDetails,omitempty"` - - // Fields inherited from RestoreRequest - - ObjectType string `json:"objectType"` - ResourceGuardOperationRequests *[]string `json:"resourceGuardOperationRequests,omitempty"` -} - -func (s AzureWorkloadRestoreRequest) RestoreRequest() BaseRestoreRequestImpl { - return BaseRestoreRequestImpl{ - ObjectType: s.ObjectType, - ResourceGuardOperationRequests: s.ResourceGuardOperationRequests, - } -} - -var _ json.Marshaler = AzureWorkloadRestoreRequest{} - -func (s AzureWorkloadRestoreRequest) MarshalJSON() ([]byte, error) { - type wrapper AzureWorkloadRestoreRequest - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AzureWorkloadRestoreRequest: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AzureWorkloadRestoreRequest: %+v", err) - } - - decoded["objectType"] = "AzureWorkloadRestoreRequest" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AzureWorkloadRestoreRequest: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsapasepointintimerestorerequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsapasepointintimerestorerequest.go deleted file mode 100644 index 71d5207b076..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsapasepointintimerestorerequest.go +++ /dev/null @@ -1,61 +0,0 @@ -package validateoperation - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ RestoreRequest = AzureWorkloadSAPAsePointInTimeRestoreRequest{} - -type AzureWorkloadSAPAsePointInTimeRestoreRequest struct { - PointInTime *string `json:"pointInTime,omitempty"` - PropertyBag *map[string]string `json:"propertyBag,omitempty"` - RecoveryMode *RecoveryMode `json:"recoveryMode,omitempty"` - RecoveryType *RecoveryType `json:"recoveryType,omitempty"` - SnapshotRestoreParameters *SnapshotRestoreParameters `json:"snapshotRestoreParameters,omitempty"` - SourceResourceId *string `json:"sourceResourceId,omitempty"` - TargetInfo *TargetRestoreInfo `json:"targetInfo,omitempty"` - TargetResourceGroupName *string `json:"targetResourceGroupName,omitempty"` - TargetVirtualMachineId *string `json:"targetVirtualMachineId,omitempty"` - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails `json:"userAssignedManagedIdentityDetails,omitempty"` - - // Fields inherited from RestoreRequest - - ObjectType string `json:"objectType"` - ResourceGuardOperationRequests *[]string `json:"resourceGuardOperationRequests,omitempty"` -} - -func (s AzureWorkloadSAPAsePointInTimeRestoreRequest) RestoreRequest() BaseRestoreRequestImpl { - return BaseRestoreRequestImpl{ - ObjectType: s.ObjectType, - ResourceGuardOperationRequests: s.ResourceGuardOperationRequests, - } -} - -var _ json.Marshaler = AzureWorkloadSAPAsePointInTimeRestoreRequest{} - -func (s AzureWorkloadSAPAsePointInTimeRestoreRequest) MarshalJSON() ([]byte, error) { - type wrapper AzureWorkloadSAPAsePointInTimeRestoreRequest - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AzureWorkloadSAPAsePointInTimeRestoreRequest: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AzureWorkloadSAPAsePointInTimeRestoreRequest: %+v", err) - } - - decoded["objectType"] = "AzureWorkloadSAPAsePointInTimeRestoreRequest" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AzureWorkloadSAPAsePointInTimeRestoreRequest: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsapaserestorerequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsapaserestorerequest.go deleted file mode 100644 index e8c456dc3b6..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsapaserestorerequest.go +++ /dev/null @@ -1,60 +0,0 @@ -package validateoperation - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ RestoreRequest = AzureWorkloadSAPAseRestoreRequest{} - -type AzureWorkloadSAPAseRestoreRequest struct { - PropertyBag *map[string]string `json:"propertyBag,omitempty"` - RecoveryMode *RecoveryMode `json:"recoveryMode,omitempty"` - RecoveryType *RecoveryType `json:"recoveryType,omitempty"` - SnapshotRestoreParameters *SnapshotRestoreParameters `json:"snapshotRestoreParameters,omitempty"` - SourceResourceId *string `json:"sourceResourceId,omitempty"` - TargetInfo *TargetRestoreInfo `json:"targetInfo,omitempty"` - TargetResourceGroupName *string `json:"targetResourceGroupName,omitempty"` - TargetVirtualMachineId *string `json:"targetVirtualMachineId,omitempty"` - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails `json:"userAssignedManagedIdentityDetails,omitempty"` - - // Fields inherited from RestoreRequest - - ObjectType string `json:"objectType"` - ResourceGuardOperationRequests *[]string `json:"resourceGuardOperationRequests,omitempty"` -} - -func (s AzureWorkloadSAPAseRestoreRequest) RestoreRequest() BaseRestoreRequestImpl { - return BaseRestoreRequestImpl{ - ObjectType: s.ObjectType, - ResourceGuardOperationRequests: s.ResourceGuardOperationRequests, - } -} - -var _ json.Marshaler = AzureWorkloadSAPAseRestoreRequest{} - -func (s AzureWorkloadSAPAseRestoreRequest) MarshalJSON() ([]byte, error) { - type wrapper AzureWorkloadSAPAseRestoreRequest - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AzureWorkloadSAPAseRestoreRequest: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AzureWorkloadSAPAseRestoreRequest: %+v", err) - } - - decoded["objectType"] = "AzureWorkloadSAPAseRestoreRequest" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AzureWorkloadSAPAseRestoreRequest: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsaphanapointintimerestorerequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsaphanapointintimerestorerequest.go deleted file mode 100644 index 431629e9037..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsaphanapointintimerestorerequest.go +++ /dev/null @@ -1,61 +0,0 @@ -package validateoperation - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ RestoreRequest = AzureWorkloadSAPHanaPointInTimeRestoreRequest{} - -type AzureWorkloadSAPHanaPointInTimeRestoreRequest struct { - PointInTime *string `json:"pointInTime,omitempty"` - PropertyBag *map[string]string `json:"propertyBag,omitempty"` - RecoveryMode *RecoveryMode `json:"recoveryMode,omitempty"` - RecoveryType *RecoveryType `json:"recoveryType,omitempty"` - SnapshotRestoreParameters *SnapshotRestoreParameters `json:"snapshotRestoreParameters,omitempty"` - SourceResourceId *string `json:"sourceResourceId,omitempty"` - TargetInfo *TargetRestoreInfo `json:"targetInfo,omitempty"` - TargetResourceGroupName *string `json:"targetResourceGroupName,omitempty"` - TargetVirtualMachineId *string `json:"targetVirtualMachineId,omitempty"` - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails `json:"userAssignedManagedIdentityDetails,omitempty"` - - // Fields inherited from RestoreRequest - - ObjectType string `json:"objectType"` - ResourceGuardOperationRequests *[]string `json:"resourceGuardOperationRequests,omitempty"` -} - -func (s AzureWorkloadSAPHanaPointInTimeRestoreRequest) RestoreRequest() BaseRestoreRequestImpl { - return BaseRestoreRequestImpl{ - ObjectType: s.ObjectType, - ResourceGuardOperationRequests: s.ResourceGuardOperationRequests, - } -} - -var _ json.Marshaler = AzureWorkloadSAPHanaPointInTimeRestoreRequest{} - -func (s AzureWorkloadSAPHanaPointInTimeRestoreRequest) MarshalJSON() ([]byte, error) { - type wrapper AzureWorkloadSAPHanaPointInTimeRestoreRequest - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AzureWorkloadSAPHanaPointInTimeRestoreRequest: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AzureWorkloadSAPHanaPointInTimeRestoreRequest: %+v", err) - } - - decoded["objectType"] = "AzureWorkloadSAPHanaPointInTimeRestoreRequest" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AzureWorkloadSAPHanaPointInTimeRestoreRequest: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsaphanapointintimerestorewithrehydraterequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsaphanapointintimerestorewithrehydraterequest.go deleted file mode 100644 index fc703d110d4..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsaphanapointintimerestorewithrehydraterequest.go +++ /dev/null @@ -1,62 +0,0 @@ -package validateoperation - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ RestoreRequest = AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest{} - -type AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest struct { - PointInTime *string `json:"pointInTime,omitempty"` - PropertyBag *map[string]string `json:"propertyBag,omitempty"` - RecoveryMode *RecoveryMode `json:"recoveryMode,omitempty"` - RecoveryPointRehydrationInfo *RecoveryPointRehydrationInfo `json:"recoveryPointRehydrationInfo,omitempty"` - RecoveryType *RecoveryType `json:"recoveryType,omitempty"` - SnapshotRestoreParameters *SnapshotRestoreParameters `json:"snapshotRestoreParameters,omitempty"` - SourceResourceId *string `json:"sourceResourceId,omitempty"` - TargetInfo *TargetRestoreInfo `json:"targetInfo,omitempty"` - TargetResourceGroupName *string `json:"targetResourceGroupName,omitempty"` - TargetVirtualMachineId *string `json:"targetVirtualMachineId,omitempty"` - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails `json:"userAssignedManagedIdentityDetails,omitempty"` - - // Fields inherited from RestoreRequest - - ObjectType string `json:"objectType"` - ResourceGuardOperationRequests *[]string `json:"resourceGuardOperationRequests,omitempty"` -} - -func (s AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest) RestoreRequest() BaseRestoreRequestImpl { - return BaseRestoreRequestImpl{ - ObjectType: s.ObjectType, - ResourceGuardOperationRequests: s.ResourceGuardOperationRequests, - } -} - -var _ json.Marshaler = AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest{} - -func (s AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest) MarshalJSON() ([]byte, error) { - type wrapper AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest: %+v", err) - } - - decoded["objectType"] = "AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsaphanarestorerequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsaphanarestorerequest.go deleted file mode 100644 index 9a04045edc5..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsaphanarestorerequest.go +++ /dev/null @@ -1,60 +0,0 @@ -package validateoperation - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ RestoreRequest = AzureWorkloadSAPHanaRestoreRequest{} - -type AzureWorkloadSAPHanaRestoreRequest struct { - PropertyBag *map[string]string `json:"propertyBag,omitempty"` - RecoveryMode *RecoveryMode `json:"recoveryMode,omitempty"` - RecoveryType *RecoveryType `json:"recoveryType,omitempty"` - SnapshotRestoreParameters *SnapshotRestoreParameters `json:"snapshotRestoreParameters,omitempty"` - SourceResourceId *string `json:"sourceResourceId,omitempty"` - TargetInfo *TargetRestoreInfo `json:"targetInfo,omitempty"` - TargetResourceGroupName *string `json:"targetResourceGroupName,omitempty"` - TargetVirtualMachineId *string `json:"targetVirtualMachineId,omitempty"` - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails `json:"userAssignedManagedIdentityDetails,omitempty"` - - // Fields inherited from RestoreRequest - - ObjectType string `json:"objectType"` - ResourceGuardOperationRequests *[]string `json:"resourceGuardOperationRequests,omitempty"` -} - -func (s AzureWorkloadSAPHanaRestoreRequest) RestoreRequest() BaseRestoreRequestImpl { - return BaseRestoreRequestImpl{ - ObjectType: s.ObjectType, - ResourceGuardOperationRequests: s.ResourceGuardOperationRequests, - } -} - -var _ json.Marshaler = AzureWorkloadSAPHanaRestoreRequest{} - -func (s AzureWorkloadSAPHanaRestoreRequest) MarshalJSON() ([]byte, error) { - type wrapper AzureWorkloadSAPHanaRestoreRequest - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AzureWorkloadSAPHanaRestoreRequest: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AzureWorkloadSAPHanaRestoreRequest: %+v", err) - } - - decoded["objectType"] = "AzureWorkloadSAPHanaRestoreRequest" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AzureWorkloadSAPHanaRestoreRequest: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsaphanarestorewithrehydraterequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsaphanarestorewithrehydraterequest.go deleted file mode 100644 index 07a81c26bcd..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsaphanarestorewithrehydraterequest.go +++ /dev/null @@ -1,61 +0,0 @@ -package validateoperation - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ RestoreRequest = AzureWorkloadSAPHanaRestoreWithRehydrateRequest{} - -type AzureWorkloadSAPHanaRestoreWithRehydrateRequest struct { - PropertyBag *map[string]string `json:"propertyBag,omitempty"` - RecoveryMode *RecoveryMode `json:"recoveryMode,omitempty"` - RecoveryPointRehydrationInfo *RecoveryPointRehydrationInfo `json:"recoveryPointRehydrationInfo,omitempty"` - RecoveryType *RecoveryType `json:"recoveryType,omitempty"` - SnapshotRestoreParameters *SnapshotRestoreParameters `json:"snapshotRestoreParameters,omitempty"` - SourceResourceId *string `json:"sourceResourceId,omitempty"` - TargetInfo *TargetRestoreInfo `json:"targetInfo,omitempty"` - TargetResourceGroupName *string `json:"targetResourceGroupName,omitempty"` - TargetVirtualMachineId *string `json:"targetVirtualMachineId,omitempty"` - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails `json:"userAssignedManagedIdentityDetails,omitempty"` - - // Fields inherited from RestoreRequest - - ObjectType string `json:"objectType"` - ResourceGuardOperationRequests *[]string `json:"resourceGuardOperationRequests,omitempty"` -} - -func (s AzureWorkloadSAPHanaRestoreWithRehydrateRequest) RestoreRequest() BaseRestoreRequestImpl { - return BaseRestoreRequestImpl{ - ObjectType: s.ObjectType, - ResourceGuardOperationRequests: s.ResourceGuardOperationRequests, - } -} - -var _ json.Marshaler = AzureWorkloadSAPHanaRestoreWithRehydrateRequest{} - -func (s AzureWorkloadSAPHanaRestoreWithRehydrateRequest) MarshalJSON() ([]byte, error) { - type wrapper AzureWorkloadSAPHanaRestoreWithRehydrateRequest - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AzureWorkloadSAPHanaRestoreWithRehydrateRequest: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AzureWorkloadSAPHanaRestoreWithRehydrateRequest: %+v", err) - } - - decoded["objectType"] = "AzureWorkloadSAPHanaRestoreWithRehydrateRequest" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AzureWorkloadSAPHanaRestoreWithRehydrateRequest: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsqlpointintimerestorerequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsqlpointintimerestorerequest.go deleted file mode 100644 index 5aa091ec43e..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsqlpointintimerestorerequest.go +++ /dev/null @@ -1,64 +0,0 @@ -package validateoperation - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ RestoreRequest = AzureWorkloadSQLPointInTimeRestoreRequest{} - -type AzureWorkloadSQLPointInTimeRestoreRequest struct { - AlternateDirectoryPaths *[]SQLDataDirectoryMapping `json:"alternateDirectoryPaths,omitempty"` - IsNonRecoverable *bool `json:"isNonRecoverable,omitempty"` - PointInTime *string `json:"pointInTime,omitempty"` - PropertyBag *map[string]string `json:"propertyBag,omitempty"` - RecoveryMode *RecoveryMode `json:"recoveryMode,omitempty"` - RecoveryType *RecoveryType `json:"recoveryType,omitempty"` - ShouldUseAlternateTargetLocation *bool `json:"shouldUseAlternateTargetLocation,omitempty"` - SnapshotRestoreParameters *SnapshotRestoreParameters `json:"snapshotRestoreParameters,omitempty"` - SourceResourceId *string `json:"sourceResourceId,omitempty"` - TargetInfo *TargetRestoreInfo `json:"targetInfo,omitempty"` - TargetResourceGroupName *string `json:"targetResourceGroupName,omitempty"` - TargetVirtualMachineId *string `json:"targetVirtualMachineId,omitempty"` - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails `json:"userAssignedManagedIdentityDetails,omitempty"` - - // Fields inherited from RestoreRequest - - ObjectType string `json:"objectType"` - ResourceGuardOperationRequests *[]string `json:"resourceGuardOperationRequests,omitempty"` -} - -func (s AzureWorkloadSQLPointInTimeRestoreRequest) RestoreRequest() BaseRestoreRequestImpl { - return BaseRestoreRequestImpl{ - ObjectType: s.ObjectType, - ResourceGuardOperationRequests: s.ResourceGuardOperationRequests, - } -} - -var _ json.Marshaler = AzureWorkloadSQLPointInTimeRestoreRequest{} - -func (s AzureWorkloadSQLPointInTimeRestoreRequest) MarshalJSON() ([]byte, error) { - type wrapper AzureWorkloadSQLPointInTimeRestoreRequest - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AzureWorkloadSQLPointInTimeRestoreRequest: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AzureWorkloadSQLPointInTimeRestoreRequest: %+v", err) - } - - decoded["objectType"] = "AzureWorkloadSQLPointInTimeRestoreRequest" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AzureWorkloadSQLPointInTimeRestoreRequest: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsqlpointintimerestorewithrehydraterequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsqlpointintimerestorewithrehydraterequest.go deleted file mode 100644 index cf33c6bd871..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsqlpointintimerestorewithrehydraterequest.go +++ /dev/null @@ -1,65 +0,0 @@ -package validateoperation - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ RestoreRequest = AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest{} - -type AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest struct { - AlternateDirectoryPaths *[]SQLDataDirectoryMapping `json:"alternateDirectoryPaths,omitempty"` - IsNonRecoverable *bool `json:"isNonRecoverable,omitempty"` - PointInTime *string `json:"pointInTime,omitempty"` - PropertyBag *map[string]string `json:"propertyBag,omitempty"` - RecoveryMode *RecoveryMode `json:"recoveryMode,omitempty"` - RecoveryPointRehydrationInfo *RecoveryPointRehydrationInfo `json:"recoveryPointRehydrationInfo,omitempty"` - RecoveryType *RecoveryType `json:"recoveryType,omitempty"` - ShouldUseAlternateTargetLocation *bool `json:"shouldUseAlternateTargetLocation,omitempty"` - SnapshotRestoreParameters *SnapshotRestoreParameters `json:"snapshotRestoreParameters,omitempty"` - SourceResourceId *string `json:"sourceResourceId,omitempty"` - TargetInfo *TargetRestoreInfo `json:"targetInfo,omitempty"` - TargetResourceGroupName *string `json:"targetResourceGroupName,omitempty"` - TargetVirtualMachineId *string `json:"targetVirtualMachineId,omitempty"` - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails `json:"userAssignedManagedIdentityDetails,omitempty"` - - // Fields inherited from RestoreRequest - - ObjectType string `json:"objectType"` - ResourceGuardOperationRequests *[]string `json:"resourceGuardOperationRequests,omitempty"` -} - -func (s AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest) RestoreRequest() BaseRestoreRequestImpl { - return BaseRestoreRequestImpl{ - ObjectType: s.ObjectType, - ResourceGuardOperationRequests: s.ResourceGuardOperationRequests, - } -} - -var _ json.Marshaler = AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest{} - -func (s AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest) MarshalJSON() ([]byte, error) { - type wrapper AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest: %+v", err) - } - - decoded["objectType"] = "AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsqlrestorerequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsqlrestorerequest.go deleted file mode 100644 index abd5baf76e0..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsqlrestorerequest.go +++ /dev/null @@ -1,63 +0,0 @@ -package validateoperation - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ RestoreRequest = AzureWorkloadSQLRestoreRequest{} - -type AzureWorkloadSQLRestoreRequest struct { - AlternateDirectoryPaths *[]SQLDataDirectoryMapping `json:"alternateDirectoryPaths,omitempty"` - IsNonRecoverable *bool `json:"isNonRecoverable,omitempty"` - PropertyBag *map[string]string `json:"propertyBag,omitempty"` - RecoveryMode *RecoveryMode `json:"recoveryMode,omitempty"` - RecoveryType *RecoveryType `json:"recoveryType,omitempty"` - ShouldUseAlternateTargetLocation *bool `json:"shouldUseAlternateTargetLocation,omitempty"` - SnapshotRestoreParameters *SnapshotRestoreParameters `json:"snapshotRestoreParameters,omitempty"` - SourceResourceId *string `json:"sourceResourceId,omitempty"` - TargetInfo *TargetRestoreInfo `json:"targetInfo,omitempty"` - TargetResourceGroupName *string `json:"targetResourceGroupName,omitempty"` - TargetVirtualMachineId *string `json:"targetVirtualMachineId,omitempty"` - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails `json:"userAssignedManagedIdentityDetails,omitempty"` - - // Fields inherited from RestoreRequest - - ObjectType string `json:"objectType"` - ResourceGuardOperationRequests *[]string `json:"resourceGuardOperationRequests,omitempty"` -} - -func (s AzureWorkloadSQLRestoreRequest) RestoreRequest() BaseRestoreRequestImpl { - return BaseRestoreRequestImpl{ - ObjectType: s.ObjectType, - ResourceGuardOperationRequests: s.ResourceGuardOperationRequests, - } -} - -var _ json.Marshaler = AzureWorkloadSQLRestoreRequest{} - -func (s AzureWorkloadSQLRestoreRequest) MarshalJSON() ([]byte, error) { - type wrapper AzureWorkloadSQLRestoreRequest - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AzureWorkloadSQLRestoreRequest: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AzureWorkloadSQLRestoreRequest: %+v", err) - } - - decoded["objectType"] = "AzureWorkloadSQLRestoreRequest" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AzureWorkloadSQLRestoreRequest: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsqlrestorewithrehydraterequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsqlrestorewithrehydraterequest.go deleted file mode 100644 index 9624c1d0c0f..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_azureworkloadsqlrestorewithrehydraterequest.go +++ /dev/null @@ -1,64 +0,0 @@ -package validateoperation - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ RestoreRequest = AzureWorkloadSQLRestoreWithRehydrateRequest{} - -type AzureWorkloadSQLRestoreWithRehydrateRequest struct { - AlternateDirectoryPaths *[]SQLDataDirectoryMapping `json:"alternateDirectoryPaths,omitempty"` - IsNonRecoverable *bool `json:"isNonRecoverable,omitempty"` - PropertyBag *map[string]string `json:"propertyBag,omitempty"` - RecoveryMode *RecoveryMode `json:"recoveryMode,omitempty"` - RecoveryPointRehydrationInfo *RecoveryPointRehydrationInfo `json:"recoveryPointRehydrationInfo,omitempty"` - RecoveryType *RecoveryType `json:"recoveryType,omitempty"` - ShouldUseAlternateTargetLocation *bool `json:"shouldUseAlternateTargetLocation,omitempty"` - SnapshotRestoreParameters *SnapshotRestoreParameters `json:"snapshotRestoreParameters,omitempty"` - SourceResourceId *string `json:"sourceResourceId,omitempty"` - TargetInfo *TargetRestoreInfo `json:"targetInfo,omitempty"` - TargetResourceGroupName *string `json:"targetResourceGroupName,omitempty"` - TargetVirtualMachineId *string `json:"targetVirtualMachineId,omitempty"` - UserAssignedManagedIdentityDetails *UserAssignedManagedIdentityDetails `json:"userAssignedManagedIdentityDetails,omitempty"` - - // Fields inherited from RestoreRequest - - ObjectType string `json:"objectType"` - ResourceGuardOperationRequests *[]string `json:"resourceGuardOperationRequests,omitempty"` -} - -func (s AzureWorkloadSQLRestoreWithRehydrateRequest) RestoreRequest() BaseRestoreRequestImpl { - return BaseRestoreRequestImpl{ - ObjectType: s.ObjectType, - ResourceGuardOperationRequests: s.ResourceGuardOperationRequests, - } -} - -var _ json.Marshaler = AzureWorkloadSQLRestoreWithRehydrateRequest{} - -func (s AzureWorkloadSQLRestoreWithRehydrateRequest) MarshalJSON() ([]byte, error) { - type wrapper AzureWorkloadSQLRestoreWithRehydrateRequest - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling AzureWorkloadSQLRestoreWithRehydrateRequest: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling AzureWorkloadSQLRestoreWithRehydrateRequest: %+v", err) - } - - decoded["objectType"] = "AzureWorkloadSQLRestoreWithRehydrateRequest" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling AzureWorkloadSQLRestoreWithRehydrateRequest: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_encryptiondetails.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_encryptiondetails.go deleted file mode 100644 index d2830fa3e2f..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_encryptiondetails.go +++ /dev/null @@ -1,12 +0,0 @@ -package validateoperation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EncryptionDetails struct { - EncryptionEnabled *bool `json:"encryptionEnabled,omitempty"` - KekURL *string `json:"kekUrl,omitempty"` - KekVaultId *string `json:"kekVaultId,omitempty"` - SecretKeyURL *string `json:"secretKeyUrl,omitempty"` - SecretKeyVaultId *string `json:"secretKeyVaultId,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_iaasvmrestorerequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_iaasvmrestorerequest.go deleted file mode 100644 index 81d88980dc3..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_iaasvmrestorerequest.go +++ /dev/null @@ -1,76 +0,0 @@ -package validateoperation - -import ( - "encoding/json" - "fmt" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ RestoreRequest = IaasVMRestoreRequest{} - -type IaasVMRestoreRequest struct { - AffinityGroup *string `json:"affinityGroup,omitempty"` - CreateNewCloudService *bool `json:"createNewCloudService,omitempty"` - DiskEncryptionSetId *string `json:"diskEncryptionSetId,omitempty"` - EncryptionDetails *EncryptionDetails `json:"encryptionDetails,omitempty"` - ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` - IdentityBasedRestoreDetails *IdentityBasedRestoreDetails `json:"identityBasedRestoreDetails,omitempty"` - IdentityInfo *IdentityInfo `json:"identityInfo,omitempty"` - OriginalStorageAccountOption *bool `json:"originalStorageAccountOption,omitempty"` - RecoveryPointId *string `json:"recoveryPointId,omitempty"` - RecoveryType *RecoveryType `json:"recoveryType,omitempty"` - Region *string `json:"region,omitempty"` - RestoreDiskLunList *[]int64 `json:"restoreDiskLunList,omitempty"` - RestoreWithManagedDisks *bool `json:"restoreWithManagedDisks,omitempty"` - SecuredVMDetails *SecuredVMDetails `json:"securedVMDetails,omitempty"` - SourceResourceId *string `json:"sourceResourceId,omitempty"` - StorageAccountId *string `json:"storageAccountId,omitempty"` - SubnetId *string `json:"subnetId,omitempty"` - TargetDiskNetworkAccessSettings *TargetDiskNetworkAccessSettings `json:"targetDiskNetworkAccessSettings,omitempty"` - TargetDomainNameId *string `json:"targetDomainNameId,omitempty"` - TargetResourceGroupId *string `json:"targetResourceGroupId,omitempty"` - TargetVirtualMachineId *string `json:"targetVirtualMachineId,omitempty"` - VirtualNetworkId *string `json:"virtualNetworkId,omitempty"` - Zones *zones.Schema `json:"zones,omitempty"` - - // Fields inherited from RestoreRequest - - ObjectType string `json:"objectType"` - ResourceGuardOperationRequests *[]string `json:"resourceGuardOperationRequests,omitempty"` -} - -func (s IaasVMRestoreRequest) RestoreRequest() BaseRestoreRequestImpl { - return BaseRestoreRequestImpl{ - ObjectType: s.ObjectType, - ResourceGuardOperationRequests: s.ResourceGuardOperationRequests, - } -} - -var _ json.Marshaler = IaasVMRestoreRequest{} - -func (s IaasVMRestoreRequest) MarshalJSON() ([]byte, error) { - type wrapper IaasVMRestoreRequest - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling IaasVMRestoreRequest: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling IaasVMRestoreRequest: %+v", err) - } - - decoded["objectType"] = "IaasVMRestoreRequest" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling IaasVMRestoreRequest: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_iaasvmrestorewithrehydrationrequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_iaasvmrestorewithrehydrationrequest.go deleted file mode 100644 index b5fff836253..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_iaasvmrestorewithrehydrationrequest.go +++ /dev/null @@ -1,77 +0,0 @@ -package validateoperation - -import ( - "encoding/json" - "fmt" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ RestoreRequest = IaasVMRestoreWithRehydrationRequest{} - -type IaasVMRestoreWithRehydrationRequest struct { - AffinityGroup *string `json:"affinityGroup,omitempty"` - CreateNewCloudService *bool `json:"createNewCloudService,omitempty"` - DiskEncryptionSetId *string `json:"diskEncryptionSetId,omitempty"` - EncryptionDetails *EncryptionDetails `json:"encryptionDetails,omitempty"` - ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` - IdentityBasedRestoreDetails *IdentityBasedRestoreDetails `json:"identityBasedRestoreDetails,omitempty"` - IdentityInfo *IdentityInfo `json:"identityInfo,omitempty"` - OriginalStorageAccountOption *bool `json:"originalStorageAccountOption,omitempty"` - RecoveryPointId *string `json:"recoveryPointId,omitempty"` - RecoveryPointRehydrationInfo *RecoveryPointRehydrationInfo `json:"recoveryPointRehydrationInfo,omitempty"` - RecoveryType *RecoveryType `json:"recoveryType,omitempty"` - Region *string `json:"region,omitempty"` - RestoreDiskLunList *[]int64 `json:"restoreDiskLunList,omitempty"` - RestoreWithManagedDisks *bool `json:"restoreWithManagedDisks,omitempty"` - SecuredVMDetails *SecuredVMDetails `json:"securedVMDetails,omitempty"` - SourceResourceId *string `json:"sourceResourceId,omitempty"` - StorageAccountId *string `json:"storageAccountId,omitempty"` - SubnetId *string `json:"subnetId,omitempty"` - TargetDiskNetworkAccessSettings *TargetDiskNetworkAccessSettings `json:"targetDiskNetworkAccessSettings,omitempty"` - TargetDomainNameId *string `json:"targetDomainNameId,omitempty"` - TargetResourceGroupId *string `json:"targetResourceGroupId,omitempty"` - TargetVirtualMachineId *string `json:"targetVirtualMachineId,omitempty"` - VirtualNetworkId *string `json:"virtualNetworkId,omitempty"` - Zones *zones.Schema `json:"zones,omitempty"` - - // Fields inherited from RestoreRequest - - ObjectType string `json:"objectType"` - ResourceGuardOperationRequests *[]string `json:"resourceGuardOperationRequests,omitempty"` -} - -func (s IaasVMRestoreWithRehydrationRequest) RestoreRequest() BaseRestoreRequestImpl { - return BaseRestoreRequestImpl{ - ObjectType: s.ObjectType, - ResourceGuardOperationRequests: s.ResourceGuardOperationRequests, - } -} - -var _ json.Marshaler = IaasVMRestoreWithRehydrationRequest{} - -func (s IaasVMRestoreWithRehydrationRequest) MarshalJSON() ([]byte, error) { - type wrapper IaasVMRestoreWithRehydrationRequest - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling IaasVMRestoreWithRehydrationRequest: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling IaasVMRestoreWithRehydrationRequest: %+v", err) - } - - decoded["objectType"] = "IaasVMRestoreWithRehydrationRequest" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling IaasVMRestoreWithRehydrationRequest: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_identitybasedrestoredetails.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_identitybasedrestoredetails.go deleted file mode 100644 index d804db396e3..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_identitybasedrestoredetails.go +++ /dev/null @@ -1,9 +0,0 @@ -package validateoperation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type IdentityBasedRestoreDetails struct { - ObjectType *string `json:"objectType,omitempty"` - TargetStorageAccountId *string `json:"targetStorageAccountId,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_identityinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_identityinfo.go deleted file mode 100644 index 71e633fc3ea..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_identityinfo.go +++ /dev/null @@ -1,9 +0,0 @@ -package validateoperation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type IdentityInfo struct { - IsSystemAssignedIdentity *bool `json:"isSystemAssignedIdentity,omitempty"` - ManagedIdentityResourceId *string `json:"managedIdentityResourceId,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_recoverypointrehydrationinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_recoverypointrehydrationinfo.go deleted file mode 100644 index 9f5b85e6ad0..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_recoverypointrehydrationinfo.go +++ /dev/null @@ -1,9 +0,0 @@ -package validateoperation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RecoveryPointRehydrationInfo struct { - RehydrationPriority *RehydrationPriority `json:"rehydrationPriority,omitempty"` - RehydrationRetentionDuration *string `json:"rehydrationRetentionDuration,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_restorefilespecs.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_restorefilespecs.go deleted file mode 100644 index f850cae1f62..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_restorefilespecs.go +++ /dev/null @@ -1,10 +0,0 @@ -package validateoperation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RestoreFileSpecs struct { - FileSpecType *string `json:"fileSpecType,omitempty"` - Path *string `json:"path,omitempty"` - TargetFolderPath *string `json:"targetFolderPath,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_restorerequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_restorerequest.go deleted file mode 100644 index 313df00313c..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_restorerequest.go +++ /dev/null @@ -1,188 +0,0 @@ -package validateoperation - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RestoreRequest interface { - RestoreRequest() BaseRestoreRequestImpl -} - -var _ RestoreRequest = BaseRestoreRequestImpl{} - -type BaseRestoreRequestImpl struct { - ObjectType string `json:"objectType"` - ResourceGuardOperationRequests *[]string `json:"resourceGuardOperationRequests,omitempty"` -} - -func (s BaseRestoreRequestImpl) RestoreRequest() BaseRestoreRequestImpl { - return s -} - -var _ RestoreRequest = RawRestoreRequestImpl{} - -// RawRestoreRequestImpl is returned when the Discriminated Value doesn't match any of the defined types -// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) -// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). -type RawRestoreRequestImpl struct { - restoreRequest BaseRestoreRequestImpl - Type string - Values map[string]interface{} -} - -func (s RawRestoreRequestImpl) RestoreRequest() BaseRestoreRequestImpl { - return s.restoreRequest -} - -func UnmarshalRestoreRequestImplementation(input []byte) (RestoreRequest, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling RestoreRequest into map[string]interface: %+v", err) - } - - var value string - if v, ok := temp["objectType"]; ok { - value = fmt.Sprintf("%v", v) - } - - if strings.EqualFold(value, "AzureFileShareRestoreRequest") { - var out AzureFileShareRestoreRequest - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AzureFileShareRestoreRequest: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "AzureWorkloadPointInTimeRestoreRequest") { - var out AzureWorkloadPointInTimeRestoreRequest - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AzureWorkloadPointInTimeRestoreRequest: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "AzureWorkloadRestoreRequest") { - var out AzureWorkloadRestoreRequest - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AzureWorkloadRestoreRequest: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "AzureWorkloadSAPAsePointInTimeRestoreRequest") { - var out AzureWorkloadSAPAsePointInTimeRestoreRequest - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AzureWorkloadSAPAsePointInTimeRestoreRequest: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "AzureWorkloadSAPAseRestoreRequest") { - var out AzureWorkloadSAPAseRestoreRequest - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AzureWorkloadSAPAseRestoreRequest: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "AzureWorkloadSAPHanaPointInTimeRestoreRequest") { - var out AzureWorkloadSAPHanaPointInTimeRestoreRequest - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AzureWorkloadSAPHanaPointInTimeRestoreRequest: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest") { - var out AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "AzureWorkloadSAPHanaRestoreRequest") { - var out AzureWorkloadSAPHanaRestoreRequest - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AzureWorkloadSAPHanaRestoreRequest: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "AzureWorkloadSAPHanaRestoreWithRehydrateRequest") { - var out AzureWorkloadSAPHanaRestoreWithRehydrateRequest - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AzureWorkloadSAPHanaRestoreWithRehydrateRequest: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "AzureWorkloadSQLPointInTimeRestoreRequest") { - var out AzureWorkloadSQLPointInTimeRestoreRequest - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AzureWorkloadSQLPointInTimeRestoreRequest: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest") { - var out AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "AzureWorkloadSQLRestoreRequest") { - var out AzureWorkloadSQLRestoreRequest - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AzureWorkloadSQLRestoreRequest: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "AzureWorkloadSQLRestoreWithRehydrateRequest") { - var out AzureWorkloadSQLRestoreWithRehydrateRequest - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into AzureWorkloadSQLRestoreWithRehydrateRequest: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "IaasVMRestoreRequest") { - var out IaasVMRestoreRequest - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into IaasVMRestoreRequest: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "IaasVMRestoreWithRehydrationRequest") { - var out IaasVMRestoreWithRehydrationRequest - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into IaasVMRestoreWithRehydrationRequest: %+v", err) - } - return out, nil - } - - var parent BaseRestoreRequestImpl - if err := json.Unmarshal(input, &parent); err != nil { - return nil, fmt.Errorf("unmarshaling into BaseRestoreRequestImpl: %+v", err) - } - - return RawRestoreRequestImpl{ - restoreRequest: parent, - Type: value, - Values: temp, - }, nil - -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_securedvmdetails.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_securedvmdetails.go deleted file mode 100644 index d6bbd38ddcc..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_securedvmdetails.go +++ /dev/null @@ -1,8 +0,0 @@ -package validateoperation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SecuredVMDetails struct { - SecuredVMOsDiskEncryptionSetId *string `json:"securedVMOsDiskEncryptionSetId,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_snapshotrestoreparameters.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_snapshotrestoreparameters.go deleted file mode 100644 index f9a96fc887b..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_snapshotrestoreparameters.go +++ /dev/null @@ -1,9 +0,0 @@ -package validateoperation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotRestoreParameters struct { - LogPointInTimeForDBRecovery *string `json:"logPointInTimeForDBRecovery,omitempty"` - SkipAttachAndMount *bool `json:"skipAttachAndMount,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_sqldatadirectorymapping.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_sqldatadirectorymapping.go deleted file mode 100644 index 3d7ad759e25..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_sqldatadirectorymapping.go +++ /dev/null @@ -1,11 +0,0 @@ -package validateoperation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SQLDataDirectoryMapping struct { - MappingType *SQLDataDirectoryType `json:"mappingType,omitempty"` - SourceLogicalName *string `json:"sourceLogicalName,omitempty"` - SourcePath *string `json:"sourcePath,omitempty"` - TargetPath *string `json:"targetPath,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_targetafsrestoreinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_targetafsrestoreinfo.go deleted file mode 100644 index 32d155ab051..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_targetafsrestoreinfo.go +++ /dev/null @@ -1,9 +0,0 @@ -package validateoperation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TargetAFSRestoreInfo struct { - Name *string `json:"name,omitempty"` - TargetResourceId *string `json:"targetResourceId,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_targetdisknetworkaccesssettings.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_targetdisknetworkaccesssettings.go deleted file mode 100644 index 9185ea14d0c..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_targetdisknetworkaccesssettings.go +++ /dev/null @@ -1,9 +0,0 @@ -package validateoperation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TargetDiskNetworkAccessSettings struct { - TargetDiskAccessId *string `json:"targetDiskAccessId,omitempty"` - TargetDiskNetworkAccessOption *TargetDiskNetworkAccessOption `json:"targetDiskNetworkAccessOption,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_targetrestoreinfo.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_targetrestoreinfo.go deleted file mode 100644 index 03ec88a3e93..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_targetrestoreinfo.go +++ /dev/null @@ -1,11 +0,0 @@ -package validateoperation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TargetRestoreInfo struct { - ContainerId *string `json:"containerId,omitempty"` - DatabaseName *string `json:"databaseName,omitempty"` - OverwriteOption *OverwriteOptions `json:"overwriteOption,omitempty"` - TargetDirectoryForFileRestore *string `json:"targetDirectoryForFileRestore,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_userassignedidentityproperties.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_userassignedidentityproperties.go deleted file mode 100644 index 572eae60d18..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_userassignedidentityproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -package validateoperation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UserAssignedIdentityProperties struct { - ClientId *string `json:"clientId,omitempty"` - PrincipalId *string `json:"principalId,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_userassignedmanagedidentitydetails.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_userassignedmanagedidentitydetails.go deleted file mode 100644 index b8d3bbe00a1..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_userassignedmanagedidentitydetails.go +++ /dev/null @@ -1,10 +0,0 @@ -package validateoperation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UserAssignedManagedIdentityDetails struct { - IdentityArmId *string `json:"identityArmId,omitempty"` - IdentityName *string `json:"identityName,omitempty"` - UserAssignedIdentityProperties *UserAssignedIdentityProperties `json:"userAssignedIdentityProperties,omitempty"` -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_validateiaasvmrestoreoperationrequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_validateiaasvmrestoreoperationrequest.go deleted file mode 100644 index 9aad5503fcb..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_validateiaasvmrestoreoperationrequest.go +++ /dev/null @@ -1,78 +0,0 @@ -package validateoperation - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ValidateOperationRequest = ValidateIaasVMRestoreOperationRequest{} - -type ValidateIaasVMRestoreOperationRequest struct { - RestoreRequest RestoreRequest `json:"restoreRequest"` - - // Fields inherited from ValidateOperationRequest - - ObjectType string `json:"objectType"` -} - -func (s ValidateIaasVMRestoreOperationRequest) ValidateOperationRequest() BaseValidateOperationRequestImpl { - return BaseValidateOperationRequestImpl{ - ObjectType: s.ObjectType, - } -} - -var _ json.Marshaler = ValidateIaasVMRestoreOperationRequest{} - -func (s ValidateIaasVMRestoreOperationRequest) MarshalJSON() ([]byte, error) { - type wrapper ValidateIaasVMRestoreOperationRequest - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling ValidateIaasVMRestoreOperationRequest: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling ValidateIaasVMRestoreOperationRequest: %+v", err) - } - - decoded["objectType"] = "ValidateIaasVMRestoreOperationRequest" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling ValidateIaasVMRestoreOperationRequest: %+v", err) - } - - return encoded, nil -} - -var _ json.Unmarshaler = &ValidateIaasVMRestoreOperationRequest{} - -func (s *ValidateIaasVMRestoreOperationRequest) UnmarshalJSON(bytes []byte) error { - var decoded struct { - ObjectType string `json:"objectType"` - } - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - - s.ObjectType = decoded.ObjectType - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling ValidateIaasVMRestoreOperationRequest into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["restoreRequest"]; ok { - impl, err := UnmarshalRestoreRequestImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'RestoreRequest' for 'ValidateIaasVMRestoreOperationRequest': %+v", err) - } - s.RestoreRequest = impl - } - - return nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_validateoperationrequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_validateoperationrequest.go deleted file mode 100644 index 76b3eab7f02..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_validateoperationrequest.go +++ /dev/null @@ -1,83 +0,0 @@ -package validateoperation - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ValidateOperationRequest interface { - ValidateOperationRequest() BaseValidateOperationRequestImpl -} - -var _ ValidateOperationRequest = BaseValidateOperationRequestImpl{} - -type BaseValidateOperationRequestImpl struct { - ObjectType string `json:"objectType"` -} - -func (s BaseValidateOperationRequestImpl) ValidateOperationRequest() BaseValidateOperationRequestImpl { - return s -} - -var _ ValidateOperationRequest = RawValidateOperationRequestImpl{} - -// RawValidateOperationRequestImpl is returned when the Discriminated Value doesn't match any of the defined types -// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) -// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). -type RawValidateOperationRequestImpl struct { - validateOperationRequest BaseValidateOperationRequestImpl - Type string - Values map[string]interface{} -} - -func (s RawValidateOperationRequestImpl) ValidateOperationRequest() BaseValidateOperationRequestImpl { - return s.validateOperationRequest -} - -func UnmarshalValidateOperationRequestImplementation(input []byte) (ValidateOperationRequest, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling ValidateOperationRequest into map[string]interface: %+v", err) - } - - var value string - if v, ok := temp["objectType"]; ok { - value = fmt.Sprintf("%v", v) - } - - if strings.EqualFold(value, "ValidateIaasVMRestoreOperationRequest") { - var out ValidateIaasVMRestoreOperationRequest - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into ValidateIaasVMRestoreOperationRequest: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "ValidateRestoreOperationRequest") { - var out ValidateRestoreOperationRequest - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into ValidateRestoreOperationRequest: %+v", err) - } - return out, nil - } - - var parent BaseValidateOperationRequestImpl - if err := json.Unmarshal(input, &parent); err != nil { - return nil, fmt.Errorf("unmarshaling into BaseValidateOperationRequestImpl: %+v", err) - } - - return RawValidateOperationRequestImpl{ - validateOperationRequest: parent, - Type: value, - Values: temp, - }, nil - -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_validateoperationrequestresource.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_validateoperationrequestresource.go deleted file mode 100644 index 14096fc04d1..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_validateoperationrequestresource.go +++ /dev/null @@ -1,42 +0,0 @@ -package validateoperation - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ValidateOperationRequestResource struct { - Id string `json:"id"` - Properties ValidateOperationRequest `json:"properties"` -} - -var _ json.Unmarshaler = &ValidateOperationRequestResource{} - -func (s *ValidateOperationRequestResource) UnmarshalJSON(bytes []byte) error { - var decoded struct { - Id string `json:"id"` - } - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - - s.Id = decoded.Id - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling ValidateOperationRequestResource into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["properties"]; ok { - impl, err := UnmarshalValidateOperationRequestImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'Properties' for 'ValidateOperationRequestResource': %+v", err) - } - s.Properties = impl - } - - return nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_validaterestoreoperationrequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_validaterestoreoperationrequest.go deleted file mode 100644 index e185e9268f1..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/model_validaterestoreoperationrequest.go +++ /dev/null @@ -1,78 +0,0 @@ -package validateoperation - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ ValidateOperationRequest = ValidateRestoreOperationRequest{} - -type ValidateRestoreOperationRequest struct { - RestoreRequest RestoreRequest `json:"restoreRequest"` - - // Fields inherited from ValidateOperationRequest - - ObjectType string `json:"objectType"` -} - -func (s ValidateRestoreOperationRequest) ValidateOperationRequest() BaseValidateOperationRequestImpl { - return BaseValidateOperationRequestImpl{ - ObjectType: s.ObjectType, - } -} - -var _ json.Marshaler = ValidateRestoreOperationRequest{} - -func (s ValidateRestoreOperationRequest) MarshalJSON() ([]byte, error) { - type wrapper ValidateRestoreOperationRequest - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling ValidateRestoreOperationRequest: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling ValidateRestoreOperationRequest: %+v", err) - } - - decoded["objectType"] = "ValidateRestoreOperationRequest" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling ValidateRestoreOperationRequest: %+v", err) - } - - return encoded, nil -} - -var _ json.Unmarshaler = &ValidateRestoreOperationRequest{} - -func (s *ValidateRestoreOperationRequest) UnmarshalJSON(bytes []byte) error { - var decoded struct { - ObjectType string `json:"objectType"` - } - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - - s.ObjectType = decoded.ObjectType - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling ValidateRestoreOperationRequest into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["restoreRequest"]; ok { - impl, err := UnmarshalRestoreRequestImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'RestoreRequest' for 'ValidateRestoreOperationRequest': %+v", err) - } - s.RestoreRequest = impl - } - - return nil -} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/version.go b/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/version.go deleted file mode 100644 index 1dc796d7ff4..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-02-01/validateoperation/version.go +++ /dev/null @@ -1,10 +0,0 @@ -package validateoperation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2025-02-01" - -func userAgent() string { - return "hashicorp/go-azure-sdk/validateoperation/2025-02-01" -}