From 90eb21b58fe215bacea57c7c2d1025c149693956 Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Fri, 9 Aug 2024 21:44:00 +0100 Subject: [PATCH 01/43] * Add Exadata Infrastructure files. --- .teamcity/components/generated/services.kt | 1 + go.mod | 4 +- go.sum | 8 +- internal/clients/client.go | 5 + internal/provider/services.go | 2 + .../services/oracledatabase/client/client.go | 26 + .../exadata_infrastructure_data_source.go | 458 ++++++ ...exadata_infrastructure_data_source_test.go | 45 + .../exadata_infrastructure_helpers.go | 102 ++ .../exadata_infrastructure_resource.go | 337 +++++ .../exadata_infrastructure_resource_test.go | 210 +++ .../services/oracledatabase/registration.go | 37 + .../autonomousdatabasebackups/README.md | 99 ++ .../autonomousdatabasebackups/client.go | 26 + .../autonomousdatabasebackups/constants.go | 151 ++ .../id_autonomousdatabase.go | 130 ++ .../id_autonomousdatabasebackup.go | 139 ++ .../method_createorupdate.go | 75 + .../method_delete.go | 70 + .../autonomousdatabasebackups/method_get.go | 54 + .../method_listbyautonomousdatabase.go | 105 ++ .../method_update.go | 75 + .../model_autonomousdatabasebackup.go | 16 + ...odel_autonomousdatabasebackupproperties.go | 41 + .../model_autonomousdatabasebackupupdate.go | 8 + ...utonomousdatabasebackupupdateproperties.go | 8 + .../autonomousdatabasebackups/predicates.go | 27 + .../autonomousdatabasebackups/version.go | 12 + .../autonomousdatabasecharactersets/README.md | 53 + .../autonomousdatabasecharactersets/client.go | 26 + .../id_autonomousdatabasecharacterset.go | 130 ++ .../id_location.go | 121 ++ .../method_get.go | 54 + .../method_listbylocation.go | 105 ++ .../model_autonomousdatabasecharacterset.go | 16 + ...utonomousdatabasecharactersetproperties.go | 8 + .../predicates.go | 27 + .../version.go | 12 + .../README.md | 53 + .../client.go | 26 + ..._autonomousdatabasenationalcharacterset.go | 130 ++ .../id_location.go | 121 ++ .../method_get.go | 54 + .../method_listbylocation.go | 105 ++ ..._autonomousdatabasenationalcharacterset.go | 16 + ...sdatabasenationalcharactersetproperties.go | 8 + .../predicates.go | 27 + .../version.go | 12 + .../2024-06-01/autonomousdatabases/README.md | 201 +++ .../2024-06-01/autonomousdatabases/client.go | 26 + .../autonomousdatabases/constants.go | 1264 +++++++++++++++++ .../id_autonomousdatabase.go | 130 ++ .../method_createorupdate.go | 75 + .../autonomousdatabases/method_delete.go | 70 + .../autonomousdatabases/method_failover.go | 75 + .../method_generatewallet.go | 59 + .../autonomousdatabases/method_get.go | 54 + .../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 | 52 + .../model_autonomousdatabasebaseproperties.go | 61 + ...model_autonomousdatabasecloneproperties.go | 173 +++ .../model_autonomousdatabaseproperties.go | 165 +++ .../model_autonomousdatabasestandbysummary.go | 12 + .../model_autonomousdatabaseupdate.go | 9 + ...odel_autonomousdatabaseupdateproperties.go | 30 + .../model_autonomousdatabasewalletfile.go | 8 + .../model_connectionstringtype.go | 13 + .../model_connectionurltype.go | 14 + .../model_customercontact.go | 8 + .../autonomousdatabases/model_dayofweek.go | 8 + .../model_dayofweekupdate.go | 8 + ...generateautonomousdatabasewalletdetails.go | 10 + .../model_longtermbackupscheduledetails.go | 29 + .../model_peerdbdetails.go | 8 + .../autonomousdatabases/model_profiletype.go | 16 + .../model_restoreautonomousdatabasedetails.go | 23 + .../model_scheduledoperationstype.go | 10 + .../model_scheduledoperationstypeupdate.go | 10 + .../autonomousdatabases/predicates.go | 32 + .../2024-06-01/autonomousdatabases/version.go | 12 + .../autonomousdatabaseversions/README.md | 53 + .../autonomousdatabaseversions/client.go | 26 + .../autonomousdatabaseversions/constants.go | 57 + .../id_autonomousdbversion.go | 130 ++ .../autonomousdatabaseversions/id_location.go | 121 ++ .../autonomousdatabaseversions/method_get.go | 54 + .../method_listbylocation.go | 105 ++ .../model_autonomousdbversion.go | 16 + .../model_autonomousdbversionproperties.go | 13 + .../autonomousdatabaseversions/predicates.go | 27 + .../autonomousdatabaseversions/version.go | 12 + .../oracledatabase/2024-06-01/client.go | 163 +++ .../cloudexadatainfrastructures/README.md | 129 ++ .../cloudexadatainfrastructures/client.go | 26 + .../cloudexadatainfrastructures/constants.go | 322 +++++ .../id_cloudexadatainfrastructure.go | 130 ++ .../method_addstoragecapacity.go | 71 + .../method_createorupdate.go | 75 + .../method_delete.go | 70 + .../cloudexadatainfrastructures/method_get.go | 54 + .../method_listbyresourcegroup.go | 106 ++ .../method_listbysubscription.go | 106 ++ .../method_update.go | 75 + .../model_cloudexadatainfrastructure.go | 20 + ...el_cloudexadatainfrastructureproperties.go | 38 + .../model_cloudexadatainfrastructureupdate.go | 14 + ...udexadatainfrastructureupdateproperties.go | 12 + .../model_customercontact.go | 8 + .../model_dayofweek.go | 8 + .../model_estimatedpatchingtime.go | 11 + .../model_maintenancewindow.go | 17 + .../model_month.go | 8 + .../cloudexadatainfrastructures/predicates.go | 32 + .../cloudexadatainfrastructures/version.go | 12 + .../2024-06-01/cloudvmclusters/README.md | 172 +++ .../2024-06-01/cloudvmclusters/client.go | 26 + .../2024-06-01/cloudvmclusters/constants.go | 295 ++++ .../cloudvmclusters/id_cloudvmcluster.go | 130 ++ .../cloudvmclusters/method_addvms.go | 75 + .../cloudvmclusters/method_createorupdate.go | 75 + .../cloudvmclusters/method_delete.go | 70 + .../2024-06-01/cloudvmclusters/method_get.go | 54 + .../method_listbyresourcegroup.go | 106 ++ .../method_listbysubscription.go | 106 ++ .../method_listprivateipaddresses.go | 59 + .../cloudvmclusters/method_removevms.go | 75 + .../cloudvmclusters/method_update.go | 75 + .../cloudvmclusters/model_addremovedbnode.go | 8 + .../cloudvmclusters/model_cloudvmcluster.go | 18 + .../model_cloudvmclusterproperties.go | 73 + .../model_cloudvmclusterupdate.go | 9 + .../model_cloudvmclusterupdateproperties.go | 18 + .../model_datacollectionoptions.go | 10 + .../cloudvmclusters/model_dbiormconfig.go | 10 + .../model_exadataiormconfig.go | 11 + .../cloudvmclusters/model_nsgcidr.go | 9 + .../cloudvmclusters/model_portrange.go | 9 + .../model_privateipaddressesfilter.go | 9 + .../model_privateipaddressproperties.go | 12 + .../2024-06-01/cloudvmclusters/predicates.go | 32 + .../2024-06-01/cloudvmclusters/version.go | 12 + .../2024-06-01/dbnodes/README.md | 70 + .../2024-06-01/dbnodes/client.go | 26 + .../2024-06-01/dbnodes/constants.go | 201 +++ .../2024-06-01/dbnodes/id_cloudvmcluster.go | 130 ++ .../2024-06-01/dbnodes/id_dbnode.go | 139 ++ .../2024-06-01/dbnodes/method_action.go | 75 + .../2024-06-01/dbnodes/method_get.go | 54 + .../dbnodes/method_listbycloudvmcluster.go | 105 ++ .../2024-06-01/dbnodes/model_dbnode.go | 16 + .../2024-06-01/dbnodes/model_dbnodeaction.go | 8 + .../dbnodes/model_dbnodeproperties.go | 72 + .../2024-06-01/dbnodes/predicates.go | 27 + .../2024-06-01/dbnodes/version.go | 12 + .../2024-06-01/dbservers/README.md | 53 + .../2024-06-01/dbservers/client.go | 26 + .../2024-06-01/dbservers/constants.go | 154 ++ .../id_cloudexadatainfrastructure.go | 130 ++ .../2024-06-01/dbservers/id_dbserver.go | 139 ++ .../2024-06-01/dbservers/method_get.go | 54 + ...method_listbycloudexadatainfrastructure.go | 105 ++ .../2024-06-01/dbservers/model_dbserver.go | 16 + .../model_dbserverpatchingdetails.go | 41 + .../dbservers/model_dbserverproperties.go | 45 + .../2024-06-01/dbservers/predicates.go | 27 + .../2024-06-01/dbservers/version.go | 12 + .../2024-06-01/dbsystemshapes/README.md | 53 + .../2024-06-01/dbsystemshapes/client.go | 26 + .../dbsystemshapes/id_dbsystemshape.go | 130 ++ .../2024-06-01/dbsystemshapes/id_location.go | 121 ++ .../2024-06-01/dbsystemshapes/method_get.go | 54 + .../dbsystemshapes/method_listbylocation.go | 105 ++ .../dbsystemshapes/model_dbsystemshape.go | 16 + .../model_dbsystemshapeproperties.go | 27 + .../2024-06-01/dbsystemshapes/predicates.go | 27 + .../2024-06-01/dbsystemshapes/version.go | 12 + .../2024-06-01/dnsprivateviews/README.md | 53 + .../2024-06-01/dnsprivateviews/client.go | 26 + .../2024-06-01/dnsprivateviews/constants.go | 101 ++ .../dnsprivateviews/id_dnsprivateview.go | 130 ++ .../2024-06-01/dnsprivateviews/id_location.go | 121 ++ .../2024-06-01/dnsprivateviews/method_get.go | 54 + .../dnsprivateviews/method_listbylocation.go | 105 ++ .../dnsprivateviews/model_dnsprivateview.go | 16 + .../model_dnsprivateviewproperties.go | 45 + .../2024-06-01/dnsprivateviews/predicates.go | 27 + .../2024-06-01/dnsprivateviews/version.go | 12 + .../2024-06-01/dnsprivatezones/README.md | 53 + .../2024-06-01/dnsprivatezones/client.go | 26 + .../2024-06-01/dnsprivatezones/constants.go | 145 ++ .../dnsprivatezones/id_dnsprivatezone.go | 130 ++ .../2024-06-01/dnsprivatezones/id_location.go | 121 ++ .../2024-06-01/dnsprivatezones/method_get.go | 54 + .../dnsprivatezones/method_listbylocation.go | 105 ++ .../dnsprivatezones/model_dnsprivatezone.go | 16 + .../model_dnsprivatezoneproperties.go | 35 + .../2024-06-01/dnsprivatezones/predicates.go | 27 + .../2024-06-01/dnsprivatezones/version.go | 12 + .../2024-06-01/giversions/README.md | 53 + .../2024-06-01/giversions/client.go | 26 + .../2024-06-01/giversions/id_giversion.go | 130 ++ .../2024-06-01/giversions/id_location.go | 121 ++ .../2024-06-01/giversions/method_get.go | 54 + .../giversions/method_listbylocation.go | 105 ++ .../2024-06-01/giversions/model_giversion.go | 16 + .../giversions/model_giversionproperties.go | 8 + .../2024-06-01/giversions/predicates.go | 27 + .../2024-06-01/giversions/version.go | 12 + .../2024-06-01/oraclesubscriptions/README.md | 153 ++ .../2024-06-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 | 56 + .../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 + .../2024-06-01/oraclesubscriptions/version.go | 12 + .../2024-06-01/systemversions/README.md | 53 + .../2024-06-01/systemversions/client.go | 26 + .../2024-06-01/systemversions/id_location.go | 121 ++ .../systemversions/id_systemversion.go | 130 ++ .../2024-06-01/systemversions/method_get.go | 54 + .../systemversions/method_listbylocation.go | 105 ++ .../systemversions/model_systemversion.go | 16 + .../model_systemversionproperties.go | 8 + .../2024-06-01/systemversions/predicates.go | 27 + .../2024-06-01/systemversions/version.go | 12 + .../virtualnetworkaddresses/README.md | 82 ++ .../virtualnetworkaddresses/client.go | 26 + .../virtualnetworkaddresses/constants.go | 107 ++ .../id_cloudvmcluster.go | 130 ++ .../id_virtualnetworkaddress.go | 139 ++ .../method_createorupdate.go | 75 + .../virtualnetworkaddresses/method_delete.go | 70 + .../virtualnetworkaddresses/method_get.go | 54 + .../method_listbycloudvmcluster.go | 105 ++ .../model_virtualnetworkaddress.go | 16 + .../model_virtualnetworkaddressproperties.go | 33 + .../virtualnetworkaddresses/predicates.go | 27 + .../virtualnetworkaddresses/version.go | 12 + .../resourcemanager/poller_lro_statuses.go | 3 + vendor/modules.txt | 21 +- website/allowed-subcategories | 1 + ...abase_exadata_infrastructure.html.markdown | 152 ++ ...abase_exadata_infrastructure.html.markdown | 106 ++ 267 files changed, 17438 insertions(+), 8 deletions(-) create mode 100644 internal/services/oracledatabase/client/client.go create mode 100644 internal/services/oracledatabase/exadata_infrastructure_data_source.go create mode 100644 internal/services/oracledatabase/exadata_infrastructure_data_source_test.go create mode 100644 internal/services/oracledatabase/exadata_infrastructure_helpers.go create mode 100644 internal/services/oracledatabase/exadata_infrastructure_resource.go create mode 100644 internal/services/oracledatabase/exadata_infrastructure_resource_test.go create mode 100644 internal/services/oracledatabase/registration.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/id_autonomousdatabase.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/id_autonomousdatabasebackup.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/method_listbyautonomousdatabase.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/model_autonomousdatabasebackup.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/model_autonomousdatabasebackupproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/model_autonomousdatabasebackupupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/model_autonomousdatabasebackupupdateproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/id_autonomousdatabasecharacterset.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/id_location.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/method_listbylocation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/model_autonomousdatabasecharacterset.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/model_autonomousdatabasecharactersetproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/id_autonomousdatabasenationalcharacterset.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/id_location.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/method_listbylocation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/model_autonomousdatabasenationalcharacterset.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/model_autonomousdatabasenationalcharactersetproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/id_autonomousdatabase.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_failover.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_generatewallet.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_listbyresourcegroup.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_listbysubscription.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_restore.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_shrink.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_switchover.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_allconnectionstringtype.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_apexdetailstype.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabase.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabasebaseproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabasecloneproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabaseproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabasestandbysummary.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabaseupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabaseupdateproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabasewalletfile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_connectionstringtype.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_connectionurltype.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_customercontact.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_dayofweek.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_dayofweekupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_generateautonomousdatabasewalletdetails.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_longtermbackupscheduledetails.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_peerdbdetails.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_profiletype.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_restoreautonomousdatabasedetails.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_scheduledoperationstype.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_scheduledoperationstypeupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/id_autonomousdbversion.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/id_location.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/method_listbylocation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/model_autonomousdbversion.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/model_autonomousdbversionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/id_cloudexadatainfrastructure.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/method_addstoragecapacity.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/method_listbyresourcegroup.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/method_listbysubscription.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_cloudexadatainfrastructure.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_cloudexadatainfrastructureproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_cloudexadatainfrastructureupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_cloudexadatainfrastructureupdateproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_customercontact.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_dayofweek.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_estimatedpatchingtime.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_maintenancewindow.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_month.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/id_cloudvmcluster.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_addvms.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_listbyresourcegroup.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_listbysubscription.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_listprivateipaddresses.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_removevms.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_addremovedbnode.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_cloudvmcluster.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_cloudvmclusterproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_cloudvmclusterupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_cloudvmclusterupdateproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_datacollectionoptions.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_dbiormconfig.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_exadataiormconfig.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_nsgcidr.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_portrange.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_privateipaddressesfilter.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_privateipaddressproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/id_cloudvmcluster.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/id_dbnode.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/method_action.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/method_listbycloudvmcluster.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/model_dbnode.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/model_dbnodeaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/model_dbnodeproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/id_cloudexadatainfrastructure.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/id_dbserver.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/method_listbycloudexadatainfrastructure.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/model_dbserver.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/model_dbserverpatchingdetails.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/model_dbserverproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/id_dbsystemshape.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/id_location.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/method_listbylocation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/model_dbsystemshape.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/model_dbsystemshapeproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/id_dnsprivateview.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/id_location.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/method_listbylocation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/model_dnsprivateview.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/model_dnsprivateviewproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/id_dnsprivatezone.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/id_location.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/method_listbylocation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/model_dnsprivatezone.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/model_dnsprivatezoneproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/id_giversion.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/id_location.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/method_listbylocation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/model_giversion.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/model_giversionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_addazuresubscriptions.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_listactivationlinks.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_listbysubscription.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_listcloudaccountdetails.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_listsaassubscriptiondetails.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_activationlinks.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_azuresubscriptions.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_cloudaccountdetails.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_oraclesubscription.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_oraclesubscriptionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_oraclesubscriptionupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_oraclesubscriptionupdateproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_plan.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_planupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_saassubscriptiondetails.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/id_location.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/id_systemversion.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/method_listbylocation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/model_systemversion.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/model_systemversionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/id_cloudvmcluster.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/id_virtualnetworkaddress.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/method_listbycloudvmcluster.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/model_virtualnetworkaddress.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/model_virtualnetworkaddressproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/version.go create mode 100644 website/docs/d/oracledatabase_exadata_infrastructure.html.markdown create mode 100644 website/docs/r/oracledatabase_exadata_infrastructure.html.markdown diff --git a/.teamcity/components/generated/services.kt b/.teamcity/components/generated/services.kt index 78c055e88b34..bdd7ba26fd1e 100644 --- a/.teamcity/components/generated/services.kt +++ b/.teamcity/components/generated/services.kt @@ -8,6 +8,7 @@ var services = mapOf( "advisor" to "Advisor", "analysisservices" to "Analysis Services", "appconfiguration" to "App Configuration", + "oracledatabase" to "App Service", "appservice" to "AppService", "applicationinsights" to "Application Insights", "arcresourcebridge" to "Arc Resource Bridge", diff --git a/go.mod b/go.mod index 9ad864737536..bcaf2c387c7e 100644 --- a/go.mod +++ b/go.mod @@ -17,8 +17,8 @@ require ( github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.6.0 github.com/hashicorp/go-azure-helpers v0.70.1 - github.com/hashicorp/go-azure-sdk/resource-manager v0.20240715.1103416 - github.com/hashicorp/go-azure-sdk/sdk v0.20240715.1103416 + github.com/hashicorp/go-azure-sdk/resource-manager v0.20240731.1212841 + github.com/hashicorp/go-azure-sdk/sdk v0.20240731.1212841 github.com/hashicorp/go-hclog v1.6.3 github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-uuid v1.0.3 diff --git a/go.sum b/go.sum index 8ae94e005fb1..7dc7466ae565 100644 --- a/go.sum +++ b/go.sum @@ -93,10 +93,10 @@ github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-azure-helpers v0.70.1 h1:7hlnRrZobMZxpOzdlNEsayzAayj/KRG4wpDS1jgo4GM= github.com/hashicorp/go-azure-helpers v0.70.1/go.mod h1:BmbF4JDYXK5sEmFeU5hcn8Br21uElcqLfdQxjatwQKw= -github.com/hashicorp/go-azure-sdk/resource-manager v0.20240715.1103416 h1:TEAZyGtJoBPIxE0bif+fjLE0SurzU95pOTM0CILUnh0= -github.com/hashicorp/go-azure-sdk/resource-manager v0.20240715.1103416/go.mod h1:8rhCtgnQvMPQEhKxYJjdxAEhodA9sOT+GzVRvzJYYvk= -github.com/hashicorp/go-azure-sdk/sdk v0.20240715.1103416 h1:84S+8LdbZLDAUo1+dOr2lq13/hIzHnPxX/QokzGDKo4= -github.com/hashicorp/go-azure-sdk/sdk v0.20240715.1103416/go.mod h1:dMKF6bXrgGmy1d3pLzkmBpG2JIHgSAV2/OMSCEgyMwE= +github.com/hashicorp/go-azure-sdk/resource-manager v0.20240731.1212841 h1:H7BkxZl0qitdWq7sEGzNqkn5/11YTamwq2XTI8/7Jq0= +github.com/hashicorp/go-azure-sdk/resource-manager v0.20240731.1212841/go.mod h1:/4Ly9Gppp/Nu9AaWDfod6atYQ4n2OqN0ERpE2xZQz8A= +github.com/hashicorp/go-azure-sdk/sdk v0.20240731.1212841 h1:RzWuy96j/7q3Vi2aZoiIrokm8yotUNX1UGD3pbWi5Ck= +github.com/hashicorp/go-azure-sdk/sdk v0.20240731.1212841/go.mod h1:dMKF6bXrgGmy1d3pLzkmBpG2JIHgSAV2/OMSCEgyMwE= github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= diff --git a/internal/clients/client.go b/internal/clients/client.go index 32d90814c388..8913f66f16ba 100644 --- a/internal/clients/client.go +++ b/internal/clients/client.go @@ -112,6 +112,7 @@ import ( newrelic "github.com/hashicorp/terraform-provider-azurerm/internal/services/newrelic/client" nginx "github.com/hashicorp/terraform-provider-azurerm/internal/services/nginx/client" notificationhub "github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/client" + oracledatabase "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracledatabase/client" orbital "github.com/hashicorp/terraform-provider-azurerm/internal/services/orbital/client" paloalto "github.com/hashicorp/terraform-provider-azurerm/internal/services/paloalto/client" policy "github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/client" @@ -249,6 +250,7 @@ type Client struct { NewRelic *newrelic.Client Nginx *nginx_2024_01_01_preview.Client NotificationHubs *notificationhub.Client + OracleDatabase *oracledatabase.Client Orbital *orbital.Client PaloAlto *paloalto.Client Policy *policy.Client @@ -558,6 +560,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error if client.NotificationHubs, err = notificationhub.NewClient(o); err != nil { return fmt.Errorf("building clients for NotificationHubs: %+v", err) } + if client.OracleDatabase, err = oracledatabase.NewClient(o); err != nil { + return fmt.Errorf("building clients for OracleDatabase: %+v", err) + } if client.Orbital, err = orbital.NewClient(o); err != nil { return fmt.Errorf("building clients for Orbital: %+v", err) } diff --git a/internal/provider/services.go b/internal/provider/services.go index 30fb0e987a0f..4f08aa5e202e 100644 --- a/internal/provider/services.go +++ b/internal/provider/services.go @@ -95,6 +95,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/newrelic" "github.com/hashicorp/terraform-provider-azurerm/internal/services/nginx" "github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracledatabase" "github.com/hashicorp/terraform-provider-azurerm/internal/services/orbital" "github.com/hashicorp/terraform-provider-azurerm/internal/services/paloalto" "github.com/hashicorp/terraform-provider-azurerm/internal/services/policy" @@ -197,6 +198,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration { networkfunction.Registration{}, newrelic.Registration{}, nginx.Registration{}, + oracledatabase.Registration{}, paloalto.Registration{}, policy.Registration{}, privatednsresolver.Registration{}, diff --git a/internal/services/oracledatabase/client/client.go b/internal/services/oracledatabase/client/client.go new file mode 100644 index 000000000000..6d3467596a8e --- /dev/null +++ b/internal/services/oracledatabase/client/client.go @@ -0,0 +1,26 @@ +// Copyright © 2024, Oracle and/or its affiliates. All rights reserved + +package client + +import ( + oracedatabase "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/terraform-provider-azurerm/internal/common" +) + +type Client struct { + OracleDatabaseClient *oracedatabase.Client +} + +func NewClient(o *common.ClientOptions) (*Client, error) { + o.DisableCorrelationRequestID = true + oracleDatabaseClient, err := oracedatabase.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) { + o.Configure(c, o.Authorizers.ResourceManager) + }) + if err != nil { + return nil, err + } + return &Client{ + OracleDatabaseClient: oracleDatabaseClient, + }, nil +} diff --git a/internal/services/oracledatabase/exadata_infrastructure_data_source.go b/internal/services/oracledatabase/exadata_infrastructure_data_source.go new file mode 100644 index 000000000000..52c26869d5b6 --- /dev/null +++ b/internal/services/oracledatabase/exadata_infrastructure_data_source.go @@ -0,0 +1,458 @@ +// Copyright © 2024, Oracle and/or its affiliates. All rights reserved + +package oracledatabase + +import ( + "context" + "fmt" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" + "time" +) + +type ExadataInfraDataSource struct{} + +type ExadataInfraDataModel struct { + Location string `tfschema:"location"` + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Type string `tfschema:"type"` + Tags map[string]interface{} `tfschema:"tags"` + Zones zones.Schema `tfschema:"zones"` + + // SystemData + SystemData []SystemDataModel `tfschema:"system_data"` + + // CloudExadataInfrastructureProperties + ActivatedStorageCount int64 `tfschema:"activated_storage_count"` + AdditionalStorageCount int64 `tfschema:"additional_storage_count"` + AvailableStorageSizeInGbs int64 `tfschema:"available_storage_size_in_gbs"` + ComputeCount int64 `tfschema:"compute_count"` + CpuCount int64 `tfschema:"cpu_count"` + CustomerContacts []string `tfschema:"customer_contacts"` + DataStorageSizeInTbs float64 `tfschema:"data_storage_size_in_tbs"` + DbNodeStorageSizeInGbs int64 `tfschema:"db_node_storage_size_in_gbs"` + DbServerVersion string `tfschema:"db_server_version"` + DisplayName string `tfschema:"display_name"` + EstimatedPatchingTime []EstimatedPatchingTimeModel `tfschema:"estimated_patching_time"` + LastMaintenanceRunId string `tfschema:"last_maintenance_run_id"` + LifecycleDetails string `tfschema:"lifecycle_details"` + LifecycleState string `tfschema:"lifecycle_state"` + MaintenanceWindow []MaintenanceWindowModel `tfschema:"maintenance_window"` + MaxCPUCount int64 `tfschema:"max_cpu_count"` + MaxDataStorageInTbs float64 `tfschema:"max_data_storage_in_tbs"` + MaxDbNodeStorageSizeInGbs int64 `tfschema:"max_db_node_storage_size_in_gbs"` + MaxMemoryInGbs int64 `tfschema:"max_memory_in_gbs"` + MemorySizeInGbs int64 `tfschema:"memory_size_in_gbs"` + MonthlyDbServerVersion string `tfschema:"monthly_db_server_version"` + MonthlyStorageServerVersion string `tfschema:"monthly_storage_server_version"` + NextMaintenanceRunId string `tfschema:"next_maintenance_run_id"` + OciUrl string `tfschema:"oci_url"` + Ocid string `tfschema:"ocid"` + ProvisioningState string `tfschema:"provisioning_state"` + Shape string `tfschema:"shape"` + StorageCount int64 `tfschema:"storage_count"` + StorageServerVersion string `tfschema:"storage_server_version"` + TimeCreated string `tfschema:"time_created"` + TotalStorageSizeInGbs int64 `tfschema:"total_storage_size_in_gbs"` +} + +type SystemDataModel struct { + CreatedBy string `tfschema:"created_by"` + CreatedByType string `tfschema:"created_by_type"` + CreatedAt string `tfschema:"created_at"` + LastModifiedBy string `tfschema:"last_modified_by"` + LastModifiedbyType string `tfschema:"last_modified_by_type"` + LastModifiedAt string `tfschema:"last_modified_at"` +} + +type EstimatedPatchingTimeModel struct { + EstimatedDbServerPatchingTime *int64 `tfschema:"estimated_db_server_patching_time"` + EstimatedNetworkSwitchesPatchingTime *int64 `tfschema:"estimated_network_switches_patching_time"` + EstimatedStorageServerPatchingTime *int64 `tfschema:"estimated_storage_server_patching_time"` + TotalEstimatedPatchingTime *int64 `tfschema:"total_estimated_patching_time"` +} + +type MaintenanceWindowModel struct { + CustomActionTimeoutInMins int64 `tfschema:"custom_action_timeout_in_mins"` + DaysOfWeek []string `tfschema:"days_of_week"` + HoursOfDay []int64 `tfschema:"hours_of_day"` + IsCustomActionTimeoutEnabled bool `tfschema:"is_custom_action_timeout_enabled"` + IsMonthlyPatchingEnabled bool `tfschema:"is_monthly_patching_enabled"` + LeadTimeInWeeks int64 `tfschema:"lead_time_in_weeks"` + Months []string `tfschema:"months"` + PatchingMode string `tfschema:"patching_mode"` + Preference string `tfschema:"preference"` + WeeksOfMonth []int64 `tfschema:"weeks_of_month"` +} + +func (d ExadataInfraDataSource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + } +} + +func (d ExadataInfraDataSource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "location": commonschema.LocationComputed(), + "type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "tags": commonschema.TagsDataSource(), + "zones": commonschema.ZonesMultipleComputed(), + + // SystemData + "system_data": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "created_by": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "created_by_type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "created_at": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "last_modified_by": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "last_modified_by_type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "last_modified_at": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + // CloudExadataInfrastructureProperties + "activated_storage_count": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "additional_storage_count": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "available_storage_size_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "compute_count": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "cpu_count": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "customer_contacts": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "data_storage_size_in_tbs": { + Type: pluginsdk.TypeFloat, + Computed: true, + }, + "db_node_storage_size_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "db_server_version": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "display_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "estimated_patching_time": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "estimated_db_server_patching_time": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "estimated_network_switches_patching_time": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "estimated_storage_server_patching_time": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "total_estimated_patching_time": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + }, + }, + }, + "last_maintenance_run_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "lifecycle_details": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "lifecycle_state": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "maintenance_window": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "custom_action_timeout_in_mins": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "days_of_week": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "hours_of_day": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeInt, + }, + }, + "is_custom_action_timeout_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "is_monthly_patching_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "lead_time_in_weeks": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "months": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "patching_mode": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "preference": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "weeks_of_month": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeInt, + }, + }, + }, + }, + }, + "max_cpu_count": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "max_data_storage_in_tbs": { + Type: pluginsdk.TypeFloat, + Computed: true, + }, + "max_db_node_storage_size_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "max_memory_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "memory_size_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "monthly_db_server_version": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "monthly_storage_server_version": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "next_maintenance_run_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "oci_url": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "ocid": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "provisioning_state": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "shape": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "storage_count": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "storage_server_version": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_created": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "total_storage_size_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + } +} + +func (d ExadataInfraDataSource) ModelObject() interface{} { + return nil +} + +func (d ExadataInfraDataSource) ResourceType() string { + return "azurerm_oracledatabase_exadata_infrastructure" +} + +func (d ExadataInfraDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return cloudexadatainfrastructures.ValidateCloudExadataInfrastructureID +} + +func (d ExadataInfraDataSource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudExadataInfrastructures + subscriptionId := metadata.Client.Account.SubscriptionId + + id := cloudexadatainfrastructures.NewCloudExadataInfrastructureID(subscriptionId, + metadata.ResourceData.Get("resource_group_name").(string), + metadata.ResourceData.Get("name").(string)) + + resp, err := client.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + if model := resp.Model; model != nil { + err := metadata.ResourceData.Set("location", location.NormalizeNilable(&model.Location)) + if err != nil { + return err + } + + var output ExadataInfraDataModel + prop := model.Properties + if prop != nil { + output = ExadataInfraDataModel{ + ActivatedStorageCount: pointer.From(prop.ActivatedStorageCount), + AdditionalStorageCount: pointer.From(prop.AdditionalStorageCount), + AvailableStorageSizeInGbs: pointer.From(prop.AvailableStorageSizeInGbs), + CpuCount: pointer.From(prop.CpuCount), + ComputeCount: pointer.From(prop.ComputeCount), + CustomerContacts: ConvertCustomerContactsToInternalModel(prop.CustomerContacts), + DataStorageSizeInTbs: pointer.From(prop.DataStorageSizeInTbs), + DbNodeStorageSizeInGbs: pointer.From(prop.DbNodeStorageSizeInGbs), + DbServerVersion: pointer.From(prop.DbServerVersion), + DisplayName: prop.DisplayName, + EstimatedPatchingTime: ConvertEstimatedPatchingTimesToInternalModel(prop.EstimatedPatchingTime), + LastMaintenanceRunId: pointer.From(prop.LastMaintenanceRunId), + LifecycleDetails: pointer.From(prop.LifecycleDetails), + LifecycleState: string(*prop.LifecycleState), + MaintenanceWindow: ConvertMaintenanceWindowToInternalModel(prop.MaintenanceWindow), + MaxCPUCount: pointer.From(prop.MaxCPUCount), + MaxDataStorageInTbs: pointer.From(prop.MaxDataStorageInTbs), + MaxDbNodeStorageSizeInGbs: pointer.From(prop.MaxDbNodeStorageSizeInGbs), + MaxMemoryInGbs: pointer.From(prop.MaxMemoryInGbs), + MemorySizeInGbs: pointer.From(prop.MemorySizeInGbs), + MonthlyDbServerVersion: pointer.From(prop.MonthlyDbServerVersion), + MonthlyStorageServerVersion: pointer.From(prop.MonthlyStorageServerVersion), + NextMaintenanceRunId: pointer.From(prop.NextMaintenanceRunId), + OciUrl: pointer.From(prop.OciUrl), + Ocid: pointer.From(prop.Ocid), + ProvisioningState: string(*prop.ProvisioningState), + Shape: prop.Shape, + StorageCount: pointer.From(prop.StorageCount), + StorageServerVersion: pointer.From(prop.StorageServerVersion), + TimeCreated: pointer.From(prop.TimeCreated), + TotalStorageSizeInGbs: pointer.From(prop.TotalStorageSizeInGbs), + } + } + + systemData := model.SystemData + if systemData != nil { + output.SystemData = []SystemDataModel{ + { + CreatedBy: systemData.CreatedBy, + CreatedByType: systemData.CreatedByType, + CreatedAt: systemData.CreatedAt, + LastModifiedBy: systemData.LastModifiedBy, + LastModifiedbyType: systemData.LastModifiedbyType, + LastModifiedAt: systemData.LastModifiedAt, + }, + } + } + output.Name = id.CloudExadataInfrastructureName + output.ResourceGroupName = id.ResourceGroupName + output.Type = pointer.From(model.Type) + output.Tags = utils.FlattenPtrMapStringString(model.Tags) + output.Location = model.Location + output.Zones = model.Zones + + metadata.SetID(id) + return metadata.Encode(&output) + } + return nil + }, + } +} diff --git a/internal/services/oracledatabase/exadata_infrastructure_data_source_test.go b/internal/services/oracledatabase/exadata_infrastructure_data_source_test.go new file mode 100644 index 000000000000..f9daca462216 --- /dev/null +++ b/internal/services/oracledatabase/exadata_infrastructure_data_source_test.go @@ -0,0 +1,45 @@ +// Copyright © 2024, Oracle and/or its affiliates. All rights reserved + +package oracledatabase_test + +import ( + "fmt" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracledatabase" + "testing" +) + +type ExadataInfraDataSource struct{} + +func TestExadataInfraDataSource_basic(t *testing.T) { + data := acceptance.BuildTestData(t, oracledatabase.ExadataInfraDataSource{}.ResourceType(), "test") + r := ExadataInfraDataSource{} + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("name").Exists(), + check.That(data.ResourceName).Key("location").Exists(), + check.That(data.ResourceName).Key("resource_group_name").Exists(), + check.That(data.ResourceName).Key("compute_count").Exists(), + check.That(data.ResourceName).Key("display_name").Exists(), + check.That(data.ResourceName).Key("shape").Exists(), + check.That(data.ResourceName).Key("storage_count").Exists(), + check.That(data.ResourceName).Key("zones.#").HasValue("1"), + ), + }, + }) +} + +func (d ExadataInfraDataSource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +data "azurerm_oracledatabase_exadata_infrastructure" "test" { + name = azurerm_oracledatabase_exadata_infrastructure.test.name + resource_group_name = azurerm_oracledatabase_exadata_infrastructure.test.resource_group_name +} +`, ExadataInfraResource{}.basic(data)) +} diff --git a/internal/services/oracledatabase/exadata_infrastructure_helpers.go b/internal/services/oracledatabase/exadata_infrastructure_helpers.go new file mode 100644 index 000000000000..16739c5402e0 --- /dev/null +++ b/internal/services/oracledatabase/exadata_infrastructure_helpers.go @@ -0,0 +1,102 @@ +package oracledatabase + +import ( + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures" +) + +func ConvertCustomerContactsToInternalModel(customerContactsList *[]cloudexadatainfrastructures.CustomerContact) []string { + var customerContacts []string + if customerContactsList != nil { + for _, customerContact := range *customerContactsList { + customerContacts = append(customerContacts, customerContact.Email) + } + } + return customerContacts +} + +func ConvertEstimatedPatchingTimesToInternalModel(estimatedPatchingTime *cloudexadatainfrastructures.EstimatedPatchingTime) []EstimatedPatchingTimeModel { + if estimatedPatchingTime != nil { + return []EstimatedPatchingTimeModel{ + { + EstimatedDbServerPatchingTime: estimatedPatchingTime.EstimatedDbServerPatchingTime, + EstimatedNetworkSwitchesPatchingTime: estimatedPatchingTime.EstimatedNetworkSwitchesPatchingTime, + EstimatedStorageServerPatchingTime: estimatedPatchingTime.EstimatedStorageServerPatchingTime, + TotalEstimatedPatchingTime: estimatedPatchingTime.TotalEstimatedPatchingTime, + }, + } + } + return nil +} + +func ConvertMaintenanceWindowToInternalModel(maintenanceWindow *cloudexadatainfrastructures.MaintenanceWindow) []MaintenanceWindowModel { + if maintenanceWindow != nil { + return []MaintenanceWindowModel{ + { + CustomActionTimeoutInMins: pointer.From(maintenanceWindow.CustomActionTimeoutInMins), + DaysOfWeek: ConvertDayOfWeekToInternalModel(maintenanceWindow.DaysOfWeek), + HoursOfDay: pointer.From(maintenanceWindow.HoursOfDay), + IsCustomActionTimeoutEnabled: pointer.From(maintenanceWindow.IsCustomActionTimeoutEnabled), + IsMonthlyPatchingEnabled: pointer.From(maintenanceWindow.IsMonthlyPatchingEnabled), + LeadTimeInWeeks: pointer.From(maintenanceWindow.LeadTimeInWeeks), + Months: ConvertMonthsToInternalModel(maintenanceWindow.Months), + PatchingMode: string(pointer.From(maintenanceWindow.PatchingMode)), + Preference: string(pointer.From(maintenanceWindow.Preference)), + WeeksOfMonth: pointer.From(maintenanceWindow.WeeksOfMonth), + }, + } + } + return nil +} + +func ConvertDayOfWeekToInternalModel(dayOfWeeks *[]cloudexadatainfrastructures.DayOfWeek) []string { + var dayOfWeeksArray []string + if dayOfWeeks != nil { + for _, dayOfWeek := range *dayOfWeeks { + dayOfWeeksArray = append(dayOfWeeksArray, string(dayOfWeek.Name)) + } + } + return dayOfWeeksArray +} + +func ConvertMonthsToInternalModel(months *[]cloudexadatainfrastructures.Month) []string { + var monthsArray []string + if months != nil { + for _, month := range *months { + monthsArray = append(monthsArray, string(month.Name)) + } + } + return monthsArray +} + +func ConvertCustomerContactsToSDK(customerContactsList []string) []cloudexadatainfrastructures.CustomerContact { + var customerContacts []cloudexadatainfrastructures.CustomerContact + if customerContactsList != nil { + for _, customerContact := range customerContactsList { + customerContacts = append(customerContacts, cloudexadatainfrastructures.CustomerContact{ + Email: customerContact, + }) + } + } + return customerContacts +} + +func ConvertDayOfWeekToSDK(daysOfWeek []string) []cloudexadatainfrastructures.DayOfWeek { + var daysOfWeekConverted []cloudexadatainfrastructures.DayOfWeek + for _, day := range daysOfWeek { + daysOfWeekConverted = append(daysOfWeekConverted, cloudexadatainfrastructures.DayOfWeek{ + Name: cloudexadatainfrastructures.DayOfWeekName(day), + }) + } + return daysOfWeekConverted +} + +func ConvertMonthsToSDK(months []string) []cloudexadatainfrastructures.Month { + var monthsConverted []cloudexadatainfrastructures.Month + for _, month := range months { + monthsConverted = append(monthsConverted, cloudexadatainfrastructures.Month{ + Name: cloudexadatainfrastructures.MonthName(month), + }) + } + return monthsConverted +} diff --git a/internal/services/oracledatabase/exadata_infrastructure_resource.go b/internal/services/oracledatabase/exadata_infrastructure_resource.go new file mode 100644 index 000000000000..bc6a7099a107 --- /dev/null +++ b/internal/services/oracledatabase/exadata_infrastructure_resource.go @@ -0,0 +1,337 @@ +// Copyright © 2024, Oracle and/or its affiliates. All rights reserved + +package oracledatabase + +import ( + "context" + "fmt" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" + "time" +) + +var _ sdk.Resource = ExadataInfraResource{} + +type ExadataInfraResource struct{} + +type ExadataInfraResourceModel struct { + // Azure + Location string `tfschema:"location"` + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Tags map[string]interface{} `tfschema:"tags"` + Zones zones.Schema `tfschema:"zones"` + + // Required + ComputeCount int64 `tfschema:"compute_count"` + DisplayName string `tfschema:"display_name"` + Shape string `tfschema:"shape"` + StorageCount int64 `tfschema:"storage_count"` + + // Optional + CustomerContacts []string `tfschema:"customer_contacts"` + MaintenanceWindow []MaintenanceWindowModel `tfschema:"maintenance_window"` +} + +func (ExadataInfraResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + // Azure + "location": commonschema.Location(), + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + "resource_group_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + "tags": commonschema.Tags(), + "zones": commonschema.ZonesMultipleRequired(), + + // Required + "compute_count": { + Type: pluginsdk.TypeInt, + Required: true, + }, + "display_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + "shape": { + Type: pluginsdk.TypeString, + Required: true, + }, + "storage_count": { + Type: pluginsdk.TypeInt, + Required: true, + }, + + // Optional + "customer_contacts": { + Type: pluginsdk.TypeList, + Optional: true, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "maintenance_window": { + Type: pluginsdk.TypeList, + Optional: true, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "custom_action_timeout_in_mins": { + Type: pluginsdk.TypeInt, + Optional: true, + Computed: true, + }, + "days_of_week": { + Type: pluginsdk.TypeList, + Optional: true, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "hours_of_day": { + Type: pluginsdk.TypeList, + Optional: true, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeInt, + }, + }, + "is_custom_action_timeout_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Computed: true, + }, + "is_monthly_patching_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Computed: true, + }, + "lead_time_in_weeks": { + Type: pluginsdk.TypeInt, + Optional: true, + Computed: true, + }, + "months": { + Type: pluginsdk.TypeList, + Optional: true, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "patching_mode": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + }, + "preference": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + }, + "weeks_of_month": { + Type: pluginsdk.TypeList, + Optional: true, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeInt, + }, + }, + }, + }, + }, + } +} + +func (ExadataInfraResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (ExadataInfraResource) ModelObject() interface{} { + return &ExadataInfraResource{} +} + +func (ExadataInfraResource) ResourceType() string { + return "azurerm_oracledatabase_exadata_infrastructure" +} + +func (r ExadataInfraResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudExadataInfrastructures + subscriptionId := metadata.Client.Account.SubscriptionId + + var model ExadataInfraResourceModel + if err := metadata.Decode(&model); err != nil { + return err + } + + id := cloudexadatainfrastructures.NewCloudExadataInfrastructureID(subscriptionId, + model.ResourceGroupName, + model.Name) + + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + param := cloudexadatainfrastructures.CloudExadataInfrastructure{ + Name: pointer.To(model.Name), + Location: model.Location, + Tags: tags.Expand(model.Tags), + Zones: model.Zones, + Properties: &cloudexadatainfrastructures.CloudExadataInfrastructureProperties{ + ComputeCount: pointer.To(model.ComputeCount), + DisplayName: model.DisplayName, + StorageCount: pointer.To(model.StorageCount), + Shape: model.Shape, + CustomerContacts: pointer.To(ConvertCustomerContactsToSDK(model.CustomerContacts)), + }, + } + + if model.MaintenanceWindow != nil && len(model.MaintenanceWindow) > 0 { + param.Properties.MaintenanceWindow = &cloudexadatainfrastructures.MaintenanceWindow{ + CustomActionTimeoutInMins: pointer.To(model.MaintenanceWindow[0].CustomActionTimeoutInMins), + DaysOfWeek: pointer.To(ConvertDayOfWeekToSDK(model.MaintenanceWindow[0].DaysOfWeek)), + HoursOfDay: pointer.To(model.MaintenanceWindow[0].HoursOfDay), + IsCustomActionTimeoutEnabled: pointer.To(model.MaintenanceWindow[0].IsCustomActionTimeoutEnabled), + IsMonthlyPatchingEnabled: pointer.To(model.MaintenanceWindow[0].IsMonthlyPatchingEnabled), + LeadTimeInWeeks: pointer.To(model.MaintenanceWindow[0].LeadTimeInWeeks), + Months: pointer.To(ConvertMonthsToSDK(model.MaintenanceWindow[0].Months)), + PatchingMode: pointer.To(cloudexadatainfrastructures.PatchingMode(model.MaintenanceWindow[0].PatchingMode)), + Preference: pointer.To(cloudexadatainfrastructures.Preference(model.MaintenanceWindow[0].Preference)), + WeeksOfMonth: pointer.To(model.MaintenanceWindow[0].WeeksOfMonth), + } + } + + if err := client.CreateOrUpdateThenPoll(ctx, id, param); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r ExadataInfraResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + + client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudExadataInfrastructures + id, err := cloudexadatainfrastructures.ParseCloudExadataInfrastructureID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model ExadataInfraResourceModel + if err = metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding err: %+v", err) + } + + existing, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving exists when updating: +%v", *id) + } + if existing.Model == nil && existing.Model.Properties == nil { + return fmt.Errorf("retrieving as nil when updating for %v", *id) + } + + if metadata.ResourceData.HasChange("tags") { + update := &cloudexadatainfrastructures.CloudExadataInfrastructureUpdate{ + Tags: tags.Expand(model.Tags), + } + err = client.UpdateThenPoll(ctx, *id, *update) + if err != nil { + return fmt.Errorf("updating %s: %v", id, err) + } + } else if metadata.ResourceData.HasChangesExcept("tags") { + return fmt.Errorf("only `tags` currently support updates") + } + return nil + }, + } +} + +func (ExadataInfraResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + id, err := cloudexadatainfrastructures.ParseCloudExadataInfrastructureID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudExadataInfrastructures + result, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(result.HttpResponse) { + return metadata.MarkAsGone(id) + } + return err + } + + if result.Model == nil { + return fmt.Errorf("retrieving %s got nil model", id) + } + var output ExadataInfraResourceModel + + output.CustomerContacts = ConvertCustomerContactsToInternalModel(result.Model.Properties.CustomerContacts) + output.Name = pointer.ToString(result.Model.Name) + output.Location = result.Model.Location + output.Zones = result.Model.Zones + output.ResourceGroupName = id.ResourceGroupName + output.Tags = utils.FlattenPtrMapStringString(result.Model.Tags) + prop := result.Model.Properties + output.ComputeCount = pointer.From(prop.ComputeCount) + output.DisplayName = prop.DisplayName + output.StorageCount = pointer.From(prop.StorageCount) + output.Shape = prop.Shape + output.MaintenanceWindow = ConvertMaintenanceWindowToInternalModel(prop.MaintenanceWindow) + + return metadata.Encode(&output) + }, + } +} + +func (ExadataInfraResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudExadataInfrastructures + + id, err := cloudexadatainfrastructures.ParseCloudExadataInfrastructureID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if err = client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (ExadataInfraResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return cloudexadatainfrastructures.ValidateCloudExadataInfrastructureID +} diff --git a/internal/services/oracledatabase/exadata_infrastructure_resource_test.go b/internal/services/oracledatabase/exadata_infrastructure_resource_test.go new file mode 100644 index 000000000000..9b912d8f5635 --- /dev/null +++ b/internal/services/oracledatabase/exadata_infrastructure_resource_test.go @@ -0,0 +1,210 @@ +// Copyright © 2024, Oracle and/or its affiliates. All rights reserved + +package oracledatabase_test + +import ( + "context" + "fmt" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracledatabase" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type ExadataInfraResource struct{} + +func (a ExadataInfraResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := cloudexadatainfrastructures.ParseCloudExadataInfrastructureID(state.ID) + if err != nil { + return nil, err + } + resp, err := client.OracleDatabase.OracleDatabaseClient.CloudExadataInfrastructures.Get(ctx, *id) + if err != nil { + return nil, fmt.Errorf("retrieving Exadata Infrastructure %s: %+v", id, err) + } + return utils.Bool(resp.Model != nil), nil +} + +func (a ExadataInfraResource) Destroy(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := cloudexadatainfrastructures.ParseCloudExadataInfrastructureID(state.ID) + if err != nil { + return nil, err + } + if _, err := client.OracleDatabase.OracleDatabaseClient.CloudExadataInfrastructures.Delete(ctx, *id); err != nil { + return nil, fmt.Errorf("deleting Exadata Infrastructure %s: %+v", id, err) + } + return utils.Bool(true), nil +} + +func TestExaInfra_basic(t *testing.T) { + data := acceptance.BuildTestData(t, oracledatabase.ExadataInfraResource{}.ResourceType(), "test") + r := ExadataInfraResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestExaInfra_allFields(t *testing.T) { + data := acceptance.BuildTestData(t, oracledatabase.ExadataInfraResource{}.ResourceType(), "test") + r := ExadataInfraResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.allFields(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestExaInfra_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, oracledatabase.ExadataInfraResource{}.ResourceType(), "test") + r := ExadataInfraResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestExaInfra_update(t *testing.T) { + data := acceptance.BuildTestData(t, oracledatabase.ExadataInfraResource{}.ResourceType(), "test") + r := ExadataInfraResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (a ExadataInfraResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` + +%s + +resource "azurerm_oracledatabase_exadata_infrastructure" "test" { + name = "OFakeacctest%[2]d" + location = "%[3]s" + resource_group_name = azurerm_resource_group.test.name + compute_count = "2" + display_name = "OFakeacctest%[2]d" + shape = "Exadata.X9M" + storage_count = "3" + zones = ["3"] +} +`, a.template(data), data.RandomInteger, data.Locations.Primary) +} + +func (a ExadataInfraResource) allFields(data acceptance.TestData) string { + return fmt.Sprintf(` + +%s + +resource "azurerm_oracledatabase_exadata_infrastructure" "test" { + name = "OFakeacctest%[2]d" + location = "%[3]s" + resource_group_name = azurerm_resource_group.test.name + compute_count = "2" + display_name = "OFakeacctest%[2]d" + shape = "Exadata.X9M" + storage_count = "3" + zones = ["3"] + customer_contacts = ["test@test.com"] + maintenance_window { + custom_action_timeout_in_mins = 0 + days_of_week = ["Monday"] + hours_of_day = [1] + is_custom_action_timeout_enabled = false + is_monthly_patching_enabled = true + months = ["January"] + weeks_of_month = [2] + lead_time_in_weeks = 1 + patching_mode = "Rolling" + preference = "NoPreference" + } + tags = { + test = "testTag1" + } +} +`, a.template(data), data.RandomInteger, data.Locations.Primary) +} + +func (a ExadataInfraResource) update(data acceptance.TestData) string { + return fmt.Sprintf(` + +%s + +resource "azurerm_oracledatabase_exadata_infrastructure" "test" { + name = "OFakeacctest%[2]d" + location = "%[3]s" + resource_group_name = azurerm_resource_group.test.name + compute_count = "2" + display_name = "OFakeacctest%[2]d" + shape = "Exadata.X9M" + storage_count = "3" + zones = ["3"] + tags = { + test = "testTag1" + } +} +`, a.template(data), data.RandomInteger, data.Locations.Primary) +} + +func (a ExadataInfraResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_oracledatabase_exadata_infrastructure" "import" { + name = azurerm_oracledatabase_exadata_infrastructure.test.name + location = azurerm_oracledatabase_exadata_infrastructure.test.location + resource_group_name = azurerm_oracledatabase_exadata_infrastructure.test.resource_group_name + compute_count = azurerm_oracledatabase_exadata_infrastructure.test.compute_count + display_name = azurerm_oracledatabase_exadata_infrastructure.test.display_name + shape = azurerm_oracledatabase_exadata_infrastructure.test.shape + storage_count = azurerm_oracledatabase_exadata_infrastructure.test.storage_count + zones = azurerm_oracledatabase_exadata_infrastructure.test.zones +} +`, a.basic(data)) +} + +func (a ExadataInfraResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +data "azurerm_client_config" "current" {} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%[1]d" + location = "%[2]s" +} +`, data.RandomInteger, data.Locations.Primary, data.RandomString) +} diff --git a/internal/services/oracledatabase/registration.go b/internal/services/oracledatabase/registration.go new file mode 100644 index 000000000000..7182087c3cf5 --- /dev/null +++ b/internal/services/oracledatabase/registration.go @@ -0,0 +1,37 @@ +// Copyright © 2024, Oracle and/or its affiliates. All rights reserved + +package oracledatabase + +import ( + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" +) + +type Registration struct{} + +var ( + _ sdk.TypedServiceRegistration = Registration{} +) + +func (r Registration) DataSources() []sdk.DataSource { + return []sdk.DataSource{ + ExadataInfraDataSource{}, + } +} + +func (r Registration) Resources() []sdk.Resource { + return []sdk.Resource{ + ExadataInfraResource{}, + } +} + +// Name is the name of this Service +func (r Registration) Name() string { + return "App Service" +} + +// WebsiteCategories returns a list of categories which can be used for the sidebar +func (r Registration) WebsiteCategories() []string { + return []string{ + "App Service", + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/README.md new file mode 100644 index 000000000000..f010f0e91ded --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups` Documentation + +The `autonomousdatabasebackups` SDK allows for interaction with the Azure Resource Manager Service `oracledatabase` (API Version `2024-06-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/2024-06-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", "autonomousDatabaseValue", "autonomousDatabaseBackupValue") + +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", "autonomousDatabaseValue", "autonomousDatabaseBackupValue") + +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", "autonomousDatabaseValue", "autonomousDatabaseBackupValue") + +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.ListByAutonomousDatabase` + +```go +ctx := context.TODO() +id := autonomousdatabasebackups.NewAutonomousDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseValue") + +// alternatively `client.ListByAutonomousDatabase(ctx, id)` can be used to do batched pagination +items, err := client.ListByAutonomousDatabaseComplete(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", "autonomousDatabaseValue", "autonomousDatabaseBackupValue") + +payload := autonomousdatabasebackups.AutonomousDatabaseBackupUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/client.go new file mode 100644 index 000000000000..d28226c6c840 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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.NewResourceManagerClient(sdkApi, "autonomousdatabasebackups", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AutonomousDatabaseBackupsClient: %+v", err) + } + + return &AutonomousDatabaseBackupsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/constants.go new file mode 100644 index 000000000000..95360d30614a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/id_autonomousdatabase.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/id_autonomousdatabase.go new file mode 100644 index 000000000000..ac451719a55d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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", "autonomousDatabaseValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/id_autonomousdatabasebackup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/id_autonomousdatabasebackup.go new file mode 100644 index 000000000000..57cf278d0d78 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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", "autonomousDatabaseValue"), + resourceids.StaticSegment("staticAutonomousDatabaseBackups", "autonomousDatabaseBackups", "autonomousDatabaseBackups"), + resourceids.UserSpecifiedSegment("autonomousDatabaseBackupName", "autonomousDatabaseBackupValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/method_createorupdate.go new file mode 100644 index 000000000000..81b5ea2dbcec --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/method_delete.go new file mode 100644 index 000000000000..4af10c5bf28f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/method_get.go new file mode 100644 index 000000000000..ea57ba70411f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/method_get.go @@ -0,0 +1,54 @@ +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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/method_listbyautonomousdatabase.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/method_listbyautonomousdatabase.go new file mode 100644 index 000000000000..38df32dfe02c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/method_listbyautonomousdatabase.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 ListByAutonomousDatabaseOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AutonomousDatabaseBackup +} + +type ListByAutonomousDatabaseCompleteResult struct { + LatestHttpResponse *http.Response + Items []AutonomousDatabaseBackup +} + +type ListByAutonomousDatabaseCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByAutonomousDatabaseCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByAutonomousDatabase ... +func (c AutonomousDatabaseBackupsClient) ListByAutonomousDatabase(ctx context.Context, id AutonomousDatabaseId) (result ListByAutonomousDatabaseOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByAutonomousDatabaseCustomPager{}, + 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 +} + +// ListByAutonomousDatabaseComplete retrieves all the results into a single object +func (c AutonomousDatabaseBackupsClient) ListByAutonomousDatabaseComplete(ctx context.Context, id AutonomousDatabaseId) (ListByAutonomousDatabaseCompleteResult, error) { + return c.ListByAutonomousDatabaseCompleteMatchingPredicate(ctx, id, AutonomousDatabaseBackupOperationPredicate{}) +} + +// ListByAutonomousDatabaseCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AutonomousDatabaseBackupsClient) ListByAutonomousDatabaseCompleteMatchingPredicate(ctx context.Context, id AutonomousDatabaseId, predicate AutonomousDatabaseBackupOperationPredicate) (result ListByAutonomousDatabaseCompleteResult, err error) { + items := make([]AutonomousDatabaseBackup, 0) + + resp, err := c.ListByAutonomousDatabase(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 = ListByAutonomousDatabaseCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/method_update.go new file mode 100644 index 000000000000..e769ca8bab97 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/model_autonomousdatabasebackup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/model_autonomousdatabasebackup.go new file mode 100644 index 000000000000..d58ba310e225 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/model_autonomousdatabasebackupproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/model_autonomousdatabasebackupproperties.go new file mode 100644 index 000000000000..bb592faa99a7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/model_autonomousdatabasebackupupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/model_autonomousdatabasebackupupdate.go new file mode 100644 index 000000000000..4ccab72b0dc0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/model_autonomousdatabasebackupupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/model_autonomousdatabasebackupupdateproperties.go new file mode 100644 index 000000000000..cebcbe7eb157 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/model_autonomousdatabasebackupupdateproperties.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 AutonomousDatabaseBackupUpdateProperties struct { + RetentionPeriodInDays *int64 `json:"retentionPeriodInDays,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/predicates.go new file mode 100644 index 000000000000..ba62aa1ff05f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/version.go new file mode 100644 index 000000000000..3c5e45d7b471 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups/version.go @@ -0,0 +1,12 @@ +package autonomousdatabasebackups + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/autonomousdatabasebackups/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/README.md new file mode 100644 index 000000000000..ad086f941b1b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets` Documentation + +The `autonomousdatabasecharactersets` SDK allows for interaction with the Azure Resource Manager Service `oracledatabase` (API Version `2024-06-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/2024-06-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", "locationValue", "autonomousDatabaseCharacterSetValue") + +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", "locationValue") + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/client.go new file mode 100644 index 000000000000..ef4620ad8388 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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.NewResourceManagerClient(sdkApi, "autonomousdatabasecharactersets", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AutonomousDatabaseCharacterSetsClient: %+v", err) + } + + return &AutonomousDatabaseCharacterSetsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/id_autonomousdatabasecharacterset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/id_autonomousdatabasecharacterset.go new file mode 100644 index 000000000000..b9ac00fb4fe2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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", "locationValue"), + resourceids.StaticSegment("staticAutonomousDatabaseCharacterSets", "autonomousDatabaseCharacterSets", "autonomousDatabaseCharacterSets"), + resourceids.UserSpecifiedSegment("autonomousDatabaseCharacterSetName", "autonomousDatabaseCharacterSetValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/id_location.go new file mode 100644 index 000000000000..54fb13304a4c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/id_location.go @@ -0,0 +1,121 @@ +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(&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", "locationValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/method_get.go new file mode 100644 index 000000000000..e372685113de --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/method_get.go @@ -0,0 +1,54 @@ +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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/method_listbylocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/method_listbylocation.go new file mode 100644 index 000000000000..fed9644ac135 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/model_autonomousdatabasecharacterset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/model_autonomousdatabasecharacterset.go new file mode 100644 index 000000000000..6fa0b10b403b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/model_autonomousdatabasecharactersetproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/model_autonomousdatabasecharactersetproperties.go new file mode 100644 index 000000000000..901e37d3b140 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/predicates.go new file mode 100644 index 000000000000..248c5399d40f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/version.go new file mode 100644 index 000000000000..308cf1740559 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets/version.go @@ -0,0 +1,12 @@ +package autonomousdatabasecharactersets + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/autonomousdatabasecharactersets/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/README.md new file mode 100644 index 000000000000..eb59131ad18f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets` Documentation + +The `autonomousdatabasenationalcharactersets` SDK allows for interaction with the Azure Resource Manager Service `oracledatabase` (API Version `2024-06-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/2024-06-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", "locationValue", "autonomousDatabaseNationalCharacterSetValue") + +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", "locationValue") + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/client.go new file mode 100644 index 000000000000..0d61e0105a17 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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.NewResourceManagerClient(sdkApi, "autonomousdatabasenationalcharactersets", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AutonomousDatabaseNationalCharacterSetsClient: %+v", err) + } + + return &AutonomousDatabaseNationalCharacterSetsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/id_autonomousdatabasenationalcharacterset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/id_autonomousdatabasenationalcharacterset.go new file mode 100644 index 000000000000..62990b24a8ae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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", "locationValue"), + resourceids.StaticSegment("staticAutonomousDatabaseNationalCharacterSets", "autonomousDatabaseNationalCharacterSets", "autonomousDatabaseNationalCharacterSets"), + resourceids.UserSpecifiedSegment("autonomousDatabaseNationalCharacterSetName", "autonomousDatabaseNationalCharacterSetValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/id_location.go new file mode 100644 index 000000000000..d4c5968ec0d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/id_location.go @@ -0,0 +1,121 @@ +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(&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", "locationValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/method_get.go new file mode 100644 index 000000000000..f4ec84c1380d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/method_get.go @@ -0,0 +1,54 @@ +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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/method_listbylocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/method_listbylocation.go new file mode 100644 index 000000000000..98ab6421827a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/model_autonomousdatabasenationalcharacterset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/model_autonomousdatabasenationalcharacterset.go new file mode 100644 index 000000000000..1bf4f8d2c11c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/model_autonomousdatabasenationalcharactersetproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/model_autonomousdatabasenationalcharactersetproperties.go new file mode 100644 index 000000000000..075fdf79954a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/predicates.go new file mode 100644 index 000000000000..6dcbbef5c7b0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/version.go new file mode 100644 index 000000000000..1be761ae3edb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets/version.go @@ -0,0 +1,12 @@ +package autonomousdatabasenationalcharactersets + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/autonomousdatabasenationalcharactersets/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/README.md new file mode 100644 index 000000000000..21610575ab1e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/README.md @@ -0,0 +1,201 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases` Documentation + +The `autonomousdatabases` SDK allows for interaction with the Azure Resource Manager Service `oracledatabase` (API Version `2024-06-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/2024-06-01/autonomousdatabases" +``` + + +### Client Initialization + +```go +client := autonomousdatabases.NewAutonomousDatabasesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AutonomousDatabasesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := autonomousdatabases.NewAutonomousDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "autonomousDatabaseValue") + +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", "autonomousDatabaseValue") + +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", "autonomousDatabaseValue") + +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", "autonomousDatabaseValue") + +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", "autonomousDatabaseValue") + +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", "autonomousDatabaseValue") + +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", "autonomousDatabaseValue") + +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", "autonomousDatabaseValue") + +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", "autonomousDatabaseValue") + +payload := autonomousdatabases.AutonomousDatabaseUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/client.go new file mode 100644 index 000000000000..d9e2e2e10961 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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.NewResourceManagerClient(sdkApi, "autonomousdatabases", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AutonomousDatabasesClient: %+v", err) + } + + return &AutonomousDatabasesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/constants.go new file mode 100644 index 000000000000..22b9ad59574d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/constants.go @@ -0,0 +1,1264 @@ +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 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" + DataBaseTypeRegular DataBaseType = "Regular" +) + +func PossibleValuesForDataBaseType() []string { + return []string{ + string(DataBaseTypeClone), + 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, + "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 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/id_autonomousdatabase.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/id_autonomousdatabase.go new file mode 100644 index 000000000000..3bc8c7eb3750 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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", "autonomousDatabaseValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_createorupdate.go new file mode 100644 index 000000000000..7ed7016c55f4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_delete.go new file mode 100644 index 000000000000..b2629b1ffd3e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_failover.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_failover.go new file mode 100644 index 000000000000..ddad38876884 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_generatewallet.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_generatewallet.go new file mode 100644 index 000000000000..009eacf55214 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_generatewallet.go @@ -0,0 +1,59 @@ +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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_get.go new file mode 100644 index 000000000000..c95b6d3808ac --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_get.go @@ -0,0 +1,54 @@ +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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_listbyresourcegroup.go new file mode 100644 index 000000000000..fb66603459bf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_listbysubscription.go new file mode 100644 index 000000000000..1cfc10b04884 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_restore.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_restore.go new file mode 100644 index 000000000000..c6e860c8c2d0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_shrink.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_shrink.go new file mode 100644 index 000000000000..baed1bbf367a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_switchover.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_switchover.go new file mode 100644 index 000000000000..8b21a43f8512 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/method_update.go new file mode 100644 index 000000000000..dea97562d892 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_allconnectionstringtype.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_allconnectionstringtype.go new file mode 100644 index 000000000000..a0c89f0608f1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_apexdetailstype.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_apexdetailstype.go new file mode 100644 index 000000000000..420d585f5d19 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabase.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabase.go new file mode 100644 index 000000000000..b30cc01b0787 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabase.go @@ -0,0 +1,52 @@ +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 { + type alias AutonomousDatabase + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into AutonomousDatabase: %+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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabasebaseproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabasebaseproperties.go new file mode 100644 index 000000000000..90c25e5dff6f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabasebaseproperties.go @@ -0,0 +1,61 @@ +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 { +} + +// 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 { + Type string + Values map[string]interface{} +} + +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) + } + + value, ok := temp["dataBaseType"].(string) + if !ok { + return nil, nil + } + + 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, "Regular") { + var out AutonomousDatabaseProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AutonomousDatabaseProperties: %+v", err) + } + return out, nil + } + + out := RawAutonomousDatabaseBasePropertiesImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabasecloneproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabasecloneproperties.go new file mode 100644 index 000000000000..5b5fd9fdbe93 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabasecloneproperties.go @@ -0,0 +1,173 @@ +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"` + 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"` + Role *RoleType `json:"role,omitempty"` + ScheduledOperations *ScheduledOperationsType `json:"scheduledOperations,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"` + 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 (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) 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabaseproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabaseproperties.go new file mode 100644 index 000000000000..9a10d4134bc8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabaseproperties.go @@ -0,0 +1,165 @@ +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"` + 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"` + Role *RoleType `json:"role,omitempty"` + ScheduledOperations *ScheduledOperationsType `json:"scheduledOperations,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"` + 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 (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) 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabasestandbysummary.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabasestandbysummary.go new file mode 100644 index 000000000000..484d3578c682 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabaseupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabaseupdate.go new file mode 100644 index 000000000000..d4087756731f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabaseupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabaseupdateproperties.go new file mode 100644 index 000000000000..d3acaf868937 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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"` + ScheduledOperations *ScheduledOperationsTypeUpdate `json:"scheduledOperations,omitempty"` + WhitelistedIPs *[]string `json:"whitelistedIps,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabasewalletfile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabasewalletfile.go new file mode 100644 index 000000000000..3db16ef5d70f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_autonomousdatabasewalletfile.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 AutonomousDatabaseWalletFile struct { + WalletFiles string `json:"walletFiles"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_connectionstringtype.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_connectionstringtype.go new file mode 100644 index 000000000000..044b93601aad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_connectionurltype.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_connectionurltype.go new file mode 100644 index 000000000000..0c2c730e4cfb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_customercontact.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_customercontact.go new file mode 100644 index 000000000000..f0cb840d6372 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_customercontact.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 CustomerContact struct { + Email string `json:"email"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_dayofweek.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_dayofweek.go new file mode 100644 index 000000000000..f3a881a70d0b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_dayofweekupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_dayofweekupdate.go new file mode 100644 index 000000000000..3a2293955d2d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_generateautonomousdatabasewalletdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_generateautonomousdatabasewalletdetails.go new file mode 100644 index 000000000000..1ac191ea68dc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_longtermbackupscheduledetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_longtermbackupscheduledetails.go new file mode 100644 index 000000000000..3219641f573b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_peerdbdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_peerdbdetails.go new file mode 100644 index 000000000000..8d223d8e5050 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_peerdbdetails.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 PeerDbDetails struct { + PeerDbId *string `json:"peerDbId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_profiletype.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_profiletype.go new file mode 100644 index 000000000000..23033b333c94 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_restoreautonomousdatabasedetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_restoreautonomousdatabasedetails.go new file mode 100644 index 000000000000..62563f3bd971 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_scheduledoperationstype.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_scheduledoperationstype.go new file mode 100644 index 000000000000..c8ddec8547e4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_scheduledoperationstypeupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/model_scheduledoperationstypeupdate.go new file mode 100644 index 000000000000..d0ce963fa635 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/predicates.go new file mode 100644 index 000000000000..30749532d68d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/predicates.go @@ -0,0 +1,32 @@ +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 AutonomousDatabaseOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p AutonomousDatabaseOperationPredicate) Matches(input AutonomousDatabase) 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/version.go new file mode 100644 index 000000000000..bb55880a3d80 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases/version.go @@ -0,0 +1,12 @@ +package autonomousdatabases + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/autonomousdatabases/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/README.md new file mode 100644 index 000000000000..0dab6f05679a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions` Documentation + +The `autonomousdatabaseversions` SDK allows for interaction with the Azure Resource Manager Service `oracledatabase` (API Version `2024-06-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/2024-06-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", "locationValue", "autonomousDbVersionValue") + +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", "locationValue") + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/client.go new file mode 100644 index 000000000000..a456628fcc06 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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.NewResourceManagerClient(sdkApi, "autonomousdatabaseversions", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AutonomousDatabaseVersionsClient: %+v", err) + } + + return &AutonomousDatabaseVersionsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/constants.go new file mode 100644 index 000000000000..f4d7200f6ed0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/id_autonomousdbversion.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/id_autonomousdbversion.go new file mode 100644 index 000000000000..ea983d4be6e6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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", "locationValue"), + resourceids.StaticSegment("staticAutonomousDbVersions", "autonomousDbVersions", "autonomousDbVersions"), + resourceids.UserSpecifiedSegment("autonomousDbVersionName", "autonomousDbVersionValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/id_location.go new file mode 100644 index 000000000000..9f10f98bb92c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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", "locationValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/method_get.go new file mode 100644 index 000000000000..1e73740c6d8f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/method_get.go @@ -0,0 +1,54 @@ +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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/method_listbylocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/method_listbylocation.go new file mode 100644 index 000000000000..3568f7d2e003 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/model_autonomousdbversion.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/model_autonomousdbversion.go new file mode 100644 index 000000000000..d637e754ddfc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/model_autonomousdbversionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/model_autonomousdbversionproperties.go new file mode 100644 index 000000000000..0a7cad672e79 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/predicates.go new file mode 100644 index 000000000000..87d67558b5f7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/version.go new file mode 100644 index 000000000000..b4c1d6d8dfe7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions/version.go @@ -0,0 +1,12 @@ +package autonomousdatabaseversions + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/autonomousdatabaseversions/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/client.go new file mode 100644 index 000000000000..779de7918c4e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/client.go @@ -0,0 +1,163 @@ +package v2024_06_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/2024-06-01/autonomousdatabasebackups" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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 + DnsPrivateViews *dnsprivateviews.DnsPrivateViewsClient + DnsPrivateZones *dnsprivatezones.DnsPrivateZonesClient + GiVersions *giversions.GiVersionsClient + OracleSubscriptions *oraclesubscriptions.OracleSubscriptionsClient + 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) + + 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) + + giVersionsClient, err := giversions.NewGiVersionsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building GiVersions client: %+v", err) + } + configureFunc(giVersionsClient.Client) + + oracleSubscriptionsClient, err := oraclesubscriptions.NewOracleSubscriptionsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building OracleSubscriptions client: %+v", err) + } + configureFunc(oracleSubscriptionsClient.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, + DnsPrivateViews: dnsPrivateViewsClient, + DnsPrivateZones: dnsPrivateZonesClient, + GiVersions: giVersionsClient, + OracleSubscriptions: oracleSubscriptionsClient, + SystemVersions: systemVersionsClient, + VirtualNetworkAddresses: virtualNetworkAddressesClient, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/README.md new file mode 100644 index 000000000000..dcf8b7af55ab --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/README.md @@ -0,0 +1,129 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures` Documentation + +The `cloudexadatainfrastructures` SDK allows for interaction with the Azure Resource Manager Service `oracledatabase` (API Version `2024-06-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/2024-06-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", "cloudExadataInfrastructureValue") + +if err := client.AddStorageCapacityThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `CloudExadataInfrastructuresClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := cloudexadatainfrastructures.NewCloudExadataInfrastructureID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudExadataInfrastructureValue") + +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", "cloudExadataInfrastructureValue") + +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", "cloudExadataInfrastructureValue") + +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", "cloudExadataInfrastructureValue") + +payload := cloudexadatainfrastructures.CloudExadataInfrastructureUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/client.go new file mode 100644 index 000000000000..8c55d2b0aa51 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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.NewResourceManagerClient(sdkApi, "cloudexadatainfrastructures", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CloudExadataInfrastructuresClient: %+v", err) + } + + return &CloudExadataInfrastructuresClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/constants.go new file mode 100644 index 000000000000..1baad8c6fddb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/constants.go @@ -0,0 +1,322 @@ +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 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/id_cloudexadatainfrastructure.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/id_cloudexadatainfrastructure.go new file mode 100644 index 000000000000..64edbb20ca1f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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", "cloudExadataInfrastructureValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/method_addstoragecapacity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/method_addstoragecapacity.go new file mode 100644 index 000000000000..7b5bda2d476a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/method_createorupdate.go new file mode 100644 index 000000000000..75af32ddc646 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/method_delete.go new file mode 100644 index 000000000000..f8032ba6b03a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/method_get.go new file mode 100644 index 000000000000..f4c9c8b4e213 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/method_get.go @@ -0,0 +1,54 @@ +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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/method_listbyresourcegroup.go new file mode 100644 index 000000000000..2143b1109597 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/method_listbysubscription.go new file mode 100644 index 000000000000..a6d4a182303e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/method_update.go new file mode 100644 index 000000000000..54e2aa254c5c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_cloudexadatainfrastructure.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_cloudexadatainfrastructure.go new file mode 100644 index 000000000000..93f4463e84f0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_cloudexadatainfrastructureproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_cloudexadatainfrastructureproperties.go new file mode 100644 index 000000000000..e2cae85db869 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_cloudexadatainfrastructureproperties.go @@ -0,0 +1,38 @@ +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"` + CpuCount *int64 `json:"cpuCount,omitempty"` + CustomerContacts *[]CustomerContact `json:"customerContacts,omitempty"` + DataStorageSizeInTbs *float64 `json:"dataStorageSizeInTbs,omitempty"` + DbNodeStorageSizeInGbs *int64 `json:"dbNodeStorageSizeInGbs,omitempty"` + DbServerVersion *string `json:"dbServerVersion,omitempty"` + DisplayName string `json:"displayName"` + EstimatedPatchingTime *EstimatedPatchingTime `json:"estimatedPatchingTime,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"` + StorageServerVersion *string `json:"storageServerVersion,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + TotalStorageSizeInGbs *int64 `json:"totalStorageSizeInGbs,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_cloudexadatainfrastructureupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_cloudexadatainfrastructureupdate.go new file mode 100644 index 000000000000..606eb24be431 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_cloudexadatainfrastructureupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_cloudexadatainfrastructureupdateproperties.go new file mode 100644 index 000000000000..d18c7da0d018 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_customercontact.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_customercontact.go new file mode 100644 index 000000000000..ab32a4c955da --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_dayofweek.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_dayofweek.go new file mode 100644 index 000000000000..0df53b97a8f3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_estimatedpatchingtime.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_estimatedpatchingtime.go new file mode 100644 index 000000000000..52cd0d6fa9e2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_maintenancewindow.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_maintenancewindow.go new file mode 100644 index 000000000000..b9d485dcf628 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_month.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/model_month.go new file mode 100644 index 000000000000..9c0b630b8afa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/predicates.go new file mode 100644 index 000000000000..f34f99354072 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/predicates.go @@ -0,0 +1,32 @@ +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 CloudExadataInfrastructureOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p CloudExadataInfrastructureOperationPredicate) Matches(input CloudExadataInfrastructure) 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/version.go new file mode 100644 index 000000000000..5296ca89a860 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures/version.go @@ -0,0 +1,12 @@ +package cloudexadatainfrastructures + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/cloudexadatainfrastructures/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/README.md new file mode 100644 index 000000000000..408b369e0f20 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/README.md @@ -0,0 +1,172 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters` Documentation + +The `cloudvmclusters` SDK allows for interaction with the Azure Resource Manager Service `oracledatabase` (API Version `2024-06-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/2024-06-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", "cloudVmClusterValue") + +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", "cloudVmClusterValue") + +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", "cloudVmClusterValue") + +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", "cloudVmClusterValue") + +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", "cloudVmClusterValue") + +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", "cloudVmClusterValue") + +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", "cloudVmClusterValue") + +payload := cloudvmclusters.CloudVMClusterUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/client.go new file mode 100644 index 000000000000..7bc1de893938 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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.NewResourceManagerClient(sdkApi, "cloudvmclusters", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CloudVMClustersClient: %+v", err) + } + + return &CloudVMClustersClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/constants.go new file mode 100644 index 000000000000..5315231510dc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/constants.go @@ -0,0 +1,295 @@ +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 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 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/id_cloudvmcluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/id_cloudvmcluster.go new file mode 100644 index 000000000000..1398a3825d31 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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 V M 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 V M 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 V M 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 V M 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", "cloudVmClusterValue"), + } +} + +// String returns a human-readable description of this Cloud V M 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 V M Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_addvms.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_addvms.go new file mode 100644 index 000000000000..f83b1419e295 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_createorupdate.go new file mode 100644 index 000000000000..d4006bf71a37 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_delete.go new file mode 100644 index 000000000000..d8297753935c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_get.go new file mode 100644 index 000000000000..3b1646ab44cf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_get.go @@ -0,0 +1,54 @@ +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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_listbyresourcegroup.go new file mode 100644 index 000000000000..c6f023cd9174 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_listbysubscription.go new file mode 100644 index 000000000000..dfd4dafe7340 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_listprivateipaddresses.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_listprivateipaddresses.go new file mode 100644 index 000000000000..d0a7fbe2ebb3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_listprivateipaddresses.go @@ -0,0 +1,59 @@ +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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_removevms.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_removevms.go new file mode 100644 index 000000000000..6b285c4817a3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/method_update.go new file mode 100644 index 000000000000..b629960e83da --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_addremovedbnode.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_addremovedbnode.go new file mode 100644 index 000000000000..4339e88ab717 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_cloudvmcluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_cloudvmcluster.go new file mode 100644 index 000000000000..794313d5e119 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_cloudvmclusterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_cloudvmclusterproperties.go new file mode 100644 index 000000000000..73a09d1f15d1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_cloudvmclusterproperties.go @@ -0,0 +1,73 @@ +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"` + 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"` + 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"` + 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_cloudvmclusterupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_cloudvmclusterupdate.go new file mode 100644 index 000000000000..9c45a82caab1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_cloudvmclusterupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_cloudvmclusterupdateproperties.go new file mode 100644 index 000000000000..b6499789da89 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_cloudvmclusterupdateproperties.go @@ -0,0 +1,18 @@ +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"` + 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_datacollectionoptions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_datacollectionoptions.go new file mode 100644 index 000000000000..df3ddfd596d8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_dbiormconfig.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_dbiormconfig.go new file mode 100644 index 000000000000..3ec47756c259 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_exadataiormconfig.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_exadataiormconfig.go new file mode 100644 index 000000000000..07899f1e94da --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_nsgcidr.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_nsgcidr.go new file mode 100644 index 000000000000..7123fc5a165b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_portrange.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_portrange.go new file mode 100644 index 000000000000..a3906443e6af --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_privateipaddressesfilter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_privateipaddressesfilter.go new file mode 100644 index 000000000000..4986845bb03f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_privateipaddressproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/model_privateipaddressproperties.go new file mode 100644 index 000000000000..35ac2a7af423 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/predicates.go new file mode 100644 index 000000000000..174e49c11caf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/predicates.go @@ -0,0 +1,32 @@ +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 CloudVMClusterOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p CloudVMClusterOperationPredicate) Matches(input CloudVMCluster) 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/version.go new file mode 100644 index 000000000000..75e614772c81 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters/version.go @@ -0,0 +1,12 @@ +package cloudvmclusters + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/cloudvmclusters/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/README.md new file mode 100644 index 000000000000..8969a93de41f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/README.md @@ -0,0 +1,70 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes` Documentation + +The `dbnodes` SDK allows for interaction with the Azure Resource Manager Service `oracledatabase` (API Version `2024-06-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/2024-06-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", "cloudVmClusterValue", "dbNodeValue") + +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", "cloudVmClusterValue", "dbNodeValue") + +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.ListByCloudVMCluster` + +```go +ctx := context.TODO() +id := dbnodes.NewCloudVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterValue") + +// alternatively `client.ListByCloudVMCluster(ctx, id)` can be used to do batched pagination +items, err := client.ListByCloudVMClusterComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/client.go new file mode 100644 index 000000000000..ad2d02fbb1f9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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.NewResourceManagerClient(sdkApi, "dbnodes", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DbNodesClient: %+v", err) + } + + return &DbNodesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/constants.go new file mode 100644 index 000000000000..f0304b7d9619 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/id_cloudvmcluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/id_cloudvmcluster.go new file mode 100644 index 000000000000..0b78088cce58 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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 V M 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 V M 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 V M 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 V M 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", "cloudVmClusterValue"), + } +} + +// String returns a human-readable description of this Cloud V M 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 V M Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/id_dbnode.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/id_dbnode.go new file mode 100644 index 000000000000..e8422bcdfc8a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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", "cloudVmClusterValue"), + resourceids.StaticSegment("staticDbNodes", "dbNodes", "dbNodes"), + resourceids.UserSpecifiedSegment("dbNodeName", "dbNodeValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/method_action.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/method_action.go new file mode 100644 index 000000000000..5183df9c35c7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/method_get.go new file mode 100644 index 000000000000..04a526272456 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/method_get.go @@ -0,0 +1,54 @@ +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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/method_listbycloudvmcluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/method_listbycloudvmcluster.go new file mode 100644 index 000000000000..f610bea1c1d4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/method_listbycloudvmcluster.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 ListByCloudVMClusterOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DbNode +} + +type ListByCloudVMClusterCompleteResult struct { + LatestHttpResponse *http.Response + Items []DbNode +} + +type ListByCloudVMClusterCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByCloudVMClusterCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByCloudVMCluster ... +func (c DbNodesClient) ListByCloudVMCluster(ctx context.Context, id CloudVMClusterId) (result ListByCloudVMClusterOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByCloudVMClusterCustomPager{}, + 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 +} + +// ListByCloudVMClusterComplete retrieves all the results into a single object +func (c DbNodesClient) ListByCloudVMClusterComplete(ctx context.Context, id CloudVMClusterId) (ListByCloudVMClusterCompleteResult, error) { + return c.ListByCloudVMClusterCompleteMatchingPredicate(ctx, id, DbNodeOperationPredicate{}) +} + +// ListByCloudVMClusterCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DbNodesClient) ListByCloudVMClusterCompleteMatchingPredicate(ctx context.Context, id CloudVMClusterId, predicate DbNodeOperationPredicate) (result ListByCloudVMClusterCompleteResult, err error) { + items := make([]DbNode, 0) + + resp, err := c.ListByCloudVMCluster(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 = ListByCloudVMClusterCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/model_dbnode.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/model_dbnode.go new file mode 100644 index 000000000000..fb43a32d89f7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/model_dbnodeaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/model_dbnodeaction.go new file mode 100644 index 000000000000..c73027704e88 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/model_dbnodeproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/model_dbnodeproperties.go new file mode 100644 index 000000000000..57c6546805b9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/model_dbnodeproperties.go @@ -0,0 +1,72 @@ +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,omitempty"` + FaultDomain *string `json:"faultDomain,omitempty"` + HostIPId *string `json:"hostIpId,omitempty"` + Hostname *string `json:"hostname,omitempty"` + LifecycleDetails *string `json:"lifecycleDetails,omitempty"` + LifecycleState *DbNodeProvisioningState `json:"lifecycleState,omitempty"` + MaintenanceType *DbNodeMaintenanceType `json:"maintenanceType,omitempty"` + MemorySizeInGbs *int64 `json:"memorySizeInGbs,omitempty"` + Ocid *string `json:"ocid,omitempty"` + ProvisioningState *ResourceProvisioningState `json:"provisioningState,omitempty"` + SoftwareStorageSizeInGb *int64 `json:"softwareStorageSizeInGb,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + TimeMaintenanceWindowEnd *string `json:"timeMaintenanceWindowEnd,omitempty"` + TimeMaintenanceWindowStart *string `json:"timeMaintenanceWindowStart,omitempty"` + Vnic2Id *string `json:"vnic2Id,omitempty"` + VnicId *string `json:"vnicId,omitempty"` +} + +func (o *DbNodeProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/predicates.go new file mode 100644 index 000000000000..d8b48325d587 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/version.go new file mode 100644 index 000000000000..9e4fa8962fb4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes/version.go @@ -0,0 +1,12 @@ +package dbnodes + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/dbnodes/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/README.md new file mode 100644 index 000000000000..d49cab85097d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers` Documentation + +The `dbservers` SDK allows for interaction with the Azure Resource Manager Service `oracledatabase` (API Version `2024-06-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/2024-06-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", "cloudExadataInfrastructureValue", "dbServerValue") + +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.ListByCloudExadataInfrastructure` + +```go +ctx := context.TODO() +id := dbservers.NewCloudExadataInfrastructureID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudExadataInfrastructureValue") + +// alternatively `client.ListByCloudExadataInfrastructure(ctx, id)` can be used to do batched pagination +items, err := client.ListByCloudExadataInfrastructureComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/client.go new file mode 100644 index 000000000000..76eb2495be80 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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.NewResourceManagerClient(sdkApi, "dbservers", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DbServersClient: %+v", err) + } + + return &DbServersClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/constants.go new file mode 100644 index 000000000000..16d6ef78fb2e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/constants.go @@ -0,0 +1,154 @@ +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 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/id_cloudexadatainfrastructure.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/id_cloudexadatainfrastructure.go new file mode 100644 index 000000000000..3507447b71e2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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", "cloudExadataInfrastructureValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/id_dbserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/id_dbserver.go new file mode 100644 index 000000000000..6fa4f9993f10 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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", "cloudExadataInfrastructureValue"), + resourceids.StaticSegment("staticDbServers", "dbServers", "dbServers"), + resourceids.UserSpecifiedSegment("dbServerName", "dbServerValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/method_get.go new file mode 100644 index 000000000000..acb90a24d7ed --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/method_get.go @@ -0,0 +1,54 @@ +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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/method_listbycloudexadatainfrastructure.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/method_listbycloudexadatainfrastructure.go new file mode 100644 index 000000000000..7440cdef40af --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/method_listbycloudexadatainfrastructure.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 ListByCloudExadataInfrastructureOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DbServer +} + +type ListByCloudExadataInfrastructureCompleteResult struct { + LatestHttpResponse *http.Response + Items []DbServer +} + +type ListByCloudExadataInfrastructureCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByCloudExadataInfrastructureCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByCloudExadataInfrastructure ... +func (c DbServersClient) ListByCloudExadataInfrastructure(ctx context.Context, id CloudExadataInfrastructureId) (result ListByCloudExadataInfrastructureOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByCloudExadataInfrastructureCustomPager{}, + 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 +} + +// ListByCloudExadataInfrastructureComplete retrieves all the results into a single object +func (c DbServersClient) ListByCloudExadataInfrastructureComplete(ctx context.Context, id CloudExadataInfrastructureId) (ListByCloudExadataInfrastructureCompleteResult, error) { + return c.ListByCloudExadataInfrastructureCompleteMatchingPredicate(ctx, id, DbServerOperationPredicate{}) +} + +// ListByCloudExadataInfrastructureCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DbServersClient) ListByCloudExadataInfrastructureCompleteMatchingPredicate(ctx context.Context, id CloudExadataInfrastructureId, predicate DbServerOperationPredicate) (result ListByCloudExadataInfrastructureCompleteResult, err error) { + items := make([]DbServer, 0) + + resp, err := c.ListByCloudExadataInfrastructure(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 = ListByCloudExadataInfrastructureCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/model_dbserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/model_dbserver.go new file mode 100644 index 000000000000..a88571f86139 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/model_dbserverpatchingdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/model_dbserverpatchingdetails.go new file mode 100644 index 000000000000..5bb65512c64a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/model_dbserverproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/model_dbserverproperties.go new file mode 100644 index 000000000000..39df4cede8cc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/model_dbserverproperties.go @@ -0,0 +1,45 @@ +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"` + 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/predicates.go new file mode 100644 index 000000000000..dfcc35d7ef63 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/version.go new file mode 100644 index 000000000000..f369bd54279a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers/version.go @@ -0,0 +1,12 @@ +package dbservers + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/dbservers/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/README.md new file mode 100644 index 000000000000..23f0eac9ceb5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes` Documentation + +The `dbsystemshapes` SDK allows for interaction with the Azure Resource Manager Service `oracledatabase` (API Version `2024-06-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/2024-06-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", "locationValue", "dbSystemShapeValue") + +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", "locationValue") + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/client.go new file mode 100644 index 000000000000..5b0f0522f524 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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.NewResourceManagerClient(sdkApi, "dbsystemshapes", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DbSystemShapesClient: %+v", err) + } + + return &DbSystemShapesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/id_dbsystemshape.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/id_dbsystemshape.go new file mode 100644 index 000000000000..759b456b8bb4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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", "locationValue"), + resourceids.StaticSegment("staticDbSystemShapes", "dbSystemShapes", "dbSystemShapes"), + resourceids.UserSpecifiedSegment("dbSystemShapeName", "dbSystemShapeValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/id_location.go new file mode 100644 index 000000000000..fad455455f4e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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", "locationValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/method_get.go new file mode 100644 index 000000000000..fa82bf6c83cb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/method_get.go @@ -0,0 +1,54 @@ +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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/method_listbylocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/method_listbylocation.go new file mode 100644 index 000000000000..c96b27700321 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/method_listbylocation.go @@ -0,0 +1,105 @@ +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 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) (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/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) (ListByLocationCompleteResult, error) { + return c.ListByLocationCompleteMatchingPredicate(ctx, id, DbSystemShapeOperationPredicate{}) +} + +// ListByLocationCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DbSystemShapesClient) ListByLocationCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate DbSystemShapeOperationPredicate) (result ListByLocationCompleteResult, err error) { + items := make([]DbSystemShape, 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/model_dbsystemshape.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/model_dbsystemshape.go new file mode 100644 index 000000000000..698136573519 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/model_dbsystemshapeproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/model_dbsystemshapeproperties.go new file mode 100644 index 000000000000..a7642317091f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/model_dbsystemshapeproperties.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 DbSystemShapeProperties struct { + AvailableCoreCount *int64 `json:"availableCoreCount,omitempty"` + 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"` + CoreCountIncrement *int64 `json:"coreCountIncrement,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"` + ShapeFamily *string `json:"shapeFamily,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/predicates.go new file mode 100644 index 000000000000..34452fe4cf66 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/version.go new file mode 100644 index 000000000000..6fc51a3092b2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes/version.go @@ -0,0 +1,12 @@ +package dbsystemshapes + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/dbsystemshapes/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/README.md new file mode 100644 index 000000000000..36be33794895 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews` Documentation + +The `dnsprivateviews` SDK allows for interaction with the Azure Resource Manager Service `oracledatabase` (API Version `2024-06-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/2024-06-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", "locationValue", "dnsPrivateViewValue") + +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", "locationValue") + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/client.go new file mode 100644 index 000000000000..3c698794fc24 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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.NewResourceManagerClient(sdkApi, "dnsprivateviews", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DnsPrivateViewsClient: %+v", err) + } + + return &DnsPrivateViewsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/constants.go new file mode 100644 index 000000000000..2dbb8a48f9ef --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/id_dnsprivateview.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/id_dnsprivateview.go new file mode 100644 index 000000000000..83ebdb07fc41 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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", "locationValue"), + resourceids.StaticSegment("staticDnsPrivateViews", "dnsPrivateViews", "dnsPrivateViews"), + resourceids.UserSpecifiedSegment("dnsPrivateViewName", "dnsPrivateViewValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/id_location.go new file mode 100644 index 000000000000..15e9c47d19d1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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", "locationValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/method_get.go new file mode 100644 index 000000000000..7caa55aa4b8c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/method_get.go @@ -0,0 +1,54 @@ +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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/method_listbylocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/method_listbylocation.go new file mode 100644 index 000000000000..a0a0c8227706 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/model_dnsprivateview.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/model_dnsprivateview.go new file mode 100644 index 000000000000..fbf51b79e0f9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/model_dnsprivateviewproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/model_dnsprivateviewproperties.go new file mode 100644 index 000000000000..40cd3cf0a934 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/model_dnsprivateviewproperties.go @@ -0,0 +1,45 @@ +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,omitempty"` + IsProtected *bool `json:"isProtected,omitempty"` + LifecycleState *DnsPrivateViewsLifecycleState `json:"lifecycleState,omitempty"` + Ocid *string `json:"ocid,omitempty"` + ProvisioningState *ResourceProvisioningState `json:"provisioningState,omitempty"` + Self *string `json:"self,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + TimeUpdated *string `json:"timeUpdated,omitempty"` +} + +func (o *DnsPrivateViewProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + 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) { + if o.TimeUpdated == nil { + return nil, nil + } + 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/predicates.go new file mode 100644 index 000000000000..294303d391a6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/version.go new file mode 100644 index 000000000000..6f15b75a6213 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews/version.go @@ -0,0 +1,12 @@ +package dnsprivateviews + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/dnsprivateviews/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/README.md new file mode 100644 index 000000000000..26f284a66f69 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones` Documentation + +The `dnsprivatezones` SDK allows for interaction with the Azure Resource Manager Service `oracledatabase` (API Version `2024-06-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/2024-06-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", "locationValue", "dnsPrivateZoneValue") + +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", "locationValue") + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/client.go new file mode 100644 index 000000000000..00a326391b3d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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.NewResourceManagerClient(sdkApi, "dnsprivatezones", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DnsPrivateZonesClient: %+v", err) + } + + return &DnsPrivateZonesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/constants.go new file mode 100644 index 000000000000..e95028805465 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/id_dnsprivatezone.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/id_dnsprivatezone.go new file mode 100644 index 000000000000..bc16d28dc4fc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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", "locationValue"), + resourceids.StaticSegment("staticDnsPrivateZones", "dnsPrivateZones", "dnsPrivateZones"), + resourceids.UserSpecifiedSegment("dnsPrivateZoneName", "dnsPrivateZoneValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/id_location.go new file mode 100644 index 000000000000..75b18688608b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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", "locationValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/method_get.go new file mode 100644 index 000000000000..5dee2634a3dc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/method_get.go @@ -0,0 +1,54 @@ +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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/method_listbylocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/method_listbylocation.go new file mode 100644 index 000000000000..a8f06fd1edc8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/model_dnsprivatezone.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/model_dnsprivatezone.go new file mode 100644 index 000000000000..753c8a9c469f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/model_dnsprivatezoneproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/model_dnsprivatezoneproperties.go new file mode 100644 index 000000000000..680bff102fe7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/model_dnsprivatezoneproperties.go @@ -0,0 +1,35 @@ +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,omitempty"` + LifecycleState *DnsPrivateZonesLifecycleState `json:"lifecycleState,omitempty"` + Ocid *string `json:"ocid,omitempty"` + ProvisioningState *ResourceProvisioningState `json:"provisioningState,omitempty"` + Self *string `json:"self,omitempty"` + Serial *int64 `json:"serial,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + Version *string `json:"version,omitempty"` + ViewId *string `json:"viewId,omitempty"` + ZoneType *ZoneType `json:"zoneType,omitempty"` +} + +func (o *DnsPrivateZoneProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/predicates.go new file mode 100644 index 000000000000..c135bf5afb15 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/version.go new file mode 100644 index 000000000000..c297b3ada655 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones/version.go @@ -0,0 +1,12 @@ +package dnsprivatezones + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/dnsprivatezones/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/README.md new file mode 100644 index 000000000000..aa7d39827456 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions` Documentation + +The `giversions` SDK allows for interaction with the Azure Resource Manager Service `oracledatabase` (API Version `2024-06-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/2024-06-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", "locationValue", "giVersionValue") + +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", "locationValue") + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/client.go new file mode 100644 index 000000000000..00d69beb1d9f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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.NewResourceManagerClient(sdkApi, "giversions", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GiVersionsClient: %+v", err) + } + + return &GiVersionsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/id_giversion.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/id_giversion.go new file mode 100644 index 000000000000..50eccbc7815b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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", "locationValue"), + resourceids.StaticSegment("staticGiVersions", "giVersions", "giVersions"), + resourceids.UserSpecifiedSegment("giVersionName", "giVersionValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/id_location.go new file mode 100644 index 000000000000..610b7ef19067 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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", "locationValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/method_get.go new file mode 100644 index 000000000000..1a89493ad3d7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/method_get.go @@ -0,0 +1,54 @@ +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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/method_listbylocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/method_listbylocation.go new file mode 100644 index 000000000000..b07237060bad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/method_listbylocation.go @@ -0,0 +1,105 @@ +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 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) (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/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) (ListByLocationCompleteResult, error) { + return c.ListByLocationCompleteMatchingPredicate(ctx, id, GiVersionOperationPredicate{}) +} + +// ListByLocationCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GiVersionsClient) ListByLocationCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate GiVersionOperationPredicate) (result ListByLocationCompleteResult, err error) { + items := make([]GiVersion, 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/model_giversion.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/model_giversion.go new file mode 100644 index 000000000000..a088d6eabc40 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/model_giversionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/model_giversionproperties.go new file mode 100644 index 000000000000..ca86e602826a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/predicates.go new file mode 100644 index 000000000000..1ffcef5ca0ef --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/version.go new file mode 100644 index 000000000000..36d335193b29 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions/version.go @@ -0,0 +1,12 @@ +package giversions + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/giversions/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/README.md new file mode 100644 index 000000000000..09bef5af8ae9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/README.md @@ -0,0 +1,153 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions` Documentation + +The `oraclesubscriptions` SDK allows for interaction with the Azure Resource Manager Service `oracledatabase` (API Version `2024-06-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/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/client.go new file mode 100644 index 000000000000..0e7729cfc7bd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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.NewResourceManagerClient(sdkApi, "oraclesubscriptions", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating OracleSubscriptionsClient: %+v", err) + } + + return &OracleSubscriptionsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/constants.go new file mode 100644 index 000000000000..c13ecd3a48e3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_addazuresubscriptions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_addazuresubscriptions.go new file mode 100644 index 000000000000..8b0208126797 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_createorupdate.go new file mode 100644 index 000000000000..e40bd87996da --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_delete.go new file mode 100644 index 000000000000..3db5d26b956d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_get.go new file mode 100644 index 000000000000..56033046138a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_get.go @@ -0,0 +1,56 @@ +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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_listactivationlinks.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_listactivationlinks.go new file mode 100644 index 000000000000..2b8c6c5f589b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_listbysubscription.go new file mode 100644 index 000000000000..0f79ddbf1f16 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_listcloudaccountdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_listcloudaccountdetails.go new file mode 100644 index 000000000000..82e0fe4398f9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_listsaassubscriptiondetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_listsaassubscriptiondetails.go new file mode 100644 index 000000000000..38a211cf7738 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/method_update.go new file mode 100644 index 000000000000..d21b8bc8dd58 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_activationlinks.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_activationlinks.go new file mode 100644 index 000000000000..45a6005a46b8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_azuresubscriptions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_azuresubscriptions.go new file mode 100644 index 000000000000..d847d9891cb8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_cloudaccountdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_cloudaccountdetails.go new file mode 100644 index 000000000000..684d25dd96a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_oraclesubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_oraclesubscription.go new file mode 100644 index 000000000000..f7128fc11f51 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_oraclesubscriptionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_oraclesubscriptionproperties.go new file mode 100644 index 000000000000..90b625b317c5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_oraclesubscriptionupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_oraclesubscriptionupdate.go new file mode 100644 index 000000000000..c95a9cd5426b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_oraclesubscriptionupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_oraclesubscriptionupdateproperties.go new file mode 100644 index 000000000000..d60eeb538217 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_plan.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_plan.go new file mode 100644 index 000000000000..a34f477722ed --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_planupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_planupdate.go new file mode 100644 index 000000000000..e44262bea928 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_saassubscriptiondetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/model_saassubscriptiondetails.go new file mode 100644 index 000000000000..ac942a9834c1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/predicates.go new file mode 100644 index 000000000000..c59c4fe93bcb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/version.go new file mode 100644 index 000000000000..57edceaa23bd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions/version.go @@ -0,0 +1,12 @@ +package oraclesubscriptions + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/oraclesubscriptions/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/README.md new file mode 100644 index 000000000000..ba327c9145fb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions` Documentation + +The `systemversions` SDK allows for interaction with the Azure Resource Manager Service `oracledatabase` (API Version `2024-06-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/2024-06-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", "locationValue", "systemVersionValue") + +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", "locationValue") + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/client.go new file mode 100644 index 000000000000..964f6de60c17 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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.NewResourceManagerClient(sdkApi, "systemversions", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SystemVersionsClient: %+v", err) + } + + return &SystemVersionsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/id_location.go new file mode 100644 index 000000000000..522b02094c98 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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", "locationValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/id_systemversion.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/id_systemversion.go new file mode 100644 index 000000000000..54af015e0946 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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", "locationValue"), + resourceids.StaticSegment("staticSystemVersions", "systemVersions", "systemVersions"), + resourceids.UserSpecifiedSegment("systemVersionName", "systemVersionValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/method_get.go new file mode 100644 index 000000000000..da328bb1b482 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/method_get.go @@ -0,0 +1,54 @@ +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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/method_listbylocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/method_listbylocation.go new file mode 100644 index 000000000000..f1250239c6d1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/model_systemversion.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/model_systemversion.go new file mode 100644 index 000000000000..dc4bb7d6d35e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/model_systemversionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/model_systemversionproperties.go new file mode 100644 index 000000000000..5eda04761332 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/predicates.go new file mode 100644 index 000000000000..d2d884b970c2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/version.go new file mode 100644 index 000000000000..b0f8f194d461 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions/version.go @@ -0,0 +1,12 @@ +package systemversions + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/systemversions/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/README.md new file mode 100644 index 000000000000..5fd92c2eeff1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses` Documentation + +The `virtualnetworkaddresses` SDK allows for interaction with the Azure Resource Manager Service `oracledatabase` (API Version `2024-06-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/2024-06-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", "cloudVmClusterValue", "virtualNetworkAddressValue") + +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", "cloudVmClusterValue", "virtualNetworkAddressValue") + +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", "cloudVmClusterValue", "virtualNetworkAddressValue") + +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.ListByCloudVMCluster` + +```go +ctx := context.TODO() +id := virtualnetworkaddresses.NewCloudVMClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudVmClusterValue") + +// alternatively `client.ListByCloudVMCluster(ctx, id)` can be used to do batched pagination +items, err := client.ListByCloudVMClusterComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/client.go new file mode 100644 index 000000000000..6c8968525ed5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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.NewResourceManagerClient(sdkApi, "virtualnetworkaddresses", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualNetworkAddressesClient: %+v", err) + } + + return &VirtualNetworkAddressesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/constants.go new file mode 100644 index 000000000000..67d5e6fa561b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/id_cloudvmcluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/id_cloudvmcluster.go new file mode 100644 index 000000000000..e755134d59f1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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 V M 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 V M 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 V M 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 V M 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", "cloudVmClusterValue"), + } +} + +// String returns a human-readable description of this Cloud V M 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 V M Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/id_virtualnetworkaddress.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/id_virtualnetworkaddress.go new file mode 100644 index 000000000000..e49281decaa1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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", "cloudVmClusterValue"), + resourceids.StaticSegment("staticVirtualNetworkAddresses", "virtualNetworkAddresses", "virtualNetworkAddresses"), + resourceids.UserSpecifiedSegment("virtualNetworkAddressName", "virtualNetworkAddressValue"), + } +} + +// 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/method_createorupdate.go new file mode 100644 index 000000000000..dd9d12a988dc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/method_delete.go new file mode 100644 index 000000000000..0cbd45c96485 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/method_get.go new file mode 100644 index 000000000000..151f06223ee7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/method_get.go @@ -0,0 +1,54 @@ +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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/method_listbycloudvmcluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/method_listbycloudvmcluster.go new file mode 100644 index 000000000000..81eba745ec72 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/method_listbycloudvmcluster.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 ListByCloudVMClusterOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualNetworkAddress +} + +type ListByCloudVMClusterCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualNetworkAddress +} + +type ListByCloudVMClusterCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByCloudVMClusterCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByCloudVMCluster ... +func (c VirtualNetworkAddressesClient) ListByCloudVMCluster(ctx context.Context, id CloudVMClusterId) (result ListByCloudVMClusterOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByCloudVMClusterCustomPager{}, + 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 +} + +// ListByCloudVMClusterComplete retrieves all the results into a single object +func (c VirtualNetworkAddressesClient) ListByCloudVMClusterComplete(ctx context.Context, id CloudVMClusterId) (ListByCloudVMClusterCompleteResult, error) { + return c.ListByCloudVMClusterCompleteMatchingPredicate(ctx, id, VirtualNetworkAddressOperationPredicate{}) +} + +// ListByCloudVMClusterCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualNetworkAddressesClient) ListByCloudVMClusterCompleteMatchingPredicate(ctx context.Context, id CloudVMClusterId, predicate VirtualNetworkAddressOperationPredicate) (result ListByCloudVMClusterCompleteResult, err error) { + items := make([]VirtualNetworkAddress, 0) + + resp, err := c.ListByCloudVMCluster(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 = ListByCloudVMClusterCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/model_virtualnetworkaddress.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/model_virtualnetworkaddress.go new file mode 100644 index 000000000000..2451c7ae562c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/model_virtualnetworkaddressproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/model_virtualnetworkaddressproperties.go new file mode 100644 index 000000000000..807d373de87e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/predicates.go new file mode 100644 index 000000000000..c0416c10a318 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/version.go new file mode 100644 index 000000000000..9b5dd6bad36f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses/version.go @@ -0,0 +1,12 @@ +package virtualnetworkaddresses + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/virtualnetworkaddresses/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller_lro_statuses.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller_lro_statuses.go index 888feb6a2439..bc9806bed6ed 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller_lro_statuses.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager/poller_lro_statuses.go @@ -103,4 +103,7 @@ var longRunningOperationCustomStatuses = map[status]pollers.PollingStatus{ // StorageSync@2020-03-01 returns `validateInput` rather than `InProgress` during creation/update (https://github.com/hashicorp/go-azure-sdk/issues/565) "validateInput": pollers.PollingStatusInProgress, + + // EventGrid @ 2022-06-15 returns `AwaitingManualAction` while waiting for manual validation of a webhook (https://github.com/hashicorp/terraform-provider-azurerm/issues/25689) + "AwaitingManualAction": pollers.PollingStatusInProgress, } diff --git a/vendor/modules.txt b/vendor/modules.txt index be8b1e1382ec..97a32a683960 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -151,7 +151,7 @@ github.com/hashicorp/go-azure-helpers/resourcemanager/tags github.com/hashicorp/go-azure-helpers/resourcemanager/zones github.com/hashicorp/go-azure-helpers/sender github.com/hashicorp/go-azure-helpers/storage -# github.com/hashicorp/go-azure-sdk/resource-manager v0.20240715.1103416 +# github.com/hashicorp/go-azure-sdk/resource-manager v0.20240731.1212841 ## explicit; go 1.21 github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview @@ -869,6 +869,23 @@ github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2022-10-0 github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2022-10-01/tables github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2022-10-01/workspaces github.com/hashicorp/go-azure-sdk/resource-manager/operationsmanagement/2015-11-01-preview/solution +github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01 +github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasebackups +github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasecharactersets +github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabasenationalcharactersets +github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases +github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabaseversions +github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures +github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters +github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbnodes +github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers +github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbsystemshapes +github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivateviews +github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dnsprivatezones +github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/giversions +github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/oraclesubscriptions +github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/systemversions +github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/virtualnetworkaddresses github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-11-01/contact github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-11-01/contactprofile github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-11-01/groundstation @@ -1120,7 +1137,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saplands github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/saprecommendations github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapsupportedsku github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances -# github.com/hashicorp/go-azure-sdk/sdk v0.20240715.1103416 +# github.com/hashicorp/go-azure-sdk/sdk v0.20240731.1212841 ## explicit; go 1.21 github.com/hashicorp/go-azure-sdk/sdk/auth github.com/hashicorp/go-azure-sdk/sdk/auth/autorest diff --git a/website/allowed-subcategories b/website/allowed-subcategories index 481255cd9868..4268c7b3626b 100644 --- a/website/allowed-subcategories +++ b/website/allowed-subcategories @@ -4,6 +4,7 @@ Active Directory Domain Services Advisor Analysis Services App Configuration +App Service App Service (Web Apps) Application Insights Arc Resource Bridge diff --git a/website/docs/d/oracledatabase_exadata_infrastructure.html.markdown b/website/docs/d/oracledatabase_exadata_infrastructure.html.markdown new file mode 100644 index 000000000000..293b354eae61 --- /dev/null +++ b/website/docs/d/oracledatabase_exadata_infrastructure.html.markdown @@ -0,0 +1,152 @@ +--- +subcategory: "App Service" +layout: "azurerm" +page_title: "Azure Resource Manager: Data Source: azurerm_oracledatabase_exadata_infrastructure" +description: |- + Gets information about an existing Exadata Infrastructure. +--- + +# Data Source: azurerm_oracledatabase_exadata_infrastructure + +Use this data source to access information about an existing Exadata Infrastructure. + +## Example Usage + +```hcl +data "azurerm_oracledatabase_exadata_infrastructure" "example" { + name = "existing" + resource_group_name = "existing" +} + +output "id" { + value = data.azurerm_oracledatabase_exadata_infrastructure.example.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name of this Exadata Infrastructure. + +* `resource_group_name` - (Required) The name of the Resource Group where the Exadata Infrastructure exists. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Exadata Infrastructure. + +* `activated_storage_count` - The requested number of additional storage servers activated for the Exadata infrastructure. + +* `additional_storage_count` - The requested number of additional storage servers for the Exadata infrastructure. + +* `available_storage_size_in_gbs` - The available storage can be allocated to the cloud Exadata infrastructure resource, in gigabytes (GB). + +* `compute_count` - The number of compute servers for the cloud Exadata infrastructure. + +* `cpu_count` - The total number of CPU cores allocated. + +* `customer_contacts` - A `customer_contacts` block as defined below. + +* `data_storage_size_in_tbs` - Size, in terabytes, of the DATA disk group. + +* `db_node_storage_size_in_gbs` - The local node storage allocated in GBs. + +* `db_server_version` - The software version of the database servers (dom0) in the cloud Exadata infrastructure. Example: 20.1.15 + +* `display_name` - The user-friendly name for the cloud Exadata infrastructure resource. The name does not need to be unique. + +* `estimated_patching_time` - A `estimated_patching_time` block as defined below. + +* `last_maintenance_run_id` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the last maintenance run. + +* `lifecycle_details` - Additional information about the current lifecycle state. + +* `lifecycle_state` - CloudExadataInfrastructure lifecycle state. + +* `location` - The Azure Region where the Exadata Infrastructure exists. + +* `maintenance_window` - A `maintenance_window` block as defined below. + +* `max_cpu_count` - The total number of CPU cores available. + +* `max_data_storage_in_tbs` - The total available DATA disk group size. + +* `max_db_node_storage_size_in_gbs` - The total local node storage available in GBs. + +* `max_memory_in_gbs` - The total memory available in GBs. + +* `memory_size_in_gbs` - The memory allocated in GBs. + +* `monthly_db_server_version` - The monthly software version of the database servers (dom0) in the cloud Exadata infrastructure. Example: 20.1.15 + +* `monthly_storage_server_version` - The monthly software version of the storage servers (cells) in the cloud Exadata infrastructure. Example: 20.1.15 + +* `next_maintenance_run_id` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the next maintenance run. + +* `oci_url` - The URL of the resource in the OCI console. + +* `ocid` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the Exadata infrastructure. + +* `provisioning_state` - CloudExadataInfrastructure provisioning state + +* `shape` - The model name of the cloud Exadata infrastructure resource. + +* `storage_count` - The number of storage servers for the cloud Exadata infrastructure. + +* `storage_server_version` - The software version of the storage servers (cells) in the Exadata infrastructure. Example: 20.1.15 + +* `system_data` - A `system_data` block as defined below. + +* `tags` - A mapping of tags assigned to the Exadata Infrastructure. + +* `time_created` - The date and time the cloud Exadata infrastructure resource was created. + +* `total_storage_size_in_gbs` - The total storage allocated to the cloud Exadata infrastructure resource, in gigabytes (GB). + +* `zones` - The Exadata infrastructure Azure zones. + +--- + +A `estimated_patching_time` block exports the following: + +* `estimated_db_server_patching_time` - The estimated time required in minutes for database server patching. + +* `estimated_network_switches_patching_time` - The estimated time required in minutes for network switch patching. + +* `estimated_storage_server_patching_time` - The estimated time required in minutes for storage server patching. + +* `total_estimated_patching_time` - The estimated total time required in minutes for all patching operations. + +--- + +A `maintenance_window` block exports the following: + +* `custom_action_timeout_in_mins` - Determines the amount of time the system will wait before the start of each database server patching operation. Custom action timeout is in minutes and valid value is between 15 to 120 (inclusive). + +* `days_of_week` - Days during the week when maintenance should be performed. + +* `hours_of_day` - The window of hours during the day when maintenance should be performed. The window is a 4 hour slot. Valid values are: 0 - represents time slot 0:00 - 3:59 UTC - 4 - represents time slot 4:00 - 7:59 UTC - 8 - represents time slot 8:00 - 11:59 UTC - 12 - represents time slot 12:00 - 15:59 UTC - 16 - represents time slot 16:00 - 19:59 UTC - 20 - represents time slot 20:00 - 23:59 UTC + +* `is_custom_action_timeout_enabled` - If true, enables the configuration of a custom action timeout (waiting period) between database server patching operations. + +* `is_monthly_patching_enabled` - If true, enables the monthly patching option. + +* `lead_time_in_weeks` - Lead time window allows user to set a lead time to prepare for a down time. The lead time is in weeks and valid value is between 1 to 4. + +* `months` - A `months` block as defined below. + +* `patching_mode` - Cloud Exadata infrastructure node patching method, either "ROLLING" or "NONROLLING". + +* `preference` - The maintenance window scheduling preference. + +* `weeks_of_month` - Weeks during the month when maintenance should be performed. Weeks start on the 1st, 8th, 15th, and 22nd days of the month, and have a duration of 7 days. Weeks start and end based on calendar dates, not days of the week. For example, to allow maintenance during the 2nd week of the month (from the 8th day to the 14th day of the month), use the value 2. Maintenance cannot be scheduled for the fifth week of months that contain more than 28 days. Note that this parameter works in conjunction with the daysOfWeek and hoursOfDay parameters to allow you to specify specific days of the week and hours that maintenance will be performed. + +--- + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the Exadata Infrastructure. \ No newline at end of file diff --git a/website/docs/r/oracledatabase_exadata_infrastructure.html.markdown b/website/docs/r/oracledatabase_exadata_infrastructure.html.markdown new file mode 100644 index 000000000000..416b9cd937c7 --- /dev/null +++ b/website/docs/r/oracledatabase_exadata_infrastructure.html.markdown @@ -0,0 +1,106 @@ +--- +subcategory: "App Service" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_oracledatabase_exadata_infrastructure" +description: |- + Manages a Exadata Infrastructure. +--- + +# azurerm_oracledatabase_exadata_infrastructure + +Manages a Exadata Infrastructure. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_oracledatabase_exadata_infrastructure" "example" { + name = "example-exadata-infra" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + zones = [ "1" ] + display_name = "example-exadata-infra" + storage_count = 3 + compute_count = 2 + shape = "Exadata.X9M" +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `compute_count` - (Required) The number of compute servers for the cloud Exadata infrastructure. + +* `display_name` - (Required) The user-friendly name for the cloud Exadata infrastructure resource. The name does not need to be unique. + +* `location` - (Required) The Azure Region where the Exadata Infrastructure should exist. Changing this forces a new Exadata Infrastructure to be created. + +* `name` - (Required) The name which should be used for this Exadata Infrastructure. + +* `resource_group_name` - (Required) The name of the Resource Group where the Exadata Infrastructure should exist. + +* `shape` - (Required) The shape of the cloud Exadata infrastructure resource. + +* `storage_count` - (Required) The number of storage servers for the cloud Exadata infrastructure. + +* `zones` - (Required) CloudExadataInfrastructure zones. + +--- + +* `customer_contacts` - (Optional) The email address used by Oracle to send notifications regarding databases and infrastructure. + +* `maintenance_window` - (Optional) One or more `maintenance_window` blocks as defined below. + +* `tags` - (Optional) A mapping of tags which should be assigned to the Exadata Infrastructure. + +--- + +A `maintenance_window` block supports the following: + +* `custom_action_timeout_in_mins` - (Optional) Determines the amount of time the system will wait before the start of each database server patching operation. Custom action timeout is in minutes and valid value is between 15 to 120 (inclusive). + +* `days_of_week` - (Optional) Days during the week when maintenance should be performed. Valid values are: 0 - represents time slot 0:00 - 3:59 UTC - 4 - represents time slot 4:00 - 7:59 UTC - 8 - represents time slot 8:00 - 11:59 UTC - 12 - represents time slot 12:00 - 15:59 UTC - 16 - represents time slot 16:00 - 19:59 UTC - 20 - represents time slot 20:00 - 23:59 UTC + +* `hours_of_day` - (Optional) The window of hours during the day when maintenance should be performed. The window is a 4 hour slot. + +* `is_custom_action_timeout_enabled` - (Optional) If true, enables the configuration of a custom action timeout (waiting period) between database server patching operations. + +* `is_monthly_patching_enabled` - (Optional) If true, enables the monthly patching option. + +* `lead_time_in_weeks` - (Optional) Lead time window allows user to set a lead time to prepare for a down time. The lead time is in weeks and valid value is between 1 to 4. + +* `months` - (Optional) Months during the year when maintenance should be performed. + +* `patching_mode` - (Optional) Cloud Exadata infrastructure node patching method, either "ROLLING" or "NONROLLING". Default value is ROLLING. IMPORTANT: Non-rolling infrastructure patching involves system down time. See [Oracle-Managed Infrastructure Maintenance Updates](https://docs.cloud.oracle.com/iaas/Content/Database/Concepts/examaintenance.htm#Oracle) for more information. + +* `preference` - (Optional) The maintenance window scheduling preference. + +* `weeks_of_month` - (Optional) Weeks during the month when maintenance should be performed. Weeks start on the 1st, 8th, 15th, and 22nd days of the month, and have a duration of 7 days. Weeks start and end based on calendar dates, not days of the week. For example, to allow maintenance during the 2nd week of the month (from the 8th day to the 14th day of the month), use the value 2. Maintenance cannot be scheduled for the fifth week of months that contain more than 28 days. Note that this parameter works in conjunction with the daysOfWeek and hoursOfDay parameters to allow you to specify specific days of the week and hours that maintenance will be performed. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Exadata Infrastructure. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Exadata Infrastructure. +* `read` - (Defaults to 5 minutes) Used when retrieving the Exadata Infrastructure. +* `update` - (Defaults to 30 minutes) Used when updating the Exadata Infrastructure. +* `delete` - (Defaults to 30 minutes) Used when deleting the Exadata Infrastructure. + +## Import + +Exadata Infrastructures can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_oracledatabase_exadata_infrastructure.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup/providers/Oracle.Database/cloudExadataInfrastructures/cloudExadataInfrastructures1 +``` \ No newline at end of file From 22a45cc8b42baef883b3c5ff6ea019704b5eac0d Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Mon, 12 Aug 2024 15:12:23 +0100 Subject: [PATCH 02/43] * Add docs for db_server data source. --- .../cloud_vm_cluster_data_source.go | 517 ++++++++++++++++++ .../cloud_vm_cluster_data_source_test.go | 43 ++ .../cloud_vm_cluster_helpers.go | 71 +++ .../cloud_vm_cluster_resource.go | 429 +++++++++++++++ .../cloud_vm_cluster_resource_test.go | 271 +++++++++ .../oracledatabase/db_servers_data_source.go | 229 ++++++++ .../db_servers_data_source_test.go | 50 ++ .../services/oracledatabase/registration.go | 3 + ...cledatabase_cloud_vm_cluster.html.markdown | 177 ++++++ .../d/oracledatabase_db_servers.html.markdown | 88 +++ ...cledatabase_cloud_vm_cluster.html.markdown | 165 ++++++ 11 files changed, 2043 insertions(+) create mode 100644 internal/services/oracledatabase/cloud_vm_cluster_data_source.go create mode 100644 internal/services/oracledatabase/cloud_vm_cluster_data_source_test.go create mode 100644 internal/services/oracledatabase/cloud_vm_cluster_helpers.go create mode 100644 internal/services/oracledatabase/cloud_vm_cluster_resource.go create mode 100644 internal/services/oracledatabase/cloud_vm_cluster_resource_test.go create mode 100644 internal/services/oracledatabase/db_servers_data_source.go create mode 100644 internal/services/oracledatabase/db_servers_data_source_test.go create mode 100644 website/docs/d/oracledatabase_cloud_vm_cluster.html.markdown create mode 100644 website/docs/d/oracledatabase_db_servers.html.markdown create mode 100644 website/docs/r/oracledatabase_cloud_vm_cluster.html.markdown diff --git a/internal/services/oracledatabase/cloud_vm_cluster_data_source.go b/internal/services/oracledatabase/cloud_vm_cluster_data_source.go new file mode 100644 index 000000000000..c1c5db93b552 --- /dev/null +++ b/internal/services/oracledatabase/cloud_vm_cluster_data_source.go @@ -0,0 +1,517 @@ +// Copyright © 2024, Oracle and/or its affiliates. All rights reserved + +package oracledatabase + +import ( + "context" + "fmt" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters" + "github.com/hashicorp/terraform-provider-azurerm/utils" + "time" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type CloudVmClusterDataSource struct{} + +type CloudVmClusterDataModel struct { + Name string `tfschema:"name"` + Type string `tfschema:"type"` + Tags map[string]interface{} `tfschema:"tags"` + + // SystemData + SystemData []SystemDataModel `tfschema:"system_data"` + + // CloudVMClusterProperties + BackupSubnetCidr string `tfschema:"backup_subnet_cidr"` + CloudExadataInfrastructureId string `tfschema:"cloud_exadata_infrastructure_id"` + ClusterName string `tfschema:"cluster_name"` + CompartmentId string `tfschema:"compartment_id"` + ComputeNodes []string `tfschema:"compute_nodes"` + CpuCoreCount int64 `tfschema:"cpu_core_count"` + DataCollectionOptions []DataCollectionOptionsModel `tfschema:"data_collection_options"` + DataStoragePercentage int64 `tfschema:"data_storage_percentage"` + DataStorageSizeInTbs float64 `tfschema:"data_storage_size_in_tbs"` + DbNodeStorageSizeInGbs int64 `tfschema:"db_node_storage_size_in_gbs"` + DbServers []string `tfschema:"db_servers"` + DiskRedundancy string `tfschema:"disk_redundancy"` + DisplayName string `tfschema:"display_name"` + Domain string `tfschema:"domain"` + GiVersion string `tfschema:"gi_version"` + Hostname string `tfschema:"hostname"` + IormConfigCache []ExadataIormConfigModel `tfschema:"iorm_config_cache"` + IsLocalBackupEnabled bool `tfschema:"is_local_backup_enabled"` + IsSparseDiskgroupEnabled bool `tfschema:"is_sparse_diskgroup_enabled"` + LastUpdateHistoryEntryId string `tfschema:"last_update_history_entry_id"` + LicenseModel string `tfschema:"license_model"` + LifecycleDetails string `tfschema:"lifecycle_details"` + LifecycleState string `tfschema:"lifecycle_state"` + ListenerPort int64 `tfschema:"listener_port"` + MemorySizeInGbs int64 `tfschema:"memory_size_in_gbs"` + NodeCount int64 `tfschema:"node_count"` + NsgUrl string `tfschema:"nsg_url"` + OciUrl string `tfschema:"oci_url"` + Ocid string `tfschema:"ocid"` + OcpuCount float64 `tfschema:"ocpu_count"` + ProvisioningState string `tfschema:"provisioning_state"` + ScanDnsName string `tfschema:"scan_dns_name"` + ScanDnsRecordId string `tfschema:"scan_dns_record_id"` + ScanIPIds []string `tfschema:"scan_ip_ids"` + ScanListenerPortTcp int64 `tfschema:"scan_listener_port_tcp"` + ScanListenerPortTcpSsl int64 `tfschema:"scan_listener_port_tcp_ssl"` + Shape string `tfschema:"shape"` + SshPublicKeys []string `tfschema:"ssh_public_keys"` + StorageSizeInGbs int64 `tfschema:"storage_size_in_gbs"` + SubnetId string `tfschema:"subnet_id"` + SubnetOcid string `tfschema:"subnet_ocid"` + SystemVersion string `tfschema:"system_version"` + TimeCreated string `tfschema:"time_created"` + TimeZone string `tfschema:"time_zone"` + VipIds []string `tfschema:"vip_ods"` + VnetId string `tfschema:"vnet_id"` + ZoneId string `tfschema:"zone_id"` +} + +type DataCollectionOptionsModel struct { + IsDiagnosticsEventsEnabled bool `tfschema:"is_diagnostics_events_enabled"` + IsHealthMonitoringEnabled bool `tfschema:"is_health_monitoring_enabled"` + IsIncidentLogsEnabled bool `tfschema:"is_incident_logs_enabled"` +} + +type ExadataIormConfigModel struct { + DbPlans []DbIormConfigModel `tfschema:"db_plans"` + LifecycleDetails string `tfschema:"lifecycle_details"` + LifecycleState string `tfschema:"lifecycle_state"` + Objective string `tfschema:"objective"` +} + +type DbIormConfigModel struct { + DbName string `tfschema:"db_name"` + FlashCacheLimit string `tfschema:"flash_cache_limit"` + Share int64 `tfschema:"share"` +} + +func (d CloudVmClusterDataSource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + } +} + +func (d CloudVmClusterDataSource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "location": commonschema.LocationComputed(), + "type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "tags": commonschema.TagsDataSource(), + + // SystemData + "system_data": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "created_by": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "created_by_type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "created_at": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "last_modified_by": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "last_modified_by_type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "last_modified_at": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + // CloudVMClusterProperties + "backup_subnet_cidr": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "cloud_exadata_infrastructure_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "cluster_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "compartment_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "compute_nodes": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "cpu_core_count": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "data_collection_options": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "is_diagnostics_events_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "is_health_monitoring_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "is_incident_logs_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + }, + }, + }, + "data_storage_percentage": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "data_storage_size_in_tbs": { + Type: pluginsdk.TypeFloat, + Computed: true, + }, + "db_node_storage_size_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "db_servers": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "disk_redundancy": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "display_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "domain": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "gi_version": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "hostname": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "iorm_config_cache": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "db_plans": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "db_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "flash_cache_limit": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "share": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + }, + }, + }, + "lifecycle_details": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "lifecycle_state": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "objective": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "is_local_backup_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "is_sparse_diskgroup_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "last_update_history_entry_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "license_model": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "lifecycle_details": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "lifecycle_state": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "listener_port": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "memory_size_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "node_count": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "nsg_url": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "oci_url": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "ocid": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "ocpu_count": { + Type: pluginsdk.TypeFloat, + Computed: true, + }, + "provisioning_state": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "scan_dns_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "scan_dns_record_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "scan_ip_ids": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "scan_listener_port_tcp": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "scan_listener_port_tcp_ssl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "shape": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "ssh_public_keys": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "storage_size_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "subnet_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "subnet_ocid": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "system_version": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_created": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_zone": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "vip_ods": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "vnet_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "zone_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + } +} + +func (d CloudVmClusterDataSource) ModelObject() interface{} { + return nil +} + +func (d CloudVmClusterDataSource) ResourceType() string { + return "azurerm_oracledatabase_cloud_vm_cluster" +} + +func (d CloudVmClusterDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return cloudvmclusters.ValidateCloudVMClusterID +} + +func (d CloudVmClusterDataSource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudVMClusters + subscriptionId := metadata.Client.Account.SubscriptionId + + id := cloudvmclusters.NewCloudVMClusterID(subscriptionId, + metadata.ResourceData.Get("resource_group_name").(string), + metadata.ResourceData.Get("name").(string)) + + resp, err := client.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + if model := resp.Model; model != nil { + err := metadata.ResourceData.Set("location", location.NormalizeNilable(&model.Location)) + if err != nil { + return err + } + + var output CloudVmClusterDataModel + prop := model.Properties + if prop != nil { + output = CloudVmClusterDataModel{ + BackupSubnetCidr: pointer.From(prop.BackupSubnetCidr), + CloudExadataInfrastructureId: prop.CloudExadataInfrastructureId, + ClusterName: pointer.From(prop.ClusterName), + CompartmentId: pointer.From(prop.CompartmentId), + ComputeNodes: pointer.From(prop.ComputeNodes), + CpuCoreCount: prop.CpuCoreCount, + DataStoragePercentage: pointer.From(prop.DataStoragePercentage), + DataStorageSizeInTbs: pointer.From(prop.DataStorageSizeInTbs), + DbNodeStorageSizeInGbs: pointer.From(prop.DbNodeStorageSizeInGbs), + DbServers: pointer.From(prop.DbServers), + DiskRedundancy: string(pointer.From(prop.DiskRedundancy)), + DisplayName: prop.DisplayName, + Domain: pointer.From(prop.Domain), + GiVersion: prop.GiVersion, + Hostname: prop.Hostname, + IormConfigCache: ConvertExadataIormConfigToInternal(prop.IormConfigCache), + IsLocalBackupEnabled: pointer.From(prop.IsLocalBackupEnabled), + IsSparseDiskgroupEnabled: pointer.From(prop.IsSparseDiskgroupEnabled), + LastUpdateHistoryEntryId: pointer.From(prop.LastUpdateHistoryEntryId), + LicenseModel: string(pointer.From(prop.LicenseModel)), + LifecycleDetails: pointer.From(prop.LifecycleDetails), + LifecycleState: string(*prop.LifecycleState), + ListenerPort: pointer.From(prop.ListenerPort), + MemorySizeInGbs: pointer.From(prop.MemorySizeInGbs), + NodeCount: pointer.From(prop.NodeCount), + NsgUrl: pointer.From(prop.NsgUrl), + OciUrl: pointer.From(prop.OciUrl), + Ocid: pointer.From(prop.Ocid), + ProvisioningState: string(pointer.From(prop.ProvisioningState)), + Shape: pointer.From(prop.Shape), + StorageSizeInGbs: pointer.From(prop.StorageSizeInGbs), + SubnetId: prop.SubnetId, + SubnetOcid: pointer.From(prop.SubnetOcid), + SystemVersion: pointer.From(prop.SystemVersion), + TimeCreated: pointer.From(prop.TimeCreated), + TimeZone: pointer.From(prop.TimeZone), + ZoneId: pointer.From(prop.ZoneId), + } + } + + systemData := model.SystemData + if systemData != nil { + output.SystemData = []SystemDataModel{ + { + CreatedBy: systemData.CreatedBy, + CreatedByType: systemData.CreatedByType, + CreatedAt: systemData.CreatedAt, + LastModifiedBy: systemData.LastModifiedBy, + LastModifiedbyType: systemData.LastModifiedbyType, + LastModifiedAt: systemData.LastModifiedAt, + }, + } + } + output.Name = id.CloudVmClusterName + output.Type = pointer.From(model.Type) + output.Tags = utils.FlattenPtrMapStringString(model.Tags) + + metadata.SetID(id) + return metadata.Encode(&output) + } + return nil + }, + } +} diff --git a/internal/services/oracledatabase/cloud_vm_cluster_data_source_test.go b/internal/services/oracledatabase/cloud_vm_cluster_data_source_test.go new file mode 100644 index 000000000000..8cca65a3a706 --- /dev/null +++ b/internal/services/oracledatabase/cloud_vm_cluster_data_source_test.go @@ -0,0 +1,43 @@ +// Copyright © 2024, Oracle and/or its affiliates. All rights reserved + +package oracledatabase_test + +import ( + "fmt" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracledatabase" + "testing" +) + +type CloudVmClusterDataSource struct{} + +func TestCloudVmClusterDataSource_basic(t *testing.T) { + data := acceptance.BuildTestData(t, oracledatabase.CloudVmClusterDataSource{}.ResourceType(), "test") + r := CloudVmClusterDataSource{} + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("location").Exists(), + check.That(data.ResourceName).Key("name").Exists(), + check.That(data.ResourceName).Key("resource_group_name").Exists(), + check.That(data.ResourceName).Key("cloud_exadata_infrastructure_id").Exists(), + check.That(data.ResourceName).Key("display_name").Exists(), + check.That(data.ResourceName).Key("cpu_core_count").Exists(), + ), + }, + }) +} + +func (d CloudVmClusterDataSource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +data "azurerm_oracledatabase_cloud_vm_cluster" "test" { + name = azurerm_oracledatabase_cloud_vm_cluster.test.name + resource_group_name = azurerm_oracledatabase_cloud_vm_cluster.test.resource_group_name +} +`, CloudVmClusterResource{}.basic(data)) +} diff --git a/internal/services/oracledatabase/cloud_vm_cluster_helpers.go b/internal/services/oracledatabase/cloud_vm_cluster_helpers.go new file mode 100644 index 000000000000..ad63c8087135 --- /dev/null +++ b/internal/services/oracledatabase/cloud_vm_cluster_helpers.go @@ -0,0 +1,71 @@ +package oracledatabase + +import ( + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "strings" +) + +func ConvertDataCollectionOptionsToInternal(dataCollectionOptions *cloudvmclusters.DataCollectionOptions) []DataCollectionOptionsModel { + if dataCollectionOptions != nil { + return []DataCollectionOptionsModel{ + { + IsDiagnosticsEventsEnabled: pointer.From(dataCollectionOptions.IsDiagnosticsEventsEnabled), + IsHealthMonitoringEnabled: pointer.From(dataCollectionOptions.IsHealthMonitoringEnabled), + IsIncidentLogsEnabled: pointer.From(dataCollectionOptions.IsIncidentLogsEnabled), + }, + } + } + return nil +} + +func ConvertExadataIormConfigToInternal(exadataIormConfig *cloudvmclusters.ExadataIormConfig) []ExadataIormConfigModel { + if exadataIormConfig != nil { + var dbIormConfigModel []DbIormConfigModel + if exadataIormConfig.DbPlans != nil { + dbPlans := *exadataIormConfig.DbPlans + for _, dbPlan := range dbPlans { + dbIormConfigModel = append(dbIormConfigModel, DbIormConfigModel{ + DbName: pointer.From(dbPlan.DbName), + FlashCacheLimit: pointer.From(dbPlan.FlashCacheLimit), + Share: pointer.From(dbPlan.Share), + }) + } + } + return []ExadataIormConfigModel{ + { + DbPlans: dbIormConfigModel, + LifecycleDetails: pointer.From(exadataIormConfig.LifecycleDetails), + LifecycleState: string(pointer.From(exadataIormConfig.LifecycleState)), + Objective: string(pointer.From(exadataIormConfig.Objective)), + }, + } + } + return nil +} + +func GiVersionDiffSuppress(key string, old string, new string, d *schema.ResourceData) bool { + if old == "" || new == "" { + return false + } + oldVersion := strings.Split(old, ".") + newVersion := strings.Split(new, ".") + + if oldVersion[0] == newVersion[0] { + return true + } + return false +} + +func DbSystemHostnameDiffSuppress(key string, old string, new string, d *schema.ResourceData) bool { + return EqualIgnoreCaseSuppressDiff(key, old, new, d) || NewIsPrefixOfOldDiffSuppress(key, old, new, d) +} + +func NewIsPrefixOfOldDiffSuppress(key string, old string, new string, d *schema.ResourceData) bool { + return strings.HasPrefix(strings.ToLower(old), strings.ToLower(new)) +} + +func EqualIgnoreCaseSuppressDiff(key string, old string, new string, d *schema.ResourceData) bool { + return strings.EqualFold(old, new) +} diff --git a/internal/services/oracledatabase/cloud_vm_cluster_resource.go b/internal/services/oracledatabase/cloud_vm_cluster_resource.go new file mode 100644 index 000000000000..ffb4354237e0 --- /dev/null +++ b/internal/services/oracledatabase/cloud_vm_cluster_resource.go @@ -0,0 +1,429 @@ +// Copyright © 2024, Oracle and/or its affiliates. All rights reserved + +package oracledatabase + +import ( + "context" + "fmt" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/utils" + "time" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +var _ sdk.Resource = CloudVmClusterResource{} + +type CloudVmClusterResource struct{} + +type CloudVmClusterResourceModel struct { + // Azure + Location string `tfschema:"location"` + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Tags map[string]interface{} `tfschema:"tags"` + + // Required + CloudExadataInfrastructureId string `tfschema:"cloud_exadata_infrastructure_id"` + CpuCoreCount int64 `tfschema:"cpu_core_count"` + DataStorageSizeInTbs float64 `tfschema:"data_storage_size_in_tbs"` + DbNodeStorageSizeInGbs int64 `tfschema:"db_node_storage_size_in_gbs"` + DbServers []string `tfschema:"db_servers"` + DisplayName string `tfschema:"display_name"` + GiVersion string `tfschema:"gi_version"` + Hostname string `tfschema:"hostname"` + LicenseModel string `tfschema:"license_model"` + MemorySizeInGbs int64 `tfschema:"memory_size_in_gbs"` + SshPublicKeys []string `tfschema:"ssh_public_keys"` + SubnetId string `tfschema:"subnet_id"` + VnetId string `tfschema:"vnet_id"` + + // Optional + BackupSubnetCidr string `tfschema:"backup_subnet_cidr"` + ClusterName string `tfschema:"cluster_name"` + DataCollectionOptions []DataCollectionOptionsModel `tfschema:"data_collection_options"` + DataStoragePercentage int64 `tfschema:"data_storage_percentage"` + IsLocalBackupEnabled bool `tfschema:"is_local_backup_enabled"` + IsSparseDiskgroupEnabled bool `tfschema:"is_sparse_diskgroup_enabled"` + TimeZone string `tfschema:"time_zone"` +} + +func (CloudVmClusterResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + // Azure + "location": commonschema.Location(), + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + "resource_group_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + "tags": commonschema.Tags(), + + // Required + "cloud_exadata_infrastructure_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + "cpu_core_count": { + Type: pluginsdk.TypeInt, + Required: true, + }, + "data_storage_size_in_tbs": { + Type: pluginsdk.TypeFloat, + Optional: true, + Computed: true, + ForceNew: true, + }, + "db_node_storage_size_in_gbs": { + Type: pluginsdk.TypeInt, + Optional: true, + Computed: true, + }, + "db_servers": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "display_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + "gi_version": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + DiffSuppressFunc: GiVersionDiffSuppress, + }, + "hostname": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + DiffSuppressFunc: DbSystemHostnameDiffSuppress, + }, + "license_model": { + Type: pluginsdk.TypeString, + Required: true, + }, + "memory_size_in_gbs": { + Type: pluginsdk.TypeInt, + Optional: true, + Computed: true, + }, + "ssh_public_keys": { + Type: pluginsdk.TypeList, + Required: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "subnet_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + "vnet_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + // Optional + "backup_subnet_cidr": { + Type: pluginsdk.TypeString, + Optional: true, + }, + "cluster_name": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + "data_collection_options": { + Type: pluginsdk.TypeList, + Optional: true, + Computed: true, + MaxItems: 1, + MinItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "is_diagnostics_events_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Computed: true, + }, + "is_health_monitoring_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Computed: true, + }, + "is_incident_logs_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Computed: true, + }, + }, + }, + }, + "data_storage_percentage": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ForceNew: true, + }, + "is_local_backup_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Computed: true, + ForceNew: true, + }, + "is_sparse_diskgroup_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Computed: true, + ForceNew: true, + }, + "time_zone": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + } +} + +func (CloudVmClusterResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (CloudVmClusterResource) ModelObject() interface{} { + return &ExadataInfraResource{} +} + +func (CloudVmClusterResource) ResourceType() string { + return "azurerm_oracledatabase_cloud_vm_cluster" +} + +func (r CloudVmClusterResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudVMClusters + subscriptionId := metadata.Client.Account.SubscriptionId + + var model CloudVmClusterResourceModel + if err := metadata.Decode(&model); err != nil { + return err + } + + id := cloudvmclusters.NewCloudVMClusterID(subscriptionId, + model.ResourceGroupName, + model.Name) + + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + param := cloudvmclusters.CloudVMCluster{ + // Azure + Name: pointer.To(model.Name), + Location: model.Location, + Tags: tags.Expand(model.Tags), + Properties: &cloudvmclusters.CloudVMClusterProperties{ + // Required + CloudExadataInfrastructureId: model.CloudExadataInfrastructureId, + CpuCoreCount: model.CpuCoreCount, + DbServers: pointer.To(model.DbServers), + DisplayName: model.DisplayName, + GiVersion: model.GiVersion, + Hostname: model.Hostname, + LicenseModel: pointer.To(cloudvmclusters.LicenseModel(model.LicenseModel)), + SshPublicKeys: model.SshPublicKeys, + SubnetId: model.SubnetId, + VnetId: model.VnetId, + }, + } + + if model.BackupSubnetCidr != "" { + param.Properties.BackupSubnetCidr = pointer.To(model.BackupSubnetCidr) + } + if model.ClusterName != "" { + param.Properties.ClusterName = pointer.To(model.ClusterName) + } + if model.DataCollectionOptions != nil && len(model.DataCollectionOptions) > 0 { + param.Properties.DataCollectionOptions = &cloudvmclusters.DataCollectionOptions{ + IsDiagnosticsEventsEnabled: pointer.To(model.DataCollectionOptions[0].IsDiagnosticsEventsEnabled), + IsHealthMonitoringEnabled: pointer.To(model.DataCollectionOptions[0].IsHealthMonitoringEnabled), + IsIncidentLogsEnabled: pointer.To(model.DataCollectionOptions[0].IsIncidentLogsEnabled), + } + } + if model.TimeZone != "" { + param.Properties.ClusterName = pointer.To(model.TimeZone) + } + if model.DataStoragePercentage != 0 { + param.Properties.DataStoragePercentage = pointer.To(model.DataStoragePercentage) + } + if model.DataStorageSizeInTbs != 0 { + param.Properties.DataStorageSizeInTbs = pointer.To(model.DataStorageSizeInTbs) + } + if model.DbNodeStorageSizeInGbs != 0 { + param.Properties.DbNodeStorageSizeInGbs = pointer.To(model.DbNodeStorageSizeInGbs) + } + param.Properties.IsLocalBackupEnabled = pointer.To(model.IsLocalBackupEnabled) + param.Properties.IsSparseDiskgroupEnabled = pointer.To(model.IsSparseDiskgroupEnabled) + if model.MemorySizeInGbs != 0 { + param.Properties.MemorySizeInGbs = pointer.To(model.MemorySizeInGbs) + } + + if err := client.CreateOrUpdateThenPoll(ctx, id, param); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r CloudVmClusterResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + + client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudVMClusters + id, err := cloudvmclusters.ParseCloudVMClusterID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model CloudVmClusterResourceModel + if err = metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding err: %+v", err) + } + + existing, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving exists when updating: +%v", *id) + } + if existing.Model == nil && existing.Model.Properties == nil { + return fmt.Errorf("retrieving as nil when updating for %v", *id) + } + + if metadata.ResourceData.HasChange("tags") { + update := &cloudvmclusters.CloudVMClusterUpdate{ + Tags: tags.Expand(model.Tags), + } + err = client.UpdateThenPoll(ctx, *id, *update) + if err != nil { + return fmt.Errorf("updating %s: %v", id, err) + } + } else if metadata.ResourceData.HasChangesExcept("tags") { + return fmt.Errorf("only `tags` currently support updates") + } + return nil + }, + } +} + +func (CloudVmClusterResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + id, err := cloudvmclusters.ParseCloudVMClusterID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudVMClusters + result, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(result.HttpResponse) { + return metadata.MarkAsGone(id) + } + return err + } + + if result.Model == nil { + return fmt.Errorf("retrieving %s got nil model", id) + } + var output CloudVmClusterResourceModel + + // Azure + output.Name = pointer.ToString(result.Model.Name) + output.Location = result.Model.Location + output.Tags = utils.FlattenPtrMapStringString(result.Model.Tags) + output.ResourceGroupName = id.ResourceGroupName + // Required + output.CloudExadataInfrastructureId = result.Model.Properties.CloudExadataInfrastructureId + output.CpuCoreCount = result.Model.Properties.CpuCoreCount + output.DataStorageSizeInTbs = pointer.From(result.Model.Properties.DataStorageSizeInTbs) + output.DbNodeStorageSizeInGbs = pointer.From(result.Model.Properties.DbNodeStorageSizeInGbs) + output.DbServers = pointer.From(result.Model.Properties.DbServers) + output.DisplayName = result.Model.Properties.DisplayName + output.GiVersion = result.Model.Properties.GiVersion + output.Hostname = result.Model.Properties.Hostname + output.LicenseModel = string(pointer.From(result.Model.Properties.LicenseModel)) + output.MemorySizeInGbs = pointer.From(result.Model.Properties.MemorySizeInGbs) + //output.SshPublicKeys = result.Model.Properties.SshPublicKeys + tmp := make([]string, 0) + for _, key := range result.Model.Properties.SshPublicKeys { + if key != "" { + tmp = append(tmp, key) + } + } + output.SshPublicKeys = tmp + output.SubnetId = result.Model.Properties.SubnetId + output.VnetId = result.Model.Properties.VnetId + // Optional + output.BackupSubnetCidr = pointer.From(result.Model.Properties.BackupSubnetCidr) + output.ClusterName = pointer.From(result.Model.Properties.ClusterName) + output.DataCollectionOptions = ConvertDataCollectionOptionsToInternal(result.Model.Properties.DataCollectionOptions) + output.DataStoragePercentage = pointer.From(result.Model.Properties.DataStoragePercentage) + output.IsLocalBackupEnabled = pointer.From(result.Model.Properties.IsLocalBackupEnabled) + output.IsSparseDiskgroupEnabled = pointer.From(result.Model.Properties.IsSparseDiskgroupEnabled) + output.TimeZone = pointer.From(result.Model.Properties.TimeZone) + + return metadata.Encode(&output) + }, + } +} + +func (CloudVmClusterResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudVMClusters + + id, err := cloudvmclusters.ParseCloudVMClusterID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if err = client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (CloudVmClusterResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return cloudvmclusters.ValidateCloudVMClusterID +} diff --git a/internal/services/oracledatabase/cloud_vm_cluster_resource_test.go b/internal/services/oracledatabase/cloud_vm_cluster_resource_test.go new file mode 100644 index 000000000000..d40a9a09698a --- /dev/null +++ b/internal/services/oracledatabase/cloud_vm_cluster_resource_test.go @@ -0,0 +1,271 @@ +// Copyright © 2024, Oracle and/or its affiliates. All rights reserved + +package oracledatabase_test + +import ( + "context" + "fmt" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracledatabase" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type CloudVmClusterResource struct{} + +func (a CloudVmClusterResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := cloudvmclusters.ParseCloudVMClusterID(state.ID) + if err != nil { + return nil, err + } + resp, err := client.OracleDatabase.OracleDatabaseClient.CloudVMClusters.Get(ctx, *id) + if err != nil { + return nil, fmt.Errorf("retrieving cloud vm cluster %s: %+v", id, err) + } + return utils.Bool(resp.Model != nil), nil +} + +func (a CloudVmClusterResource) Destroy(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := cloudvmclusters.ParseCloudVMClusterID(state.ID) + if err != nil { + return nil, err + } + if _, err := client.OracleDatabase.OracleDatabaseClient.CloudVMClusters.Delete(ctx, *id); err != nil { + return nil, fmt.Errorf("deleting vm cluster %s: %+v", id, err) + } + return utils.Bool(true), nil +} + +func TestCloudVmClusterResource_basic(t *testing.T) { + data := acceptance.BuildTestData(t, oracledatabase.CloudVmClusterResource{}.ResourceType(), "test") + r := CloudVmClusterResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestCloudVmClusterResource_allFields(t *testing.T) { + data := acceptance.BuildTestData(t, oracledatabase.CloudVmClusterResource{}.ResourceType(), "test") + r := CloudVmClusterResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.allFields(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestCloudVmClusterResource_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, oracledatabase.CloudVmClusterResource{}.ResourceType(), "test") + r := CloudVmClusterResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestCloudVmClusterResource_update(t *testing.T) { + data := acceptance.BuildTestData(t, oracledatabase.CloudVmClusterResource{}.ResourceType(), "test") + r := CloudVmClusterResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (a CloudVmClusterResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` + %s +resource "azurerm_oracledatabase_cloud_vm_cluster" "test" { + location = "%[3]s" + name = "OFakeVmacctest%[2]d" + resource_group_name = azurerm_resource_group.test.name + cloud_exadata_infrastructure_id = azurerm_oracledatabase_exadata_infrastructure.test.id + cpu_core_count = 4 + data_storage_size_in_tbs = 2 + db_node_storage_size_in_gbs = 120 + db_servers = [for obj in data.azurerm_oracledatabase_db_servers.test.db_servers : obj.ocid] + display_name = "OFakeVmacctest%[2]d" + gi_version = "23.0.0.0" + license_model = "BringYourOwnLicense" + memory_size_in_gbs = 60 + hostname = "hostname" + ssh_public_keys = ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN you@me.com"] + subnet_id = azurerm_subnet.virtual_network_subnet.id + vnet_id = azurerm_virtual_network.virtual_network.id +}`, a.template(data), data.RandomInteger, data.Locations.Primary) +} + +func (a CloudVmClusterResource) allFields(data acceptance.TestData) string { + return fmt.Sprintf(` + %s +resource "azurerm_oracledatabase_cloud_vm_cluster" "test" { + location = "%[3]s" + name = "OFakeVmacctest%[2]d" + resource_group_name = azurerm_resource_group.test.name + cloud_exadata_infrastructure_id = azurerm_oracledatabase_exadata_infrastructure.test.id + cpu_core_count = 4 + data_collection_options { + is_diagnostics_events_enabled = true + is_health_monitoring_enabled = true + is_incident_logs_enabled = true + } + data_storage_size_in_tbs = 2 + db_node_storage_size_in_gbs = 120 + db_servers = [for obj in data.azurerm_oracledatabase_db_servers.test.db_servers : obj.ocid] + display_name = "OFakeVmacctest%[2]d" + gi_version = "23.0.0.0" + is_local_backup_enabled = true + is_sparse_diskgroup_enabled = true + license_model = "BringYourOwnLicense" + memory_size_in_gbs = 60 + hostname = "hostname" + ssh_public_keys = ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN you@me.com"] + subnet_id = azurerm_subnet.virtual_network_subnet.id + tags = { + test = "testTag1" + } + time_zone = "UTC" + vnet_id = azurerm_virtual_network.virtual_network.id +}`, a.template(data), data.RandomInteger, data.Locations.Primary) +} + +func (a CloudVmClusterResource) update(data acceptance.TestData) string { + return fmt.Sprintf(` +%s +resource "azurerm_oracledatabase_cloud_vm_cluster" "test" { + location = "%[3]s" + name = "OFakeVmacctest%[2]d" + resource_group_name = azurerm_resource_group.test.name + cloud_exadata_infrastructure_id = azurerm_oracledatabase_exadata_infrastructure.test.id + cpu_core_count = 4 + data_storage_size_in_tbs = 2 + db_node_storage_size_in_gbs = 120 + db_servers = [for obj in data.azurerm_oracledatabase_db_servers.test.db_servers : obj.ocid] + display_name = "OFakeVmacctest%[2]d" + gi_version = "23.0.0.0" + license_model = "BringYourOwnLicense" + memory_size_in_gbs = 60 + hostname = "hostname" + ssh_public_keys = ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN you@me.com"] + subnet_id = azurerm_subnet.virtual_network_subnet.id + tags = { + test = "testTag1" + } + vnet_id = azurerm_virtual_network.virtual_network.id +}`, a.template(data), data.RandomInteger, data.Locations.Primary) +} + +func (a CloudVmClusterResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_oracledatabase_cloud_vm_cluster" "import" { + location = azurerm_oracledatabase_cloud_vm_cluster.test.location + name = azurerm_oracledatabase_cloud_vm_cluster.test.name + resource_group_name = azurerm_oracledatabase_cloud_vm_cluster.test.resource_group_name + cloud_exadata_infrastructure_id = azurerm_oracledatabase_cloud_vm_cluster.test.cloud_exadata_infrastructure_id + cpu_core_count = azurerm_oracledatabase_cloud_vm_cluster.test.cpu_core_count + data_storage_size_in_tbs = azurerm_oracledatabase_cloud_vm_cluster.test.data_storage_size_in_tbs + db_node_storage_size_in_gbs = azurerm_oracledatabase_cloud_vm_cluster.test.db_node_storage_size_in_gbs + db_servers = azurerm_oracledatabase_cloud_vm_cluster.test.db_servers + display_name = azurerm_oracledatabase_cloud_vm_cluster.test.display_name + gi_version = azurerm_oracledatabase_cloud_vm_cluster.test.gi_version + license_model = azurerm_oracledatabase_cloud_vm_cluster.test.license_model + memory_size_in_gbs = azurerm_oracledatabase_cloud_vm_cluster.test.memory_size_in_gbs + hostname = azurerm_oracledatabase_cloud_vm_cluster.test.hostname + ssh_public_keys = azurerm_oracledatabase_cloud_vm_cluster.test.ssh_public_keys + subnet_id = azurerm_oracledatabase_cloud_vm_cluster.test.subnet_id + vnet_id = azurerm_oracledatabase_cloud_vm_cluster.test.vnet_id +} +`, a.basic(data)) +} + +func (a CloudVmClusterResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +data "azurerm_client_config" "current" {} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%[1]d" + location = "%[2]s" +} + +resource "azurerm_virtual_network" "virtual_network" { + name = "OFakeacctest%[1]d_vnet" + address_space = ["10.0.0.0/16"] + location = "%[2]s" + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_subnet" "virtual_network_subnet" { + name = "OFakeacctest%[1]d" + resource_group_name = azurerm_resource_group.test.name + virtual_network_name = azurerm_virtual_network.virtual_network.name + address_prefixes = ["10.0.1.0/24"] + + delegation { + name = "delegation" + + service_delegation { + actions = [ + "Microsoft.Network/networkinterfaces/*", + "Microsoft.Network/virtualNetworks/subnets/join/action", + ] + name = "Oracle.Database/networkAttachments" + } + } +} + +resource "azurerm_oracledatabase_exadata_infrastructure" "test" { + name = "OFakeacctest%[1]d" + location = "%[2]s" + resource_group_name = azurerm_resource_group.test.name + compute_count = "2" + display_name = "OFakeacctest%[1]d" + shape = "Exadata.X9M" + storage_count = "3" + zones = ["3"] +} + +data "azurerm_oracledatabase_db_servers" "test" { + resource_group_name = azurerm_resource_group.test.name + cloud_exadata_infrastructure_name = azurerm_oracledatabase_exadata_infrastructure.test.name +} + +`, data.RandomInteger, data.Locations.Primary, data.RandomString) +} diff --git a/internal/services/oracledatabase/db_servers_data_source.go b/internal/services/oracledatabase/db_servers_data_source.go new file mode 100644 index 000000000000..671f955e8070 --- /dev/null +++ b/internal/services/oracledatabase/db_servers_data_source.go @@ -0,0 +1,229 @@ +// Copyright © 2024, Oracle and/or its affiliates. All rights reserved + +package oracledatabase + +import ( + "context" + "fmt" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers" + "time" + + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type DBServersDataSource struct{} + +type DBServersDataModel struct { + DBServers []DBServerDataModel `tfschema:"db_servers"` +} + +type DBServerDataModel struct { + AutonomousVMClusterIds []string `tfschema:"autonomous_vm_cluster_ids"` + AutonomousVirtualMachineIds []string `tfschema:"autonomous_virtual_machine_ds"` + CompartmentId string `tfschema:"compartment_id"` + CpuCoreCount int64 `tfschema:"cpu_core_count"` + DbNodeIds []string `tfschema:"db_node_ids"` + DbNodeStorageSizeInGbs int64 `tfschema:"db_node_storage_size_in_gbs"` + DisplayName string `tfschema:"display_name"` + ExadataInfrastructureId string `tfschema:"exadata_infrastructure_id"` + LifecycleDetails string `tfschema:"lifecycle_details"` + LifecycleState string `tfschema:"lifecycle_state"` + MaxCPUCount int64 `tfschema:"max_cpu_count"` + MaxDbNodeStorageInGbs int64 `tfschema:"max_db_node_storage_in_gbs"` + MaxMemoryInGbs int64 `tfschema:"max_memory_in_gbs"` + MemorySizeInGbs int64 `tfschema:"memory_size_in_gbs"` + Ocid string `tfschema:"ocid"` + ProvisioningState string `tfschema:"provisioning_state"` + Shape string `tfschema:"shape"` + TimeCreated string `tfschema:"time_created"` + VMClusterIds []string `tfschema:"vm_cluster_ids"` +} + +func (d DBServersDataSource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "resource_group_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + "cloud_exadata_infrastructure_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + } +} + +func (d DBServersDataSource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "db_servers": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "autonomous_vm_cluster_ids": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "autonomous_virtual_machine_ds": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "compartment_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "cpu_core_count": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "db_node_ids": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "db_node_storage_size_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "display_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "exadata_infrastructure_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "lifecycle_details": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "lifecycle_state": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "max_cpu_count": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "max_db_node_storage_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "max_memory_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "memory_size_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "ocid": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "provisioning_state": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "shape": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_created": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "vm_cluster_ids": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + }, + }, + }, + } +} + +func (d DBServersDataSource) ModelObject() interface{} { + return nil +} + +func (d DBServersDataSource) ResourceType() string { + return "azurerm_oracledatabase_db_servers" +} + +func (d DBServersDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return dbservers.ValidateDbServerID +} + +func (d DBServersDataSource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.OracleDatabase.OracleDatabaseClient.DbServers + subscriptionId := metadata.Client.Account.SubscriptionId + + id := dbservers.NewCloudExadataInfrastructureID(subscriptionId, + metadata.ResourceData.Get("resource_group_name").(string), + metadata.ResourceData.Get("cloud_exadata_infrastructure_name").(string)) + + resp, err := client.ListByCloudExadataInfrastructure(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + if model := resp.Model; model != nil { + output := DBServersDataModel{ + DBServers: make([]DBServerDataModel, 0), + } + for _, element := range *model { + if element.Properties != nil { + properties := element.Properties + dbServer := DBServerDataModel{ + AutonomousVMClusterIds: pointer.From(properties.AutonomousVMClusterIds), + AutonomousVirtualMachineIds: pointer.From(properties.AutonomousVirtualMachineIds), + CompartmentId: pointer.From(properties.CompartmentId), + CpuCoreCount: pointer.From(properties.CpuCoreCount), + DbNodeIds: pointer.From(properties.DbNodeIds), + DbNodeStorageSizeInGbs: pointer.From(properties.DbNodeStorageSizeInGbs), + DisplayName: pointer.From(properties.DisplayName), + ExadataInfrastructureId: pointer.From(properties.ExadataInfrastructureId), + LifecycleDetails: pointer.From(properties.LifecycleDetails), + LifecycleState: string(pointer.From(properties.LifecycleState)), + MaxCPUCount: pointer.From(properties.MaxCPUCount), + MaxDbNodeStorageInGbs: pointer.From(properties.MaxDbNodeStorageInGbs), + MaxMemoryInGbs: pointer.From(properties.MaxMemoryInGbs), + MemorySizeInGbs: pointer.From(properties.MemorySizeInGbs), + Ocid: pointer.From(properties.Ocid), + ProvisioningState: string(pointer.From(properties.ProvisioningState)), + Shape: pointer.From(properties.Shape), + TimeCreated: pointer.From(properties.TimeCreated), + VMClusterIds: pointer.From(properties.VMClusterIds), + } + output.DBServers = append(output.DBServers, dbServer) + } + } + metadata.SetID(id) + if err := metadata.Encode(&output); err != nil { + return fmt.Errorf("encoding %s: %+v", id, err) + } + } + return nil + }, + } +} diff --git a/internal/services/oracledatabase/db_servers_data_source_test.go b/internal/services/oracledatabase/db_servers_data_source_test.go new file mode 100644 index 000000000000..3b6e74f6403d --- /dev/null +++ b/internal/services/oracledatabase/db_servers_data_source_test.go @@ -0,0 +1,50 @@ +// Copyright © 2024, Oracle and/or its affiliates. All rights reserved + +package oracledatabase_test + +import ( + "fmt" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "testing" +) + +type DBServersDataSource struct{} + +func TestDBServersDataSource_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "data.azurerm_oracledatabase_db_servers", "test") + r := DBServersDataSource{} + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("db_servers.0.compartment_id").Exists(), + ), + }, + }) +} + +func (d DBServersDataSource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` + +%s + +data "azurerm_oracledatabase_db_servers" "test" { + resource_group_name = "PowerShellTestRg" + cloud_exadata_infrastructure_name = "OFake_PowerShellTestExaInfra" +} +`, d.template(data)) +} + +func (d DBServersDataSource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +%s +provider "azurerm" { + features {} +} + +data "azurerm_client_config" "current" {} + +`, ExadataInfraResource{}.basic(data)) +} diff --git a/internal/services/oracledatabase/registration.go b/internal/services/oracledatabase/registration.go index 7182087c3cf5..368d414c12e3 100644 --- a/internal/services/oracledatabase/registration.go +++ b/internal/services/oracledatabase/registration.go @@ -15,12 +15,15 @@ var ( func (r Registration) DataSources() []sdk.DataSource { return []sdk.DataSource{ ExadataInfraDataSource{}, + CloudVmClusterDataSource{}, + DBServersDataSource{}, } } func (r Registration) Resources() []sdk.Resource { return []sdk.Resource{ ExadataInfraResource{}, + CloudVmClusterResource{}, } } diff --git a/website/docs/d/oracledatabase_cloud_vm_cluster.html.markdown b/website/docs/d/oracledatabase_cloud_vm_cluster.html.markdown new file mode 100644 index 000000000000..16f86e0726d1 --- /dev/null +++ b/website/docs/d/oracledatabase_cloud_vm_cluster.html.markdown @@ -0,0 +1,177 @@ +--- +subcategory: "App Service" +layout: "azurerm" +page_title: "Azure Resource Manager: Data Source: azurerm_oracledatabase_cloud_vm_cluster" +description: |- + Gets information about an existing Cloud VM Cluster. +--- + +# Data Source: azurerm_oracledatabase_cloud_vm_cluster + +Use this data source to access information about an existing Cloud VM Cluster. + +## Example Usage + +```hcl +data "azurerm_oracledatabase_cloud_vm_cluster" "example" { + name = "existing" + resource_group_name = "existing" +} + +output "id" { + value = data.azurerm_oracledatabase_cloud_vm_cluster.example.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name of this Cloud VM Cluster. + +* `resource_group_name` - (Required) The name of the Resource Group where the Cloud VM Cluster exists. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Cloud VM Cluster. + +* `backup_subnet_cidr` - Client OCI backup subnet CIDR, default is 192.168.252.0/22. + +* `cloud_exadata_infrastructure_id` - Cloud Exadata Infrastructure ID. + +* `cluster_name` - The cluster name for cloud VM cluster. + +* `compartment_id` - The OCID of the compartment. + +* `compute_nodes` - A `compute_nodes` block as defined below. + +* `cpu_core_count` - The number of CPU cores enabled on the cloud VM cluster. + +* `data_collection_options` - A `data_collection_options` block as defined below. + +* `data_storage_percentage` - The percentage assigned to DATA storage (user data and database files). The remaining percentage is assigned to RECO storage (database redo logs, archive logs, and recovery manager backups). Accepted values are 35, 40, 60 and 80. The default is 80 percent assigned to DATA storage. See [Storage Configuration](https://docs.oracle.com/en-us/iaas/exadatacloud/index.html#Exadata) in the Exadata documentation for details on the impact of the configuration settings on storage. + +* `data_storage_size_in_tbs` - The data disk group size to be allocated in TBs. + +* `db_node_storage_size_in_gbs` - The local node storage to be allocated in GBs. + +* `db_servers` - A `db_servers` block as defined below. + +* `disk_redundancy` - The type of redundancy configured for the cloud Vm cluster. NORMAL is 2-way redundancy. HIGH is 3-way redundancy. + +* `display_name` - The user-friendly name for the cloud VM cluster. The name does not need to be unique. + +* `domain` - The domain name for the cloud VM cluster. + +* `gi_version` - A valid Oracle Grid Infrastructure (GI) software version. + +* `hostname` - The hostname for the cloud VM cluster. + +* `iorm_config_cache` - A `iorm_config_cache` block as defined below. + +* `is_local_backup_enabled` - If true, database backup on local Exadata storage is configured for the cloud VM cluster. If false, database backup on local Exadata storage is not available in the cloud VM cluster. + +* `is_sparse_diskgroup_enabled` - If true, sparse disk group is configured for the cloud VM cluster. If false, sparse disk group is not created. + +* `last_update_history_entry_id` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the last maintenance update history entry. This value is updated when a maintenance update starts. + +* `license_model` - The Oracle license model that applies to the cloud VM cluster. + +* `lifecycle_details` - Additional information about the current lifecycle state. + +* `lifecycle_state` - Cloud VM Cluster lifecycle state enum. + +* `listener_port` - The port number configured for the listener on the cloud VM cluster. + +* `location` - The Azure Region where the Cloud VM Cluster exists. + +* `memory_size_in_gbs` - The memory to be allocated in GBs. + +* `node_count` - The number of nodes in the cloud VM cluster. + +* `nsg_url` - The list of [OCIDs](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) for the network security groups (NSGs) to which this resource belongs. Setting this to an empty list removes all resources from all NSGs. For more information about NSGs, see [Security Rules](https://docs.oracle.com/en-us/iaas/Content/Network/Concepts/securityrules.htm). NsgIds restrictions: + * A network security group (NSG) is optional for Autonomous Databases with private access. The nsgIds list can be empty. + +* `oci_url` - The URL of the resource in the OCI console. + +* `ocid` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the cloud VM cluster. + +* `ocpu_count` - The number of OCPU cores to enable on the cloud VM cluster. Only 1 decimal place is allowed for the fractional part. + +* `provisioning_state` - Azure resource provisioning state. + +* `scan_dns_name` - The FQDN of the DNS record for the SCAN IP addresses that are associated with the cloud VM cluster. + +* `scan_dns_record_id` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the DNS record for the SCAN IP addresses that are associated with the cloud VM cluster. + +* `scan_ip_ids` - A `scan_ip_ids` block as defined below. + +* `scan_listener_port_tcp` - The TCP Single Client Access Name (SCAN) port. The default port is 1521. + +* `scan_listener_port_tcp_ssl` - The TCPS Single Client Access Name (SCAN) port. The default port is 2484. + +* `shape` - The model name of the Exadata hardware running the cloud VM cluster. + +* `ssh_public_keys` - The public key portion of one or more key pairs used for SSH access to the cloud VM cluster. + +* `storage_size_in_gbs` - The storage allocation for the disk group, in gigabytes (GB). + +* `subnet_id` - The ID of the Azure Resource Manager subnet resource. + +* `subnet_ocid` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the subnet associated with the cloud VM cluster. + +* `system_data` - A `system_data` block as defined below. + +* `system_version` - Operating system version of the image. + +* `tags` - A mapping of tags assigned to the Cloud VM Cluster. + +* `time_created` - The date and time that the cloud VM cluster was created. + +* `time_zone` - The time zone of the cloud VM cluster. For details, see [Exadata Infrastructure Time Zones](https://docs.oracle.com/en-us/iaas/base-database/doc/manage-time-zone.html). + +* `vip_ods` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the virtual IP (VIP) addresses associated with the cloud VM cluster. The Cluster Ready Services (CRS) creates and maintains one VIP address for each node in the Exadata Cloud Service instance to enable failover. If one node fails, the VIP is reassigned to another active node in the cluster. **Note:** For a single-node DB system, this list is empty. + +* `vnet_id` - The ID to an Azure Resource Manager vnet resource. + +* `zone_id` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the zone the cloud VM cluster is associated with. + +--- + +A `data_collection_options` block exports the following: + +* `is_diagnostics_events_enabled` - Indicates whether diagnostic collection is enabled for the VM cluster/Cloud VM cluster/VMBM DBCS. Enabling diagnostic collection allows you to receive Events service notifications for guest VM issues. Diagnostic collection also allows Oracle to provide enhanced service and proactive support for your Exadata system. You can enable diagnostic collection during VM cluster/Cloud VM cluster provisioning. You can also disable or enable it at any time using the `UpdateVmCluster` or `updateCloudVmCluster` API. + +* `is_health_monitoring_enabled` - Indicates whether health monitoring is enabled for the VM cluster / Cloud VM cluster / VMBM DBCS. Enabling health monitoring allows Oracle to collect diagnostic data and share it with its operations and support personnel. You may also receive notifications for some events. Collecting health diagnostics enables Oracle to provide proactive support and enhanced service for your system. Optionally enable health monitoring while provisioning a system. You can also disable or enable health monitoring anytime using the `UpdateVmCluster`, `UpdateCloudVmCluster` or `updateDbsystem` API. + +* `is_incident_logs_enabled` - Indicates whether incident logs and trace collection are enabled for the VM cluster / Cloud VM cluster / VMBM DBCS. Enabling incident logs collection allows Oracle to receive Events service notifications for guest VM issues, collect incident logs and traces, and use them to diagnose issues and resolve them. Optionally enable incident logs collection while provisioning a system. You can also disable or enable incident logs collection anytime using the `UpdateVmCluster`, `updateCloudVmCluster` or `updateDbsystem` API. + +--- + +A `db_plans` block exports the following: + +* `db_name` - The database name. For the default `DbPlan`, the `dbName` is `default`. + +* `flash_cache_limit` - The flash cache limit for this database. This value is internally configured based on the share value assigned to the database. + +* `share` - The relative priority of this database. + +--- + +A `iorm_config_cache` block exports the following: + +* `db_plans` - A `db_plans` block as defined above. + +* `lifecycle_details` - Additional information about the current `lifecycleState`. + +* `lifecycle_state` - The current state of IORM configuration for the Exadata DB system. + +* `objective` - The current value for the IORM objective. The default is `AUTO`. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the Cloud VM Cluster. \ No newline at end of file diff --git a/website/docs/d/oracledatabase_db_servers.html.markdown b/website/docs/d/oracledatabase_db_servers.html.markdown new file mode 100644 index 000000000000..defc14dd898e --- /dev/null +++ b/website/docs/d/oracledatabase_db_servers.html.markdown @@ -0,0 +1,88 @@ +--- +subcategory: "App Service" +layout: "azurerm" +page_title: "Azure Resource Manager: Data Source: azurerm_oracledatabase_db_servers" +description: |- + Gets information about an existing DB Server. +--- + +# Data Source: azurerm_oracledatabase_db_servers + +Use this data source to access information about an existing DB Server. + +## Example Usage + +```hcl +data "azurerm_oracledatabase_db_servers" "example" { + resource_group_name = "existing" + cloud_exadata_infrastructure_name = "existing" +} + +output "id" { + value = data.azurerm_oracledatabase_db_servers.example.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `cloud_exadata_infrastructure_name` - (Required) The name of the ExadataInfrastructure. + +* `resource_group_name` - (Required) The name of the Resource Group where the DB Server exists. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the Exacc Db server. + +* `db_servers` - A `db_servers` block as defined below. + +--- + +A `db_servers` block exports the following: + +* `autonomous_virtual_machine_ds` - The list of [OCIDs](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the Autonomous Virtual Machines associated with the Db server. + +* `autonomous_vm_cluster_ids` - The list of [OCIDs](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the Autonomous VM Clusters associated with the Db server. + +* `compartment_id` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the compartment. + +* `cpu_core_count` - The number of CPU cores enabled on the Db server. + +* `db_node_ids` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the Db nodes associated with the Db server. + +* `db_node_storage_size_in_gbs` - The allocated local node storage in GBs on the Db server. + +* `display_name` - The user-friendly name for the Db server. The name does not need to be unique. + +* `exadata_infrastructure_id` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the Exadata infrastructure. + +* `lifecycle_details` - Additional information about the current lifecycle state. + +* `lifecycle_state` - The current state of the DB server. + +* `max_cpu_count` - The total number of CPU cores available. + +* `max_db_node_storage_in_gbs` -The total local node storage available in GBs. + +* `max_memory_in_gbs` - The total memory available in GBs. + +* `memory_size_in_gbs` - The allocated memory in GBs on the Db server. + +* `ocid` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the DB server. + +* `provisioning_state` - DbServer provisioning state. + +* `shape` - The shape of the Db server. The shape determines the amount of CPU, storage, and memory resources available. + +* `time_created` - The date and time that the Db Server was created. + +* `vm_cluster_ids` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the VM Clusters associated with the Db server. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the DB Server. \ No newline at end of file diff --git a/website/docs/r/oracledatabase_cloud_vm_cluster.html.markdown b/website/docs/r/oracledatabase_cloud_vm_cluster.html.markdown new file mode 100644 index 000000000000..3193330527ab --- /dev/null +++ b/website/docs/r/oracledatabase_cloud_vm_cluster.html.markdown @@ -0,0 +1,165 @@ +--- +subcategory: "App Service" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_oracledatabase_cloud_vm_cluster" +description: |- + Manages a Cloud VM Cluster. +--- + +# azurerm_oracledatabase_cloud_vm_cluster + +Manages a Cloud VM Cluster. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_oracledatabase_exadata_infrastructure" "example" { + name = "example-exadata-infrastructure" + display_name = "example-exadata-infrastructure" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + shape = "Exadata.X9M" + storage_count = "3" + compute_count = "2" + zones = ["3"] +} + +resource "azurerm_virtual_network" "example" { + name = "example-virtual-network" + address_space = ["10.0.0.0/16"] + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name +} + +resource "azurerm_subnet" "example" { + name = "example-subnet" + resource_group_name = azurerm_resource_group.example.name + virtual_network_name = azurerm_virtual_network.example.name + address_prefixes = ["10.0.1.0/24"] + + delegation { + name = "delegation" + + service_delegation { + actions = [ + "Microsoft.Network/networkinterfaces/*", + "Microsoft.Network/virtualNetworks/subnets/join/action", + ] + name = "Oracle.Database/networkAttachments" + } + } +} + +data "azurerm_oracledatabase_db_servers" "example" { + resource_group_name = azurerm_resource_group.example.name + cloud_exadata_infrastructure_name = azurerm_oracledatabase_exadata_infrastructure.example.name +} + +resource "azurerm_oracledatabase_cloud_vm_cluster" "example" { + name = "example-cloud-vm-cluster" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + gi_version = "23.0.0.0" + vnet_id = azurerm_virtual_network.example.id + license_model = "BringYourOwnLicense" + db_servers = [for obj in data.azurerm_oracledatabase_db_servers.example.db_servers : obj.ocid] + ssh_public_keys = [ file("~/.ssh/id_rsa.pub") ] + display_name = "example-cloud-vm-cluster" + cloud_exadata_infrastructure_id = azurerm_oracledatabase_exadata_infrastructure.example.id + cpu_core_count = 2 + hostname = "hostname" + subnet_id = azurerm_subnet.example.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `cloud_exadata_infrastructure_id` - (Required) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the cloud Exadata infrastructure. + +* `cpu_core_count` - (Required) The number of CPU cores enabled on the cloud VM cluster. + +* `db_servers` - (Required) The list of DB servers. + +* `display_name` - (Required) The user-friendly name for the cloud VM cluster. The name does not need to be unique.. + +* `gi_version` - (Required) A valid Oracle Grid Infrastructure (GI) software version. + +* `hostname` - (Required) The hostname for the cloud VM cluster. + +* `license_model` - (Required) The Oracle license model that applies to the cloud VM cluster, either `BringYourOwnLicense` or `LicenseIncluded`. + +* `location` - (Required) The Azure Region where the Cloud VM Cluster should exist. + +* `name` - (Required) The name which should be used for this Cloud VM Cluster. + +* `resource_group_name` - (Required) The name of the Resource Group where the Cloud VM Cluster should exist. + +* `ssh_public_keys` - (Required) The public key portion of one or more key pairs used for SSH access to the cloud VM cluster. + +* `subnet_id` - (Required) The ID of the subnet associated with the cloud VM cluster. + +* `vnet_id` - (Required) The ID of the vnet associated with the cloud VM cluster. + +--- + +* `backup_subnet_cidr` - (Optional) The backup subnet CIDR of the vnet associated with the cloud VM cluster.. + +* `cluster_name` - (Optional) The cluster name for cloud VM cluster. + +* `data_collection_options` - (Optional) A `data_collection_options` block as defined below. + +* `data_storage_percentage` - (Optional) The percentage assigned to DATA storage (user data and database files). The remaining percentage is assigned to RECO storage (database redo logs, archive logs, and recovery manager backups). Accepted values are 35, 40, 60 and 80. + +* `data_storage_size_in_tbs` - (Optional) The data disk group size to be allocated in TBs. + +* `db_node_storage_size_in_gbs` - (Optional) The local node storage to be allocated in GBs. + +* `is_local_backup_enabled` - (Optional) If true, database backup on local Exadata storage is configured for the cloud VM cluster. If false, database backup on local Exadata storage is not available in the cloud VM cluster. + +* `is_sparse_diskgroup_enabled` - (Optional) If true, the sparse disk group is configured for the cloud VM cluster. If false, the sparse disk group is not created. + +* `memory_size_in_gbs` - (Optional) The memory to be allocated in GBs. + +* `tags` - (Optional) A mapping of tags which should be assigned to the Cloud VM Cluster. + +* `time_zone` - (Optional) The time zone of the cloud VM cluster. For details, see [Exadata Infrastructure Time Zones](https://docs.cloud.oracle.com/iaas/Content/Database/References/timezones.htm). + +--- + +A `data_collection_options` block supports the following: + +* `is_diagnostics_events_enabled` - (Optional) Indicates whether diagnostic collection is enabled for the VM cluster/Cloud VM cluster/VMBM DBCS. Enabling diagnostic collection allows you to receive Events service notifications for guest VM issues. Diagnostic collection also allows Oracle to provide enhanced service and proactive support for your Exadata system. You can enable diagnostic collection during VM cluster/Cloud VM cluster provisioning. You can also disable or enable it at any time using the `UpdateVmCluster` or `updateCloudVmCluster` API. + +* `is_health_monitoring_enabled` - (Optional) Indicates whether health monitoring is enabled for the VM cluster / Cloud VM cluster / VMBM DBCS. Enabling health monitoring allows Oracle to collect diagnostic data and share it with its operations and support personnel. You may also receive notifications for some events. Collecting health diagnostics enables Oracle to provide proactive support and enhanced service for your system. Optionally enable health monitoring while provisioning a system. You can also disable or enable health monitoring anytime using the `UpdateVmCluster`, `UpdateCloudVmCluster` or `updateDbsystem` API. + +* `is_incident_logs_enabled` - (Optional) Indicates whether incident logs and trace collection are enabled for the VM cluster / Cloud VM cluster / VMBM DBCS. Enabling incident logs collection allows Oracle to receive Events service notifications for guest VM issues, collect incident logs and traces, and use them to diagnose issues and resolve them. Optionally enable incident logs collection while provisioning a system. You can also disable or enable incident logs collection anytime using the `UpdateVmCluster`, `updateCloudVmCluster` or `updateDbsystem` API. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Cloud VM Cluster. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Cloud VM Cluster. +* `read` - (Defaults to 5 minutes) Used when retrieving the Cloud VM Cluster. +* `update` - (Defaults to 30 minutes) Used when updating the Cloud VM Cluster. +* `delete` - (Defaults to 30 minutes) Used when deleting the Cloud VM Cluster. + +## Import + +Cloud VM Clusters can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_oracledatabase_cloud_vm_cluster.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup/providers/Oracle.Database/cloudVmClusters/cloudVmClusters1 +``` \ No newline at end of file From ac87fb38349a9b57b25e424e9805aa808490057d Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Mon, 12 Aug 2024 16:20:19 +0100 Subject: [PATCH 03/43] * Update. --- .../oracledatabase/db_servers_data_source_test.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/internal/services/oracledatabase/db_servers_data_source_test.go b/internal/services/oracledatabase/db_servers_data_source_test.go index 3b6e74f6403d..1b84da59b6ea 100644 --- a/internal/services/oracledatabase/db_servers_data_source_test.go +++ b/internal/services/oracledatabase/db_servers_data_source_test.go @@ -31,8 +31,8 @@ func (d DBServersDataSource) basic(data acceptance.TestData) string { %s data "azurerm_oracledatabase_db_servers" "test" { - resource_group_name = "PowerShellTestRg" - cloud_exadata_infrastructure_name = "OFake_PowerShellTestExaInfra" + resource_group_name = azurerm_resource_group.test.name + cloud_exadata_infrastructure_name = azurerm_oracledatabase_exadata_infrastructure.test.name } `, d.template(data)) } @@ -40,11 +40,6 @@ data "azurerm_oracledatabase_db_servers" "test" { func (d DBServersDataSource) template(data acceptance.TestData) string { return fmt.Sprintf(` %s -provider "azurerm" { - features {} -} - -data "azurerm_client_config" "current" {} `, ExadataInfraResource{}.basic(data)) } From 4ae5b295761c9d304e82d18d57c7e2cb195c6eb3 Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Fri, 23 Aug 2024 09:42:28 +0100 Subject: [PATCH 04/43] * Implement ADBS resource and data source. --- .../autonomous_database_clone_data_source.go | 561 ++++++++++++++++++ .../autonomous_database_clone_resource.go | 276 +++++++++ ...autonomous_database_clone_resource_test.go | 209 +++++++ ...autonomous_database_regular_data_source.go | 509 ++++++++++++++++ .../autonomous_database_regular_resource.go | 276 +++++++++ ...tonomous_database_regular_resource_test.go | 209 +++++++ .../services/oracledatabase/registration.go | 4 + 7 files changed, 2044 insertions(+) create mode 100644 internal/services/oracledatabase/autonomous_database_clone_data_source.go create mode 100644 internal/services/oracledatabase/autonomous_database_clone_resource.go create mode 100644 internal/services/oracledatabase/autonomous_database_clone_resource_test.go create mode 100644 internal/services/oracledatabase/autonomous_database_regular_data_source.go create mode 100644 internal/services/oracledatabase/autonomous_database_regular_resource.go create mode 100644 internal/services/oracledatabase/autonomous_database_regular_resource_test.go diff --git a/internal/services/oracledatabase/autonomous_database_clone_data_source.go b/internal/services/oracledatabase/autonomous_database_clone_data_source.go new file mode 100644 index 000000000000..0c72d6a5c6d1 --- /dev/null +++ b/internal/services/oracledatabase/autonomous_database_clone_data_source.go @@ -0,0 +1,561 @@ +// Copyright © 2024, Oracle and/or its affiliates. All rights reserved + +package oracledatabase + +import ( + "context" + "fmt" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters" + "github.com/hashicorp/terraform-provider-azurerm/utils" + "time" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type AutonomousDatabaseCloneDataSource struct{} + +type AutonomousDatabaseCloneModel struct { + Name string `tfschema:"name"` + Type string `tfschema:"type"` + Tags map[string]interface{} `tfschema:"tags"` + + // SystemData + SystemData []SystemDataModel `tfschema:"system_data"` + + // AutonomousDatabaseCloneProperties + CloneType string `tfschema:"clone_type"` + IsReconnectCloneEnabled bool `tfschema:"is_reconnect_clone_enabled"` + IsRefreshableClone bool `tfschema:"is_refreshable_clone"` + RefreshableModel string `tfschema:"refreshable_model"` + RefreshableStatus string `tfschema:"refreshable_status"` + Source string `tfschema:"source"` + SourceId string `tfschema:"source_id"` + TimeUntilReconnectCloneEnabled string `tfschema:"time_until_reconnect_clone_enabled"` + + // AutonomousDatabaseProperties + ActualUsedDataStorageSizeInTbs float64 `tfschema:"actual_used_data_storage_size_in_tbs"` + AdminPassword string `tfschema:"admin_password"` + AllocatedStorageSizeInTbs float64 `tfschema:"allocated_storage_size_in_tbs"` + AutonomousDatabaseId string `tfschema:"autonomous_database_id"` + AvailableUpgradeVersions []string `tfschema:"available_upgrade_versions"` + BackupRetentionPeriodInDays int64 `tfschema:"backup_retention_period_in_days"` + CharacterSet string `tfschema:"character_set"` + ComputeCount float64 `tfschema:"compute_count"` + CpuCoreCount int64 `tfschema:"cpu_core_count"` + DataStorageSizeInGbs int64 `tfschema:"data_storage_size_in_gbs"` + DataStorageSizeInTbs int64 `tfschema:"data_storage_size_in_tbs"` + DbVersion string `tfschema:"db_version"` + DisplayName string `tfschema:"display_name"` + FailedDataRecoveryInSeconds int64 `tfschema:"failed_data_recovery_in_seconds"` + InMemoryAreaInGbs int64 `tfschema:"in_memory_area_in_gbs"` + IsAutoScalingEnabled bool `tfschema:"is_auto_scaling_enabled"` + IsAutoScalingForStorageEnabled bool `tfschema:"is_auto_scaling_for_storage_enabled"` + IsLocalDataGuardEnabled bool `tfschema:"is_local_data_guard_enabled"` + IsMtlsConnectionRequired bool `tfschema:"is_mtls_connection_required"` + IsPreview bool `tfschema:"is_preview"` + IsPreviewVersionWithServiceTermsAccepted bool `tfschema:"is_preview_version_with_service_terms_accepted"` + IsRemoteDataGuardEnabled bool `tfschema:"is_remote_data_guard_enabled"` + LifecycleDetails string `tfschema:"lifecycle_details"` + LocalAdgAutoFailoverMaxDataLossLimit int64 `tfschema:"local_adg_auto_failover_max_data_loss_limit"` + MemoryPerOracleComputeUnitInGbs int64 `tfschema:"memory_per_oracle_compute_unit_in_gbs"` + NcharacterSet string `tfschema:"ncharacter_set"` + NextLongTermBackupTimeStamp string `tfschema:"next_long_term_backup_time_stamp"` + OciUrl string `tfschema:"oci_url"` + Ocid string `tfschema:"ocid"` + PeerDbId string `tfschema:"peer_db_id"` + PeerDbIds []string `tfschema:"peer_db_ids"` + PrivateEndpoint string `tfschema:"private_endpoint"` + PrivateEndpointIP string `tfschema:"private_endpoint_ip"` + PrivateEndpointLabel string `tfschema:"private_endpoint_label"` + ProvisionableCPUs []int64 `tfschema:"provisionable_cpus"` + ServiceConsoleUrl string `tfschema:"service_console_url"` + SqlWebDeveloperUrl string `tfschema:"sql_web_developer_url"` + SubnetId string `tfschema:"subnet_id"` + SupportedRegionsToCloneTo []string `tfschema:"supported_regions_to_clone_to"` + TimeCreated string `tfschema:"time_created"` + TimeDataGuardRoleChanged string `tfschema:"time_data_guard_role_changed"` + TimeDeletionOfFreeAutonomousDatabase string `tfschema:"time_deletion_of_free_autonomous_database"` + TimeLocalDataGuardEnabled string `tfschema:"time_local_data_guard_enabled"` + TimeMaintenanceBegin string `tfschema:"time_maintenance_begin"` + TimeMaintenanceEnd string `tfschema:"time_maintenance_end"` + TimeOfLastFailover string `tfschema:"time_of_last_failover"` + TimeOfLastRefresh string `tfschema:"time_of_last_refresh"` + TimeOfLastRefreshPoint string `tfschema:"time_of_last_refresh_point"` + TimeOfLastSwitchover string `tfschema:"time_of_last_switchover"` + TimeReclamationOfFreeAutonomousDatabase string `tfschema:"time_reclamation_of_free_autonomous_database"` + UsedDataStorageSizeInGbs int64 `tfschema:"used_data_storage_size_in_gbs"` + UsedDataStorageSizeInTbs int64 `tfschema:"used_data_storage_size_in_tbs"` + VnetId string `tfschema:"vnet_id"` + WhitelistedIPs []string `tfschema:"whitelisted_ips"` +} + +func (d AutonomousDatabaseCloneDataSource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + } +} + +func (d AutonomousDatabaseCloneDataSource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "location": commonschema.LocationComputed(), + "type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "tags": commonschema.TagsDataSource(), + + // SystemData + "system_data": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "created_by": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "created_by_type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "created_at": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "last_modified_by": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "last_modified_by_type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "last_modified_at": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + // AutonomousDatabaseCloneProperties + "clone_type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "is_reconnect_clone_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "is_refreshable_clone": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "refreshable_model": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "refreshable_status": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "source": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "source_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_until_reconnect_clone_enabled": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + // AutonomousDatabaseProperties + "actual_used_data_storage_size_in_tbs": { + Type: pluginsdk.TypeFloat, + Computed: true, + }, + "admin_password": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "allocated_storage_size_in_tbs": { + Type: pluginsdk.TypeFloat, + Computed: true, + }, + "autonomous_database_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "available_upgrade_versions": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "backup_retention_period_in_days": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "character_set": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "compute_count": { + Type: pluginsdk.TypeFloat, + Computed: true, + }, + "cpu_core_count": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "db_node_storage_size_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "data_storage_size_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "data_storage_size_in_tbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "db_version": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "display_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "failed_data_recovery_in_seconds": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "in_memory_area_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "is_auto_scaling_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "is_auto_scaling_for_storage_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "is_local_data_guard_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "is_mtls_connection_required": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "is_preview": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "is_preview_version_with_service_terms_accepted": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "is_remote_data_guard_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "lifecycle_details": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "local_adg_auto_failover_max_data_loss_limit": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "memory_per_oracle_compute_unit_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "ncharacter_set": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "next_long_term_backup_time_stamp": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "oci_url": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "ocid": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "peer_db_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "peer_db_ids": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "private_endpoint": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "private_endpoint_ip": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "private_endpoint_label": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "provisionable_cpus": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeInt, + }, + }, + "service_console_url": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "sql_web_developer_url": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "subnet_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "supported_regions_to_clone_to": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeInt, + }, + }, + "time_created": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_data_guard_role_changed": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_deletion_of_free_autonomous_database": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_local_data_guard_enabled": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_maintenance_begin": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_maintenance_end": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_of_last_failover": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_of_last_refresh": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_of_last_refresh_point": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_of_last_switchover": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_reclamation_of_free_autonomous_database": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "used_data_storage_size_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "used_data_storage_size_in_tbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "vnet_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "whitelisted_ips": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeInt, + }, + }, + } +} + +func (d AutonomousDatabaseCloneDataSource) ModelObject() interface{} { + return nil +} + +func (d AutonomousDatabaseCloneDataSource) ResourceType() string { + return "azurerm_oracledatabase_autonomous_database_clone" +} + +func (d AutonomousDatabaseCloneDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return cloudvmclusters.ValidateCloudVMClusterID +} + +func (d AutonomousDatabaseCloneDataSource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases + subscriptionId := metadata.Client.Account.SubscriptionId + + id := autonomousdatabases.NewAutonomousDatabaseID(subscriptionId, + metadata.ResourceData.Get("resource_group_name").(string), + metadata.ResourceData.Get("name").(string)) + + resp, err := client.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + if model := resp.Model; model != nil { + + err := metadata.ResourceData.Set("location", location.NormalizeNilable(&model.Location)) + if err != nil { + return err + } + + var output AutonomousDatabaseCloneModel + prop := model.Properties + + output = AutonomousDatabaseCloneModel{} + + if prop != nil { + switch adbsPropModel := prop.(type) { + case autonomousdatabases.AutonomousDatabaseCloneProperties: + output = AutonomousDatabaseCloneModel{ + CloneType: string(adbsPropModel.CloneType), + IsReconnectCloneEnabled: pointer.From(adbsPropModel.IsReconnectCloneEnabled), + IsRefreshableClone: pointer.From(adbsPropModel.IsRefreshableClone), + RefreshableModel: string(pointer.From(adbsPropModel.RefreshableModel)), + Source: string(pointer.From(adbsPropModel.Source)), + SourceId: adbsPropModel.SourceId, + TimeUntilReconnectCloneEnabled: pointer.From(adbsPropModel.TimeUntilReconnectCloneEnabled), + ActualUsedDataStorageSizeInTbs: pointer.From(adbsPropModel.ActualUsedDataStorageSizeInTbs), + AdminPassword: pointer.From(adbsPropModel.AdminPassword), + AllocatedStorageSizeInTbs: pointer.From(adbsPropModel.AllocatedStorageSizeInTbs), + AutonomousDatabaseId: pointer.From(adbsPropModel.AutonomousDatabaseId), + AvailableUpgradeVersions: pointer.From(adbsPropModel.AvailableUpgradeVersions), + BackupRetentionPeriodInDays: pointer.From(adbsPropModel.BackupRetentionPeriodInDays), + CharacterSet: pointer.From(adbsPropModel.CharacterSet), + ComputeCount: pointer.From(adbsPropModel.ComputeCount), + CpuCoreCount: pointer.From(adbsPropModel.CpuCoreCount), + DataStorageSizeInGbs: pointer.From(adbsPropModel.DataStorageSizeInGbs), + DataStorageSizeInTbs: pointer.From(adbsPropModel.DataStorageSizeInTbs), + DbVersion: pointer.From(adbsPropModel.DbVersion), + DisplayName: pointer.From(adbsPropModel.DisplayName), + FailedDataRecoveryInSeconds: pointer.From(adbsPropModel.FailedDataRecoveryInSeconds), + InMemoryAreaInGbs: pointer.From(adbsPropModel.InMemoryAreaInGbs), + IsAutoScalingEnabled: pointer.From(adbsPropModel.IsAutoScalingEnabled), + IsAutoScalingForStorageEnabled: pointer.From(adbsPropModel.IsAutoScalingForStorageEnabled), + IsLocalDataGuardEnabled: pointer.From(adbsPropModel.IsLocalDataGuardEnabled), + IsMtlsConnectionRequired: pointer.From(adbsPropModel.IsMtlsConnectionRequired), + IsPreview: pointer.From(adbsPropModel.IsPreview), + IsPreviewVersionWithServiceTermsAccepted: pointer.From(adbsPropModel.IsPreviewVersionWithServiceTermsAccepted), + IsRemoteDataGuardEnabled: pointer.From(adbsPropModel.IsRemoteDataGuardEnabled), + LifecycleDetails: pointer.From(adbsPropModel.LifecycleDetails), + LocalAdgAutoFailoverMaxDataLossLimit: pointer.From(adbsPropModel.LocalAdgAutoFailoverMaxDataLossLimit), + MemoryPerOracleComputeUnitInGbs: pointer.From(adbsPropModel.MemoryPerOracleComputeUnitInGbs), + NcharacterSet: pointer.From(adbsPropModel.NcharacterSet), + NextLongTermBackupTimeStamp: pointer.From(adbsPropModel.NextLongTermBackupTimeStamp), + OciUrl: pointer.From(adbsPropModel.OciUrl), + Ocid: pointer.From(adbsPropModel.Ocid), + PeerDbId: pointer.From(adbsPropModel.PeerDbId), + PeerDbIds: pointer.From(adbsPropModel.PeerDbIds), + PrivateEndpoint: pointer.From(adbsPropModel.PrivateEndpoint), + PrivateEndpointIP: pointer.From(adbsPropModel.PrivateEndpointIP), + PrivateEndpointLabel: pointer.From(adbsPropModel.PrivateEndpointLabel), + ProvisionableCPUs: pointer.From(adbsPropModel.ProvisionableCPUs), + ServiceConsoleUrl: pointer.From(adbsPropModel.ServiceConsoleUrl), + SqlWebDeveloperUrl: pointer.From(adbsPropModel.SqlWebDeveloperUrl), + SubnetId: pointer.From(adbsPropModel.SubnetId), + SupportedRegionsToCloneTo: pointer.From(adbsPropModel.SupportedRegionsToCloneTo), + TimeCreated: pointer.From(adbsPropModel.TimeCreated), + TimeDataGuardRoleChanged: pointer.From(adbsPropModel.TimeDataGuardRoleChanged), + TimeDeletionOfFreeAutonomousDatabase: pointer.From(adbsPropModel.TimeDeletionOfFreeAutonomousDatabase), + TimeLocalDataGuardEnabled: pointer.From(adbsPropModel.TimeLocalDataGuardEnabled), + TimeMaintenanceBegin: pointer.From(adbsPropModel.TimeMaintenanceBegin), + TimeMaintenanceEnd: pointer.From(adbsPropModel.TimeMaintenanceEnd), + TimeOfLastFailover: pointer.From(adbsPropModel.TimeOfLastFailover), + TimeOfLastRefresh: pointer.From(adbsPropModel.TimeOfLastRefresh), + TimeOfLastRefreshPoint: pointer.From(adbsPropModel.TimeOfLastRefreshPoint), + TimeOfLastSwitchover: pointer.From(adbsPropModel.TimeOfLastSwitchover), + TimeReclamationOfFreeAutonomousDatabase: pointer.From(adbsPropModel.TimeReclamationOfFreeAutonomousDatabase), + UsedDataStorageSizeInGbs: pointer.From(adbsPropModel.UsedDataStorageSizeInGbs), + UsedDataStorageSizeInTbs: pointer.From(adbsPropModel.UsedDataStorageSizeInTbs), + VnetId: pointer.From(adbsPropModel.VnetId), + WhitelistedIPs: pointer.From(adbsPropModel.WhitelistedIPs), + } + default: + return fmt.Errorf("unexpected Autonomous Database type, must be of type Clone") + } + } + + systemData := model.SystemData + if systemData != nil { + output.SystemData = []SystemDataModel{ + { + CreatedBy: systemData.CreatedBy, + CreatedByType: systemData.CreatedByType, + CreatedAt: systemData.CreatedAt, + LastModifiedBy: systemData.LastModifiedBy, + LastModifiedbyType: systemData.LastModifiedbyType, + LastModifiedAt: systemData.LastModifiedAt, + }, + } + } + output.Name = id.AutonomousDatabaseName + output.Type = pointer.From(model.Type) + output.Tags = utils.FlattenPtrMapStringString(model.Tags) + + metadata.SetID(id) + return metadata.Encode(&output) + } + return nil + }, + } +} diff --git a/internal/services/oracledatabase/autonomous_database_clone_resource.go b/internal/services/oracledatabase/autonomous_database_clone_resource.go new file mode 100644 index 000000000000..ae5f14dcfdbe --- /dev/null +++ b/internal/services/oracledatabase/autonomous_database_clone_resource.go @@ -0,0 +1,276 @@ +// Copyright © 2024, Oracle and/or its affiliates. All rights reserved + +package oracledatabase + +import ( + "context" + "fmt" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases" + "time" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +var _ sdk.Resource = AdbsCloneResource{} + +type AdbsCloneResource struct{} + +type AdbsCloneResourceModel struct { + Location string `tfschema:"location"` + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Tags map[string]interface{} `tfschema:"tags"` + + DisplayName string `tfschema:"display_name"` + SubnetId string `tfschema:"subnet_id"` + ComputeModel string `tfschema:"compute_model"` + ComputeCount float64 `tfschema:"compute_count"` + LicenseModel string `tfschema:"license_model"` + DataStorageSizeInGbs int64 `tfschema:"data_storage_size_in_gbs"` + DbWorkload string `tfschema:"db_workload"` + AdminPassword string `tfschema:"admin_password"` + DbVersion string `tfschema:"db_version"` + CharacterSet string `tfschema:"character_set"` + NcharacterSet string `tfschema:"ncharacter_set"` + VnetId string `tfschema:"vnet_id"` +} + +func (AdbsCloneResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "location": commonschema.Location(), + "tags": commonschema.Tags(), + "resource_group_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + // AdbsCloneResource + "display_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + "subnet_id": { + Type: pluginsdk.TypeString, + Required: true, + }, + "compute_model": { + Type: pluginsdk.TypeString, + Required: true, + }, + "compute_count": { + Type: pluginsdk.TypeFloat, + Required: true, + }, + "license_model": { + Type: pluginsdk.TypeString, + Required: true, + }, + "data_storage_size_in_gbs": { + Type: pluginsdk.TypeInt, + Required: true, + }, + "db_workload": { + Type: pluginsdk.TypeString, + Required: true, + }, + "admin_password": { + Type: pluginsdk.TypeString, + Required: true, + }, + "db_version": { + Type: pluginsdk.TypeString, + Required: true, + }, + "character_set": { + Type: pluginsdk.TypeString, + Required: true, + }, + "ncharacter_set": { + Type: pluginsdk.TypeString, + Required: true, + }, + "vnet_id": { + Type: pluginsdk.TypeString, + Required: true, + }, + } +} + +func (AdbsCloneResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (AdbsCloneResource) ModelObject() interface{} { + return &AdbsCloneResource{} +} + +func (AdbsCloneResource) ResourceType() string { + return "azurerm_oracledatabase_autonomous_database_clone" +} + +func (r AdbsCloneResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases + subscriptionId := metadata.Client.Account.SubscriptionId + + var model AdbsCloneResourceModel + if err := metadata.Decode(&model); err != nil { + return err + } + + id := autonomousdatabases.NewAutonomousDatabaseID(subscriptionId, + model.ResourceGroupName, + model.Name) + + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + param := autonomousdatabases.AutonomousDatabase{ + Name: pointer.To(model.Name), + Location: model.Location, + Tags: tags.Expand(model.Tags), + Properties: &autonomousdatabases.AutonomousDatabaseCloneProperties{ + DisplayName: pointer.To(model.DisplayName), + SubnetId: pointer.To(model.SubnetId), + ComputeModel: pointer.To(autonomousdatabases.ComputeModel(model.ComputeModel)), + ComputeCount: pointer.To(model.ComputeCount), + LicenseModel: pointer.To(autonomousdatabases.LicenseModel(model.LicenseModel)), + DataStorageSizeInGbs: pointer.To(model.DataStorageSizeInGbs), + DbWorkload: pointer.To(autonomousdatabases.WorkloadType(model.DbWorkload)), + AdminPassword: pointer.To(model.AdminPassword), + DbVersion: pointer.To(model.DbVersion), + CharacterSet: pointer.To(model.CharacterSet), + NcharacterSet: pointer.To(model.NcharacterSet), + VnetId: pointer.To(model.VnetId), + }, + } + + if err := client.CreateOrUpdateThenPoll(ctx, id, param); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r AdbsCloneResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + + client := metadata.Client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases + id, err := autonomousdatabases.ParseAutonomousDatabaseID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model AdbsCloneResourceModel + if err = metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding err: %+v", err) + } + + existing, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving exists when updating: +%v", *id) + } + if existing.Model == nil && existing.Model.Properties == nil { + return fmt.Errorf("retrieving as nil when updating for %v", *id) + } + + upd := existing.Model + + err = client.CreateOrUpdateThenPoll(ctx, *id, *upd) + if err != nil { + return fmt.Errorf("updating %s: %v", id, err) + } + return nil + }, + } +} + +func (AdbsCloneResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + id, err := autonomousdatabases.ParseAutonomousDatabaseID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + client := metadata.Client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases + result, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(result.HttpResponse) { + return metadata.MarkAsGone(id) + } + return err + } + + if result.Model == nil { + return fmt.Errorf("retrieving %s got nil model", id) + } + prop := result.Model.Properties + switch adbsPropModel := prop.(type) { + case autonomousdatabases.AutonomousDatabaseCloneProperties: + var output AdbsCloneResourceModel + output.DisplayName = pointer.From(adbsPropModel.DisplayName) + output.ComputeModel = string(pointer.From(adbsPropModel.ComputeModel)) + output.ComputeCount = pointer.From(adbsPropModel.ComputeCount) + output.LicenseModel = string(pointer.From(adbsPropModel.LicenseModel)) + output.DataStorageSizeInGbs = pointer.From(adbsPropModel.DataStorageSizeInGbs) + output.DbWorkload = string(pointer.From(adbsPropModel.DbWorkload)) + output.AdminPassword = pointer.From(adbsPropModel.AdminPassword) + output.DbVersion = pointer.From(adbsPropModel.DbVersion) + output.CharacterSet = pointer.From(adbsPropModel.CharacterSet) + output.NcharacterSet = pointer.From(adbsPropModel.NcharacterSet) + output.VnetId = pointer.From(adbsPropModel.VnetId) + + return metadata.Encode(&output) + default: + return fmt.Errorf("unexpected Autonomous Database type, must be of type Clone") + } + }, + } +} + +func (AdbsCloneResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases + + id, err := autonomousdatabases.ParseAutonomousDatabaseID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if err = client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (AdbsCloneResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return autonomousdatabases.ValidateAutonomousDatabaseID +} diff --git a/internal/services/oracledatabase/autonomous_database_clone_resource_test.go b/internal/services/oracledatabase/autonomous_database_clone_resource_test.go new file mode 100644 index 000000000000..a87319077eba --- /dev/null +++ b/internal/services/oracledatabase/autonomous_database_clone_resource_test.go @@ -0,0 +1,209 @@ +// Copyright © 2024, Oracle and/or its affiliates. All rights reserved + +package oracledatabase_test + +import ( + "context" + "fmt" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracledatabase" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" + "testing" +) + +type AdbsCloneResource struct{} + +func (a AdbsCloneResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := autonomousdatabases.ParseAutonomousDatabaseID(state.ID) + if err != nil { + return nil, err + } + resp, err := client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases.Get(ctx, *id) + if err != nil { + return nil, fmt.Errorf("retrieving adbs %s: %+v", id, err) + } + return utils.Bool(resp.Model != nil), nil +} + +func (a AdbsCloneResource) Destroy(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := autonomousdatabases.ParseAutonomousDatabaseID(state.ID) + if err != nil { + return nil, err + } + if _, err := client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases.Delete(ctx, *id); err != nil { + return nil, fmt.Errorf("deleting adbs %s: %+v", id, err) + } + return utils.Bool(true), nil +} + +func TestAdbsCloneResource_basic(t *testing.T) { + data := acceptance.BuildTestData(t, oracledatabase.AdbsCloneResource{}.ResourceType(), "test") + r := AdbsCloneResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAdbsCloneResource_update(t *testing.T) { + data := acceptance.BuildTestData(t, oracledatabase.AdbsCloneResource{}.ResourceType(), "test") + r := AdbsCloneResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAdbsCloneResource_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, oracledatabase.AdbsCloneResource{}.ResourceType(), "test") + r := AdbsCloneResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func (a AdbsCloneResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` + +%s + +resource "azurerm_oracledatabase_autonomous_database_clone" "test" { + name = "OFake%[2]d" + display_name = "OFake%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = "%[3]s" + compute_model = "ECPU" + compute_count = "2" + license_model = "BringYourOwnLicense" + data_storage_size_in_gbs = "32" + db_workload = "OLTP" + admin_password = "TestPass#2024#" + db_version = "19c" + character_set = "AL32UTF8" + ncharacter_set = "AL16UTF16" + subnet_id = azurerm_subnet.virtual_network_subnet.id + vnet_id = azurerm_virtual_network.virtual_network.id +} +`, a.template(data), data.RandomInteger, data.Locations.Primary) +} + +func (a AdbsCloneResource) update(data acceptance.TestData) string { + return fmt.Sprintf(` + +%s + +resource "azurerm_oracledatabase_autonomous_database_clone" "test" { + name = "OFake%[2]d" + display_name = "OFake%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = "%[3]s" + compute_model = "ECPU" + compute_count = "2" + license_model = "BringYourOwnLicense" + data_storage_size_in_gbs = "32" + db_workload = "OLTP" + admin_password = "TestPass#2024#" + db_version = "19c" + character_set = "AL32UTF8" + ncharacter_set = "AL16UTF16" + subnet_id = azurerm_subnet.virtual_network_subnet.id + vnet_id = azurerm_virtual_network.virtual_network.id + tags = { + test = "test1" + } +} +`, a.template(data), data.RandomInteger, data.Locations.Primary) +} + +func (a AdbsCloneResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_oracledatabase_autonomous_database_clone" "import" { + name = azurerm_oracledatabase_autonomous_database_clone.test.name + display_name = azurerm_oracledatabase_autonomous_database_clone.test.display_name + resource_group_name = azurerm_oracledatabase_autonomous_database_clone.test.resource_group_name + location = azurerm_oracledatabase_autonomous_database_clone.test.location + compute_model = azurerm_oracledatabase_autonomous_database_clone.test.compute_model + compute_count = azurerm_oracledatabase_autonomous_database_clone.test.compute_count + license_model = azurerm_oracledatabase_autonomous_database_clone.test.license_model + data_storage_size_in_gbs = azurerm_oracledatabase_autonomous_database_clone.test.data_storage_size_in_gbs + db_workload = azurerm_oracledatabase_autonomous_database_clone.test.db_workload + admin_password = azurerm_oracledatabase_autonomous_database_clone.test.admin_password + db_version = azurerm_oracledatabase_autonomous_database_clone.test.db_version + character_set = azurerm_oracledatabase_autonomous_database_clone.test.character_set + ncharacter_set = azurerm_oracledatabase_autonomous_database_clone.test.ncharacter_set + subnet_id = azurerm_oracledatabase_autonomous_database_clone.test.subnet_id + vnet_id = azurerm_oracledatabase_autonomous_database_clone.test.vnet_id +} +`, a.basic(data)) +} + +func (a AdbsCloneResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +data "azurerm_client_config" "current" {} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%[1]d" + location = "%[2]s" +} + +resource "azurerm_virtual_network" "virtual_network" { + name = "OFakeacctest%[1]d_vnet" + address_space = ["10.0.0.0/16"] + location = "%[2]s" + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_subnet" "virtual_network_subnet" { + name = "OFakeacctest%[1]d" + resource_group_name = azurerm_resource_group.test.name + virtual_network_name = azurerm_virtual_network.virtual_network.name + address_prefixes = ["10.0.1.0/24"] + + delegation { + name = "delegation" + + service_delegation { + actions = [ + "Microsoft.Network/networkinterfaces/*", + "Microsoft.Network/virtualNetworks/subnets/join/action", + ] + name = "Oracle.Database/networkAttachments" + } + } +} + +`, data.RandomInteger, data.Locations.Primary, data.RandomString) +} diff --git a/internal/services/oracledatabase/autonomous_database_regular_data_source.go b/internal/services/oracledatabase/autonomous_database_regular_data_source.go new file mode 100644 index 000000000000..0136b1f6361f --- /dev/null +++ b/internal/services/oracledatabase/autonomous_database_regular_data_source.go @@ -0,0 +1,509 @@ +// Copyright © 2024, Oracle and/or its affiliates. All rights reserved + +package oracledatabase + +import ( + "context" + "fmt" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases" + "github.com/hashicorp/terraform-provider-azurerm/utils" + "time" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type AutonomousDatabaseRegularDataSource struct{} + +type AutonomousDatabaseRegularModel struct { + Name string `tfschema:"name"` + Type string `tfschema:"type"` + Tags map[string]interface{} `tfschema:"tags"` + + // SystemData + SystemData []SystemDataModel `tfschema:"system_data"` + + // AutonomousDatabaseProperties + ActualUsedDataStorageSizeInTbs float64 `tfschema:"actual_used_data_storage_size_in_tbs"` + AdminPassword string `tfschema:"admin_password"` + AllocatedStorageSizeInTbs float64 `tfschema:"allocated_storage_size_in_tbs"` + AutonomousDatabaseId string `tfschema:"autonomous_database_id"` + AvailableUpgradeVersions []string `tfschema:"available_upgrade_versions"` + BackupRetentionPeriodInDays int64 `tfschema:"backup_retention_period_in_days"` + CharacterSet string `tfschema:"character_set"` + ComputeCount float64 `tfschema:"compute_count"` + CpuCoreCount int64 `tfschema:"cpu_core_count"` + DataStorageSizeInGbs int64 `tfschema:"data_storage_size_in_gbs"` + DataStorageSizeInTbs int64 `tfschema:"data_storage_size_in_tbs"` + DbVersion string `tfschema:"db_version"` + DisplayName string `tfschema:"display_name"` + FailedDataRecoveryInSeconds int64 `tfschema:"failed_data_recovery_in_seconds"` + InMemoryAreaInGbs int64 `tfschema:"in_memory_area_in_gbs"` + IsAutoScalingEnabled bool `tfschema:"is_auto_scaling_enabled"` + IsAutoScalingForStorageEnabled bool `tfschema:"is_auto_scaling_for_storage_enabled"` + IsLocalDataGuardEnabled bool `tfschema:"is_local_data_guard_enabled"` + IsMtlsConnectionRequired bool `tfschema:"is_mtls_connection_required"` + IsPreview bool `tfschema:"is_preview"` + IsPreviewVersionWithServiceTermsAccepted bool `tfschema:"is_preview_version_with_service_terms_accepted"` + IsRemoteDataGuardEnabled bool `tfschema:"is_remote_data_guard_enabled"` + LifecycleDetails string `tfschema:"lifecycle_details"` + LocalAdgAutoFailoverMaxDataLossLimit int64 `tfschema:"local_adg_auto_failover_max_data_loss_limit"` + MemoryPerOracleComputeUnitInGbs int64 `tfschema:"memory_per_oracle_compute_unit_in_gbs"` + NcharacterSet string `tfschema:"ncharacter_set"` + NextLongTermBackupTimeStamp string `tfschema:"next_long_term_backup_time_stamp"` + OciUrl string `tfschema:"oci_url"` + Ocid string `tfschema:"ocid"` + PeerDbId string `tfschema:"peer_db_id"` + PeerDbIds []string `tfschema:"peer_db_ids"` + PrivateEndpoint string `tfschema:"private_endpoint"` + PrivateEndpointIP string `tfschema:"private_endpoint_ip"` + PrivateEndpointLabel string `tfschema:"private_endpoint_label"` + ProvisionableCPUs []int64 `tfschema:"provisionable_cpus"` + ServiceConsoleUrl string `tfschema:"service_console_url"` + SqlWebDeveloperUrl string `tfschema:"sql_web_developer_url"` + SubnetId string `tfschema:"subnet_id"` + SupportedRegionsToCloneTo []string `tfschema:"supported_regions_to_clone_to"` + TimeCreated string `tfschema:"time_created"` + TimeDataGuardRoleChanged string `tfschema:"time_data_guard_role_changed"` + TimeDeletionOfFreeAutonomousDatabase string `tfschema:"time_deletion_of_free_autonomous_database"` + TimeLocalDataGuardEnabled string `tfschema:"time_local_data_guard_enabled"` + TimeMaintenanceBegin string `tfschema:"time_maintenance_begin"` + TimeMaintenanceEnd string `tfschema:"time_maintenance_end"` + TimeOfLastFailover string `tfschema:"time_of_last_failover"` + TimeOfLastRefresh string `tfschema:"time_of_last_refresh"` + TimeOfLastRefreshPoint string `tfschema:"time_of_last_refresh_point"` + TimeOfLastSwitchover string `tfschema:"time_of_last_switchover"` + TimeReclamationOfFreeAutonomousDatabase string `tfschema:"time_reclamation_of_free_autonomous_database"` + UsedDataStorageSizeInGbs int64 `tfschema:"used_data_storage_size_in_gbs"` + UsedDataStorageSizeInTbs int64 `tfschema:"used_data_storage_size_in_tbs"` + VnetId string `tfschema:"vnet_id"` + WhitelistedIPs []string `tfschema:"whitelisted_ips"` +} + +func (d AutonomousDatabaseRegularDataSource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + } +} + +func (d AutonomousDatabaseRegularDataSource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "location": commonschema.LocationComputed(), + "type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "tags": commonschema.TagsDataSource(), + + // SystemData + "system_data": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "created_by": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "created_by_type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "created_at": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "last_modified_by": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "last_modified_by_type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "last_modified_at": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + // AutonomousDatabaseProperties + "actual_used_data_storage_size_in_tbs": { + Type: pluginsdk.TypeFloat, + Computed: true, + }, + "admin_password": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "allocated_storage_size_in_tbs": { + Type: pluginsdk.TypeFloat, + Computed: true, + }, + "autonomous_database_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "available_upgrade_versions": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "backup_retention_period_in_days": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "character_set": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "compute_count": { + Type: pluginsdk.TypeFloat, + Computed: true, + }, + "cpu_core_count": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "db_node_storage_size_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "data_storage_size_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "data_storage_size_in_tbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "db_version": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "display_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "failed_data_recovery_in_seconds": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "in_memory_area_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "is_auto_scaling_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "is_auto_scaling_for_storage_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "is_local_data_guard_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "is_mtls_connection_required": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "is_preview": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "is_preview_version_with_service_terms_accepted": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "is_remote_data_guard_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "lifecycle_details": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "local_adg_auto_failover_max_data_loss_limit": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "memory_per_oracle_compute_unit_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "ncharacter_set": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "next_long_term_backup_time_stamp": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "oci_url": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "ocid": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "peer_db_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "peer_db_ids": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "private_endpoint": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "private_endpoint_ip": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "private_endpoint_label": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "provisionable_cpus": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeInt, + }, + }, + "service_console_url": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "sql_web_developer_url": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "subnet_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "supported_regions_to_clone_to": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeInt, + }, + }, + "time_created": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_data_guard_role_changed": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_deletion_of_free_autonomous_database": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_local_data_guard_enabled": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_maintenance_begin": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_maintenance_end": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_of_last_failover": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_of_last_refresh": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_of_last_refresh_point": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_of_last_switchover": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "time_reclamation_of_free_autonomous_database": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "used_data_storage_size_in_gbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "used_data_storage_size_in_tbs": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "vnet_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "whitelisted_ips": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeInt, + }, + }, + } +} + +func (d AutonomousDatabaseRegularDataSource) ModelObject() interface{} { + return nil +} + +func (d AutonomousDatabaseRegularDataSource) ResourceType() string { + return "azurerm_oracledatabase_autonomous_database_regular" +} + +func (d AutonomousDatabaseRegularDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return autonomousdatabases.ValidateAutonomousDatabaseID +} + +func (d AutonomousDatabaseRegularDataSource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases + subscriptionId := metadata.Client.Account.SubscriptionId + + id := autonomousdatabases.NewAutonomousDatabaseID(subscriptionId, + metadata.ResourceData.Get("resource_group_name").(string), + metadata.ResourceData.Get("name").(string)) + + resp, err := client.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + if model := resp.Model; model != nil { + + err := metadata.ResourceData.Set("location", location.NormalizeNilable(&model.Location)) + if err != nil { + return err + } + + var output AutonomousDatabaseRegularModel + prop := model.Properties + + output = AutonomousDatabaseRegularModel{} + + if prop != nil { + switch adbsPropModel := prop.(type) { + case autonomousdatabases.AutonomousDatabaseProperties: + output = AutonomousDatabaseRegularModel{ + ActualUsedDataStorageSizeInTbs: pointer.From(adbsPropModel.ActualUsedDataStorageSizeInTbs), + AdminPassword: pointer.From(adbsPropModel.AdminPassword), + AllocatedStorageSizeInTbs: pointer.From(adbsPropModel.AllocatedStorageSizeInTbs), + AutonomousDatabaseId: pointer.From(adbsPropModel.AutonomousDatabaseId), + AvailableUpgradeVersions: pointer.From(adbsPropModel.AvailableUpgradeVersions), + BackupRetentionPeriodInDays: pointer.From(adbsPropModel.BackupRetentionPeriodInDays), + CharacterSet: pointer.From(adbsPropModel.CharacterSet), + ComputeCount: pointer.From(adbsPropModel.ComputeCount), + CpuCoreCount: pointer.From(adbsPropModel.CpuCoreCount), + DataStorageSizeInGbs: pointer.From(adbsPropModel.DataStorageSizeInGbs), + DataStorageSizeInTbs: pointer.From(adbsPropModel.DataStorageSizeInTbs), + DbVersion: pointer.From(adbsPropModel.DbVersion), + DisplayName: pointer.From(adbsPropModel.DisplayName), + FailedDataRecoveryInSeconds: pointer.From(adbsPropModel.FailedDataRecoveryInSeconds), + InMemoryAreaInGbs: pointer.From(adbsPropModel.InMemoryAreaInGbs), + IsAutoScalingEnabled: pointer.From(adbsPropModel.IsAutoScalingEnabled), + IsAutoScalingForStorageEnabled: pointer.From(adbsPropModel.IsAutoScalingForStorageEnabled), + IsLocalDataGuardEnabled: pointer.From(adbsPropModel.IsLocalDataGuardEnabled), + IsMtlsConnectionRequired: pointer.From(adbsPropModel.IsMtlsConnectionRequired), + IsPreview: pointer.From(adbsPropModel.IsPreview), + IsPreviewVersionWithServiceTermsAccepted: pointer.From(adbsPropModel.IsPreviewVersionWithServiceTermsAccepted), + IsRemoteDataGuardEnabled: pointer.From(adbsPropModel.IsRemoteDataGuardEnabled), + LifecycleDetails: pointer.From(adbsPropModel.LifecycleDetails), + LocalAdgAutoFailoverMaxDataLossLimit: pointer.From(adbsPropModel.LocalAdgAutoFailoverMaxDataLossLimit), + MemoryPerOracleComputeUnitInGbs: pointer.From(adbsPropModel.MemoryPerOracleComputeUnitInGbs), + NcharacterSet: pointer.From(adbsPropModel.NcharacterSet), + NextLongTermBackupTimeStamp: pointer.From(adbsPropModel.NextLongTermBackupTimeStamp), + OciUrl: pointer.From(adbsPropModel.OciUrl), + Ocid: pointer.From(adbsPropModel.Ocid), + PeerDbId: pointer.From(adbsPropModel.PeerDbId), + PeerDbIds: pointer.From(adbsPropModel.PeerDbIds), + PrivateEndpoint: pointer.From(adbsPropModel.PrivateEndpoint), + PrivateEndpointIP: pointer.From(adbsPropModel.PrivateEndpointIP), + PrivateEndpointLabel: pointer.From(adbsPropModel.PrivateEndpointLabel), + ProvisionableCPUs: pointer.From(adbsPropModel.ProvisionableCPUs), + ServiceConsoleUrl: pointer.From(adbsPropModel.ServiceConsoleUrl), + SqlWebDeveloperUrl: pointer.From(adbsPropModel.SqlWebDeveloperUrl), + SubnetId: pointer.From(adbsPropModel.SubnetId), + SupportedRegionsToCloneTo: pointer.From(adbsPropModel.SupportedRegionsToCloneTo), + TimeCreated: pointer.From(adbsPropModel.TimeCreated), + TimeDataGuardRoleChanged: pointer.From(adbsPropModel.TimeDataGuardRoleChanged), + TimeDeletionOfFreeAutonomousDatabase: pointer.From(adbsPropModel.TimeDeletionOfFreeAutonomousDatabase), + TimeLocalDataGuardEnabled: pointer.From(adbsPropModel.TimeLocalDataGuardEnabled), + TimeMaintenanceBegin: pointer.From(adbsPropModel.TimeMaintenanceBegin), + TimeMaintenanceEnd: pointer.From(adbsPropModel.TimeMaintenanceEnd), + TimeOfLastFailover: pointer.From(adbsPropModel.TimeOfLastFailover), + TimeOfLastRefresh: pointer.From(adbsPropModel.TimeOfLastRefresh), + TimeOfLastRefreshPoint: pointer.From(adbsPropModel.TimeOfLastRefreshPoint), + TimeOfLastSwitchover: pointer.From(adbsPropModel.TimeOfLastSwitchover), + TimeReclamationOfFreeAutonomousDatabase: pointer.From(adbsPropModel.TimeReclamationOfFreeAutonomousDatabase), + UsedDataStorageSizeInGbs: pointer.From(adbsPropModel.UsedDataStorageSizeInGbs), + UsedDataStorageSizeInTbs: pointer.From(adbsPropModel.UsedDataStorageSizeInTbs), + VnetId: pointer.From(adbsPropModel.VnetId), + WhitelistedIPs: pointer.From(adbsPropModel.WhitelistedIPs), + } + default: + return fmt.Errorf("unexpected Autonomous Database type, must be of type Regular") + } + } + + systemData := model.SystemData + if systemData != nil { + output.SystemData = []SystemDataModel{ + { + CreatedBy: systemData.CreatedBy, + CreatedByType: systemData.CreatedByType, + CreatedAt: systemData.CreatedAt, + LastModifiedBy: systemData.LastModifiedBy, + LastModifiedbyType: systemData.LastModifiedbyType, + LastModifiedAt: systemData.LastModifiedAt, + }, + } + } + output.Name = id.AutonomousDatabaseName + output.Type = pointer.From(model.Type) + output.Tags = utils.FlattenPtrMapStringString(model.Tags) + + metadata.SetID(id) + return metadata.Encode(&output) + } + return nil + }, + } +} diff --git a/internal/services/oracledatabase/autonomous_database_regular_resource.go b/internal/services/oracledatabase/autonomous_database_regular_resource.go new file mode 100644 index 000000000000..5061fbc4b5c7 --- /dev/null +++ b/internal/services/oracledatabase/autonomous_database_regular_resource.go @@ -0,0 +1,276 @@ +// Copyright © 2024, Oracle and/or its affiliates. All rights reserved + +package oracledatabase + +import ( + "context" + "fmt" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases" + "time" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +var _ sdk.Resource = AdbsRegularResource{} + +type AdbsRegularResource struct{} + +type AdbsRegularResourceModel struct { + Location string `tfschema:"location"` + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Tags map[string]interface{} `tfschema:"tags"` + + DisplayName string `tfschema:"display_name"` + SubnetId string `tfschema:"subnet_id"` + ComputeModel string `tfschema:"compute_model"` + ComputeCount float64 `tfschema:"compute_count"` + LicenseModel string `tfschema:"license_model"` + DataStorageSizeInGbs int64 `tfschema:"data_storage_size_in_gbs"` + DbWorkload string `tfschema:"db_workload"` + AdminPassword string `tfschema:"admin_password"` + DbVersion string `tfschema:"db_version"` + CharacterSet string `tfschema:"character_set"` + NcharacterSet string `tfschema:"ncharacter_set"` + VnetId string `tfschema:"vnet_id"` +} + +func (AdbsRegularResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "location": commonschema.Location(), + "tags": commonschema.Tags(), + "resource_group_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + // AdbsRegularResource + "display_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + "subnet_id": { + Type: pluginsdk.TypeString, + Required: true, + }, + "compute_model": { + Type: pluginsdk.TypeString, + Required: true, + }, + "compute_count": { + Type: pluginsdk.TypeFloat, + Required: true, + }, + "license_model": { + Type: pluginsdk.TypeString, + Required: true, + }, + "data_storage_size_in_gbs": { + Type: pluginsdk.TypeInt, + Required: true, + }, + "db_workload": { + Type: pluginsdk.TypeString, + Required: true, + }, + "admin_password": { + Type: pluginsdk.TypeString, + Required: true, + }, + "db_version": { + Type: pluginsdk.TypeString, + Required: true, + }, + "character_set": { + Type: pluginsdk.TypeString, + Required: true, + }, + "ncharacter_set": { + Type: pluginsdk.TypeString, + Required: true, + }, + "vnet_id": { + Type: pluginsdk.TypeString, + Required: true, + }, + } +} + +func (AdbsRegularResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (AdbsRegularResource) ModelObject() interface{} { + return &AdbsRegularResource{} +} + +func (AdbsRegularResource) ResourceType() string { + return "azurerm_oracledatabase_autonomous_database_regular" +} + +func (r AdbsRegularResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases + subscriptionId := metadata.Client.Account.SubscriptionId + + var model AdbsRegularResourceModel + if err := metadata.Decode(&model); err != nil { + return err + } + + id := autonomousdatabases.NewAutonomousDatabaseID(subscriptionId, + model.ResourceGroupName, + model.Name) + + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + param := autonomousdatabases.AutonomousDatabase{ + Name: pointer.To(model.Name), + Location: model.Location, + Tags: tags.Expand(model.Tags), + Properties: &autonomousdatabases.AutonomousDatabaseProperties{ + DisplayName: pointer.To(model.DisplayName), + SubnetId: pointer.To(model.SubnetId), + ComputeModel: pointer.To(autonomousdatabases.ComputeModel(model.ComputeModel)), + ComputeCount: pointer.To(model.ComputeCount), + LicenseModel: pointer.To(autonomousdatabases.LicenseModel(model.LicenseModel)), + DataStorageSizeInGbs: pointer.To(model.DataStorageSizeInGbs), + DbWorkload: pointer.To(autonomousdatabases.WorkloadType(model.DbWorkload)), + AdminPassword: pointer.To(model.AdminPassword), + DbVersion: pointer.To(model.DbVersion), + CharacterSet: pointer.To(model.CharacterSet), + NcharacterSet: pointer.To(model.NcharacterSet), + VnetId: pointer.To(model.VnetId), + }, + } + + if err := client.CreateOrUpdateThenPoll(ctx, id, param); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r AdbsRegularResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + + client := metadata.Client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases + id, err := autonomousdatabases.ParseAutonomousDatabaseID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model AdbsRegularResourceModel + if err = metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding err: %+v", err) + } + + existing, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving exists when updating: +%v", *id) + } + if existing.Model == nil && existing.Model.Properties == nil { + return fmt.Errorf("retrieving as nil when updating for %v", *id) + } + + upd := existing.Model + + err = client.CreateOrUpdateThenPoll(ctx, *id, *upd) + if err != nil { + return fmt.Errorf("updating %s: %v", id, err) + } + return nil + }, + } +} + +func (AdbsRegularResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + id, err := autonomousdatabases.ParseAutonomousDatabaseID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + client := metadata.Client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases + result, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(result.HttpResponse) { + return metadata.MarkAsGone(id) + } + return err + } + + if result.Model == nil { + return fmt.Errorf("retrieving %s got nil model", id) + } + prop := result.Model.Properties + switch adbsPropModel := prop.(type) { + case autonomousdatabases.AutonomousDatabaseProperties: + var output AdbsRegularResourceModel + output.DisplayName = pointer.From(adbsPropModel.DisplayName) + output.ComputeModel = string(pointer.From(adbsPropModel.ComputeModel)) + output.ComputeCount = pointer.From(adbsPropModel.ComputeCount) + output.LicenseModel = string(pointer.From(adbsPropModel.LicenseModel)) + output.DataStorageSizeInGbs = pointer.From(adbsPropModel.DataStorageSizeInGbs) + output.DbWorkload = string(pointer.From(adbsPropModel.DbWorkload)) + output.AdminPassword = pointer.From(adbsPropModel.AdminPassword) + output.DbVersion = pointer.From(adbsPropModel.DbVersion) + output.CharacterSet = pointer.From(adbsPropModel.CharacterSet) + output.NcharacterSet = pointer.From(adbsPropModel.NcharacterSet) + output.VnetId = pointer.From(adbsPropModel.VnetId) + + return metadata.Encode(&output) + default: + return fmt.Errorf("unexpected Autonomous Database type, must be of type Regular") + } + }, + } +} + +func (AdbsRegularResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases + + id, err := autonomousdatabases.ParseAutonomousDatabaseID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if err = client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (AdbsRegularResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return autonomousdatabases.ValidateAutonomousDatabaseID +} diff --git a/internal/services/oracledatabase/autonomous_database_regular_resource_test.go b/internal/services/oracledatabase/autonomous_database_regular_resource_test.go new file mode 100644 index 000000000000..28c7f0f54cb8 --- /dev/null +++ b/internal/services/oracledatabase/autonomous_database_regular_resource_test.go @@ -0,0 +1,209 @@ +// Copyright © 2024, Oracle and/or its affiliates. All rights reserved + +package oracledatabase_test + +import ( + "context" + "fmt" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracledatabase" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" + "testing" +) + +type AdbsRegularResource struct{} + +func (a AdbsRegularResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := autonomousdatabases.ParseAutonomousDatabaseID(state.ID) + if err != nil { + return nil, err + } + resp, err := client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases.Get(ctx, *id) + if err != nil { + return nil, fmt.Errorf("retrieving adbs %s: %+v", id, err) + } + return utils.Bool(resp.Model != nil), nil +} + +func (a AdbsRegularResource) Destroy(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := autonomousdatabases.ParseAutonomousDatabaseID(state.ID) + if err != nil { + return nil, err + } + if _, err := client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases.Delete(ctx, *id); err != nil { + return nil, fmt.Errorf("deleting adbs %s: %+v", id, err) + } + return utils.Bool(true), nil +} + +func TestAdbsRegularResource_basic(t *testing.T) { + data := acceptance.BuildTestData(t, oracledatabase.AdbsRegularResource{}.ResourceType(), "test") + r := AdbsRegularResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAdbsRegularResource_update(t *testing.T) { + data := acceptance.BuildTestData(t, oracledatabase.AdbsRegularResource{}.ResourceType(), "test") + r := AdbsRegularResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAdbsRegularResource_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, oracledatabase.AdbsRegularResource{}.ResourceType(), "test") + r := AdbsRegularResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func (a AdbsRegularResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` + +%s + +resource "azurerm_oracledatabase_autonomous_database_regular" "test" { + name = "OFake%[2]d" + display_name = "OFake%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = "%[3]s" + compute_model = "ECPU" + compute_count = "2" + license_model = "BringYourOwnLicense" + data_storage_size_in_gbs = "32" + db_workload = "OLTP" + admin_password = "TestPass#2024#" + db_version = "19c" + character_set = "AL32UTF8" + ncharacter_set = "AL16UTF16" + subnet_id = azurerm_subnet.virtual_network_subnet.id + vnet_id = azurerm_virtual_network.virtual_network.id +} +`, a.template(data), data.RandomInteger, data.Locations.Primary) +} + +func (a AdbsRegularResource) update(data acceptance.TestData) string { + return fmt.Sprintf(` + +%s + +resource "azurerm_oracledatabase_autonomous_database_regular" "test" { + name = "OFake%[2]d" + display_name = "OFake%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = "%[3]s" + compute_model = "ECPU" + compute_count = "2" + license_model = "BringYourOwnLicense" + data_storage_size_in_gbs = "32" + db_workload = "OLTP" + admin_password = "TestPass#2024#" + db_version = "19c" + character_set = "AL32UTF8" + ncharacter_set = "AL16UTF16" + subnet_id = azurerm_subnet.virtual_network_subnet.id + vnet_id = azurerm_virtual_network.virtual_network.id + tags = { + test = "test1" + } +} +`, a.template(data), data.RandomInteger, data.Locations.Primary) +} + +func (a AdbsRegularResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_oracledatabase_autonomous_database_regular" "import" { + name = azurerm_oracledatabase_autonomous_database_regular.test.name + display_name = azurerm_oracledatabase_autonomous_database_regular.test.display_name + resource_group_name = azurerm_oracledatabase_autonomous_database_regular.test.resource_group_name + location = azurerm_oracledatabase_autonomous_database_regular.test.location + compute_model = azurerm_oracledatabase_autonomous_database_regular.test.compute_model + compute_count = azurerm_oracledatabase_autonomous_database_regular.test.compute_count + license_model = azurerm_oracledatabase_autonomous_database_regular.test.license_model + data_storage_size_in_gbs = azurerm_oracledatabase_autonomous_database_regular.test.data_storage_size_in_gbs + db_workload = azurerm_oracledatabase_autonomous_database_regular.test.db_workload + admin_password = azurerm_oracledatabase_autonomous_database_regular.test.admin_password + db_version = azurerm_oracledatabase_autonomous_database_regular.test.db_version + character_set = azurerm_oracledatabase_autonomous_database_regular.test.character_set + ncharacter_set = azurerm_oracledatabase_autonomous_database_regular.test.ncharacter_set + subnet_id = azurerm_oracledatabase_autonomous_database_regular.test.subnet_id + vnet_id = azurerm_oracledatabase_autonomous_database_regular.test.vnet_id +} +`, a.basic(data)) +} + +func (a AdbsRegularResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +data "azurerm_client_config" "current" {} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%[1]d" + location = "%[2]s" +} + +resource "azurerm_virtual_network" "virtual_network" { + name = "OFakeacctest%[1]d_vnet" + address_space = ["10.0.0.0/16"] + location = "%[2]s" + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_subnet" "virtual_network_subnet" { + name = "OFakeacctest%[1]d" + resource_group_name = azurerm_resource_group.test.name + virtual_network_name = azurerm_virtual_network.virtual_network.name + address_prefixes = ["10.0.1.0/24"] + + delegation { + name = "delegation" + + service_delegation { + actions = [ + "Microsoft.Network/networkinterfaces/*", + "Microsoft.Network/virtualNetworks/subnets/join/action", + ] + name = "Oracle.Database/networkAttachments" + } + } +} + +`, data.RandomInteger, data.Locations.Primary, data.RandomString) +} diff --git a/internal/services/oracledatabase/registration.go b/internal/services/oracledatabase/registration.go index 368d414c12e3..d7318afbcd84 100644 --- a/internal/services/oracledatabase/registration.go +++ b/internal/services/oracledatabase/registration.go @@ -17,6 +17,8 @@ func (r Registration) DataSources() []sdk.DataSource { ExadataInfraDataSource{}, CloudVmClusterDataSource{}, DBServersDataSource{}, + AutonomousDatabaseCloneDataSource{}, + AutonomousDatabaseRegularDataSource{}, } } @@ -24,6 +26,8 @@ func (r Registration) Resources() []sdk.Resource { return []sdk.Resource{ ExadataInfraResource{}, CloudVmClusterResource{}, + AdbsCloneResource{}, + AdbsRegularResource{}, } } From f0f64f8f93d9c08796b1faf9caad2fc741f823bd Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Fri, 23 Aug 2024 19:05:10 +0100 Subject: [PATCH 05/43] * Implement ADBS resource and data source. --- .../autonomous_database_regular_resource.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/services/oracledatabase/autonomous_database_regular_resource.go b/internal/services/oracledatabase/autonomous_database_regular_resource.go index 5061fbc4b5c7..a7494be4c287 100644 --- a/internal/services/oracledatabase/autonomous_database_regular_resource.go +++ b/internal/services/oracledatabase/autonomous_database_regular_resource.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases" + "github.com/hashicorp/terraform-provider-azurerm/utils" "time" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" @@ -231,7 +232,13 @@ func (AdbsRegularResource) Read() sdk.ResourceFunc { switch adbsPropModel := prop.(type) { case autonomousdatabases.AutonomousDatabaseProperties: var output AdbsRegularResourceModel + // Azure + output.Name = pointer.ToString(result.Model.Name) + output.Location = result.Model.Location + output.Tags = utils.FlattenPtrMapStringString(result.Model.Tags) + output.ResourceGroupName = id.ResourceGroupName output.DisplayName = pointer.From(adbsPropModel.DisplayName) + output.AdminPassword = pointer.From(adbsPropModel.AdminPassword) output.ComputeModel = string(pointer.From(adbsPropModel.ComputeModel)) output.ComputeCount = pointer.From(adbsPropModel.ComputeCount) output.LicenseModel = string(pointer.From(adbsPropModel.LicenseModel)) @@ -242,6 +249,7 @@ func (AdbsRegularResource) Read() sdk.ResourceFunc { output.CharacterSet = pointer.From(adbsPropModel.CharacterSet) output.NcharacterSet = pointer.From(adbsPropModel.NcharacterSet) output.VnetId = pointer.From(adbsPropModel.VnetId) + output.SubnetId = pointer.From(adbsPropModel.SubnetId) return metadata.Encode(&output) default: From 24cc8a8c9d9f07a13d77ad83cfd3555ed6566827 Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Thu, 5 Sep 2024 10:11:13 +0100 Subject: [PATCH 06/43] * Improve tests. --- .../autonomous_database_clone_data_source.go | 561 ------------------ .../autonomous_database_clone_resource.go | 276 --------- ...autonomous_database_clone_resource_test.go | 209 ------- ...omous_database_regular_data_source_test.go | 43 ++ .../autonomous_database_regular_resource.go | 23 +- ...tonomous_database_regular_resource_test.go | 15 + .../services/oracledatabase/registration.go | 2 - 7 files changed, 72 insertions(+), 1057 deletions(-) delete mode 100644 internal/services/oracledatabase/autonomous_database_clone_data_source.go delete mode 100644 internal/services/oracledatabase/autonomous_database_clone_resource.go delete mode 100644 internal/services/oracledatabase/autonomous_database_clone_resource_test.go create mode 100644 internal/services/oracledatabase/autonomous_database_regular_data_source_test.go diff --git a/internal/services/oracledatabase/autonomous_database_clone_data_source.go b/internal/services/oracledatabase/autonomous_database_clone_data_source.go deleted file mode 100644 index 0c72d6a5c6d1..000000000000 --- a/internal/services/oracledatabase/autonomous_database_clone_data_source.go +++ /dev/null @@ -1,561 +0,0 @@ -// Copyright © 2024, Oracle and/or its affiliates. All rights reserved - -package oracledatabase - -import ( - "context" - "fmt" - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases" - "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters" - "github.com/hashicorp/terraform-provider-azurerm/utils" - "time" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" -) - -type AutonomousDatabaseCloneDataSource struct{} - -type AutonomousDatabaseCloneModel struct { - Name string `tfschema:"name"` - Type string `tfschema:"type"` - Tags map[string]interface{} `tfschema:"tags"` - - // SystemData - SystemData []SystemDataModel `tfschema:"system_data"` - - // AutonomousDatabaseCloneProperties - CloneType string `tfschema:"clone_type"` - IsReconnectCloneEnabled bool `tfschema:"is_reconnect_clone_enabled"` - IsRefreshableClone bool `tfschema:"is_refreshable_clone"` - RefreshableModel string `tfschema:"refreshable_model"` - RefreshableStatus string `tfschema:"refreshable_status"` - Source string `tfschema:"source"` - SourceId string `tfschema:"source_id"` - TimeUntilReconnectCloneEnabled string `tfschema:"time_until_reconnect_clone_enabled"` - - // AutonomousDatabaseProperties - ActualUsedDataStorageSizeInTbs float64 `tfschema:"actual_used_data_storage_size_in_tbs"` - AdminPassword string `tfschema:"admin_password"` - AllocatedStorageSizeInTbs float64 `tfschema:"allocated_storage_size_in_tbs"` - AutonomousDatabaseId string `tfschema:"autonomous_database_id"` - AvailableUpgradeVersions []string `tfschema:"available_upgrade_versions"` - BackupRetentionPeriodInDays int64 `tfschema:"backup_retention_period_in_days"` - CharacterSet string `tfschema:"character_set"` - ComputeCount float64 `tfschema:"compute_count"` - CpuCoreCount int64 `tfschema:"cpu_core_count"` - DataStorageSizeInGbs int64 `tfschema:"data_storage_size_in_gbs"` - DataStorageSizeInTbs int64 `tfschema:"data_storage_size_in_tbs"` - DbVersion string `tfschema:"db_version"` - DisplayName string `tfschema:"display_name"` - FailedDataRecoveryInSeconds int64 `tfschema:"failed_data_recovery_in_seconds"` - InMemoryAreaInGbs int64 `tfschema:"in_memory_area_in_gbs"` - IsAutoScalingEnabled bool `tfschema:"is_auto_scaling_enabled"` - IsAutoScalingForStorageEnabled bool `tfschema:"is_auto_scaling_for_storage_enabled"` - IsLocalDataGuardEnabled bool `tfschema:"is_local_data_guard_enabled"` - IsMtlsConnectionRequired bool `tfschema:"is_mtls_connection_required"` - IsPreview bool `tfschema:"is_preview"` - IsPreviewVersionWithServiceTermsAccepted bool `tfschema:"is_preview_version_with_service_terms_accepted"` - IsRemoteDataGuardEnabled bool `tfschema:"is_remote_data_guard_enabled"` - LifecycleDetails string `tfschema:"lifecycle_details"` - LocalAdgAutoFailoverMaxDataLossLimit int64 `tfschema:"local_adg_auto_failover_max_data_loss_limit"` - MemoryPerOracleComputeUnitInGbs int64 `tfschema:"memory_per_oracle_compute_unit_in_gbs"` - NcharacterSet string `tfschema:"ncharacter_set"` - NextLongTermBackupTimeStamp string `tfschema:"next_long_term_backup_time_stamp"` - OciUrl string `tfschema:"oci_url"` - Ocid string `tfschema:"ocid"` - PeerDbId string `tfschema:"peer_db_id"` - PeerDbIds []string `tfschema:"peer_db_ids"` - PrivateEndpoint string `tfschema:"private_endpoint"` - PrivateEndpointIP string `tfschema:"private_endpoint_ip"` - PrivateEndpointLabel string `tfschema:"private_endpoint_label"` - ProvisionableCPUs []int64 `tfschema:"provisionable_cpus"` - ServiceConsoleUrl string `tfschema:"service_console_url"` - SqlWebDeveloperUrl string `tfschema:"sql_web_developer_url"` - SubnetId string `tfschema:"subnet_id"` - SupportedRegionsToCloneTo []string `tfschema:"supported_regions_to_clone_to"` - TimeCreated string `tfschema:"time_created"` - TimeDataGuardRoleChanged string `tfschema:"time_data_guard_role_changed"` - TimeDeletionOfFreeAutonomousDatabase string `tfschema:"time_deletion_of_free_autonomous_database"` - TimeLocalDataGuardEnabled string `tfschema:"time_local_data_guard_enabled"` - TimeMaintenanceBegin string `tfschema:"time_maintenance_begin"` - TimeMaintenanceEnd string `tfschema:"time_maintenance_end"` - TimeOfLastFailover string `tfschema:"time_of_last_failover"` - TimeOfLastRefresh string `tfschema:"time_of_last_refresh"` - TimeOfLastRefreshPoint string `tfschema:"time_of_last_refresh_point"` - TimeOfLastSwitchover string `tfschema:"time_of_last_switchover"` - TimeReclamationOfFreeAutonomousDatabase string `tfschema:"time_reclamation_of_free_autonomous_database"` - UsedDataStorageSizeInGbs int64 `tfschema:"used_data_storage_size_in_gbs"` - UsedDataStorageSizeInTbs int64 `tfschema:"used_data_storage_size_in_tbs"` - VnetId string `tfschema:"vnet_id"` - WhitelistedIPs []string `tfschema:"whitelisted_ips"` -} - -func (d AutonomousDatabaseCloneDataSource) Arguments() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{ - "resource_group_name": commonschema.ResourceGroupNameForDataSource(), - "name": { - Type: pluginsdk.TypeString, - Required: true, - }, - } -} - -func (d AutonomousDatabaseCloneDataSource) Attributes() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{ - "location": commonschema.LocationComputed(), - "type": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "tags": commonschema.TagsDataSource(), - - // SystemData - "system_data": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "created_by": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "created_by_type": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "created_at": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "last_modified_by": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "last_modified_by_type": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "last_modified_at": { - Type: pluginsdk.TypeString, - Computed: true, - }, - }, - }, - }, - - // AutonomousDatabaseCloneProperties - "clone_type": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "is_reconnect_clone_enabled": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - "is_refreshable_clone": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - "refreshable_model": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "refreshable_status": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "source": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "source_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "time_until_reconnect_clone_enabled": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - // AutonomousDatabaseProperties - "actual_used_data_storage_size_in_tbs": { - Type: pluginsdk.TypeFloat, - Computed: true, - }, - "admin_password": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "allocated_storage_size_in_tbs": { - Type: pluginsdk.TypeFloat, - Computed: true, - }, - "autonomous_database_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "available_upgrade_versions": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - "backup_retention_period_in_days": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "character_set": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "compute_count": { - Type: pluginsdk.TypeFloat, - Computed: true, - }, - "cpu_core_count": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "db_node_storage_size_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "data_storage_size_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "data_storage_size_in_tbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "db_version": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "display_name": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "failed_data_recovery_in_seconds": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "in_memory_area_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "is_auto_scaling_enabled": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - "is_auto_scaling_for_storage_enabled": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - "is_local_data_guard_enabled": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - "is_mtls_connection_required": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - "is_preview": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - "is_preview_version_with_service_terms_accepted": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - "is_remote_data_guard_enabled": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - "lifecycle_details": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "local_adg_auto_failover_max_data_loss_limit": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "memory_per_oracle_compute_unit_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "ncharacter_set": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "next_long_term_backup_time_stamp": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "oci_url": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "ocid": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "peer_db_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "peer_db_ids": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - "private_endpoint": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "private_endpoint_ip": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "private_endpoint_label": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "provisionable_cpus": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeInt, - }, - }, - "service_console_url": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "sql_web_developer_url": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "subnet_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "supported_regions_to_clone_to": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeInt, - }, - }, - "time_created": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "time_data_guard_role_changed": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "time_deletion_of_free_autonomous_database": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "time_local_data_guard_enabled": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "time_maintenance_begin": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "time_maintenance_end": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "time_of_last_failover": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "time_of_last_refresh": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "time_of_last_refresh_point": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "time_of_last_switchover": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "time_reclamation_of_free_autonomous_database": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "used_data_storage_size_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "used_data_storage_size_in_tbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "vnet_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "whitelisted_ips": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeInt, - }, - }, - } -} - -func (d AutonomousDatabaseCloneDataSource) ModelObject() interface{} { - return nil -} - -func (d AutonomousDatabaseCloneDataSource) ResourceType() string { - return "azurerm_oracledatabase_autonomous_database_clone" -} - -func (d AutonomousDatabaseCloneDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { - return cloudvmclusters.ValidateCloudVMClusterID -} - -func (d AutonomousDatabaseCloneDataSource) Read() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 5 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases - subscriptionId := metadata.Client.Account.SubscriptionId - - id := autonomousdatabases.NewAutonomousDatabaseID(subscriptionId, - metadata.ResourceData.Get("resource_group_name").(string), - metadata.ResourceData.Get("name").(string)) - - resp, err := client.Get(ctx, id) - if err != nil { - if response.WasNotFound(resp.HttpResponse) { - return fmt.Errorf("%s was not found", id) - } - return fmt.Errorf("retrieving %s: %+v", id, err) - } - - if model := resp.Model; model != nil { - - err := metadata.ResourceData.Set("location", location.NormalizeNilable(&model.Location)) - if err != nil { - return err - } - - var output AutonomousDatabaseCloneModel - prop := model.Properties - - output = AutonomousDatabaseCloneModel{} - - if prop != nil { - switch adbsPropModel := prop.(type) { - case autonomousdatabases.AutonomousDatabaseCloneProperties: - output = AutonomousDatabaseCloneModel{ - CloneType: string(adbsPropModel.CloneType), - IsReconnectCloneEnabled: pointer.From(adbsPropModel.IsReconnectCloneEnabled), - IsRefreshableClone: pointer.From(adbsPropModel.IsRefreshableClone), - RefreshableModel: string(pointer.From(adbsPropModel.RefreshableModel)), - Source: string(pointer.From(adbsPropModel.Source)), - SourceId: adbsPropModel.SourceId, - TimeUntilReconnectCloneEnabled: pointer.From(adbsPropModel.TimeUntilReconnectCloneEnabled), - ActualUsedDataStorageSizeInTbs: pointer.From(adbsPropModel.ActualUsedDataStorageSizeInTbs), - AdminPassword: pointer.From(adbsPropModel.AdminPassword), - AllocatedStorageSizeInTbs: pointer.From(adbsPropModel.AllocatedStorageSizeInTbs), - AutonomousDatabaseId: pointer.From(adbsPropModel.AutonomousDatabaseId), - AvailableUpgradeVersions: pointer.From(adbsPropModel.AvailableUpgradeVersions), - BackupRetentionPeriodInDays: pointer.From(adbsPropModel.BackupRetentionPeriodInDays), - CharacterSet: pointer.From(adbsPropModel.CharacterSet), - ComputeCount: pointer.From(adbsPropModel.ComputeCount), - CpuCoreCount: pointer.From(adbsPropModel.CpuCoreCount), - DataStorageSizeInGbs: pointer.From(adbsPropModel.DataStorageSizeInGbs), - DataStorageSizeInTbs: pointer.From(adbsPropModel.DataStorageSizeInTbs), - DbVersion: pointer.From(adbsPropModel.DbVersion), - DisplayName: pointer.From(adbsPropModel.DisplayName), - FailedDataRecoveryInSeconds: pointer.From(adbsPropModel.FailedDataRecoveryInSeconds), - InMemoryAreaInGbs: pointer.From(adbsPropModel.InMemoryAreaInGbs), - IsAutoScalingEnabled: pointer.From(adbsPropModel.IsAutoScalingEnabled), - IsAutoScalingForStorageEnabled: pointer.From(adbsPropModel.IsAutoScalingForStorageEnabled), - IsLocalDataGuardEnabled: pointer.From(adbsPropModel.IsLocalDataGuardEnabled), - IsMtlsConnectionRequired: pointer.From(adbsPropModel.IsMtlsConnectionRequired), - IsPreview: pointer.From(adbsPropModel.IsPreview), - IsPreviewVersionWithServiceTermsAccepted: pointer.From(adbsPropModel.IsPreviewVersionWithServiceTermsAccepted), - IsRemoteDataGuardEnabled: pointer.From(adbsPropModel.IsRemoteDataGuardEnabled), - LifecycleDetails: pointer.From(adbsPropModel.LifecycleDetails), - LocalAdgAutoFailoverMaxDataLossLimit: pointer.From(adbsPropModel.LocalAdgAutoFailoverMaxDataLossLimit), - MemoryPerOracleComputeUnitInGbs: pointer.From(adbsPropModel.MemoryPerOracleComputeUnitInGbs), - NcharacterSet: pointer.From(adbsPropModel.NcharacterSet), - NextLongTermBackupTimeStamp: pointer.From(adbsPropModel.NextLongTermBackupTimeStamp), - OciUrl: pointer.From(adbsPropModel.OciUrl), - Ocid: pointer.From(adbsPropModel.Ocid), - PeerDbId: pointer.From(adbsPropModel.PeerDbId), - PeerDbIds: pointer.From(adbsPropModel.PeerDbIds), - PrivateEndpoint: pointer.From(adbsPropModel.PrivateEndpoint), - PrivateEndpointIP: pointer.From(adbsPropModel.PrivateEndpointIP), - PrivateEndpointLabel: pointer.From(adbsPropModel.PrivateEndpointLabel), - ProvisionableCPUs: pointer.From(adbsPropModel.ProvisionableCPUs), - ServiceConsoleUrl: pointer.From(adbsPropModel.ServiceConsoleUrl), - SqlWebDeveloperUrl: pointer.From(adbsPropModel.SqlWebDeveloperUrl), - SubnetId: pointer.From(adbsPropModel.SubnetId), - SupportedRegionsToCloneTo: pointer.From(adbsPropModel.SupportedRegionsToCloneTo), - TimeCreated: pointer.From(adbsPropModel.TimeCreated), - TimeDataGuardRoleChanged: pointer.From(adbsPropModel.TimeDataGuardRoleChanged), - TimeDeletionOfFreeAutonomousDatabase: pointer.From(adbsPropModel.TimeDeletionOfFreeAutonomousDatabase), - TimeLocalDataGuardEnabled: pointer.From(adbsPropModel.TimeLocalDataGuardEnabled), - TimeMaintenanceBegin: pointer.From(adbsPropModel.TimeMaintenanceBegin), - TimeMaintenanceEnd: pointer.From(adbsPropModel.TimeMaintenanceEnd), - TimeOfLastFailover: pointer.From(adbsPropModel.TimeOfLastFailover), - TimeOfLastRefresh: pointer.From(adbsPropModel.TimeOfLastRefresh), - TimeOfLastRefreshPoint: pointer.From(adbsPropModel.TimeOfLastRefreshPoint), - TimeOfLastSwitchover: pointer.From(adbsPropModel.TimeOfLastSwitchover), - TimeReclamationOfFreeAutonomousDatabase: pointer.From(adbsPropModel.TimeReclamationOfFreeAutonomousDatabase), - UsedDataStorageSizeInGbs: pointer.From(adbsPropModel.UsedDataStorageSizeInGbs), - UsedDataStorageSizeInTbs: pointer.From(adbsPropModel.UsedDataStorageSizeInTbs), - VnetId: pointer.From(adbsPropModel.VnetId), - WhitelistedIPs: pointer.From(adbsPropModel.WhitelistedIPs), - } - default: - return fmt.Errorf("unexpected Autonomous Database type, must be of type Clone") - } - } - - systemData := model.SystemData - if systemData != nil { - output.SystemData = []SystemDataModel{ - { - CreatedBy: systemData.CreatedBy, - CreatedByType: systemData.CreatedByType, - CreatedAt: systemData.CreatedAt, - LastModifiedBy: systemData.LastModifiedBy, - LastModifiedbyType: systemData.LastModifiedbyType, - LastModifiedAt: systemData.LastModifiedAt, - }, - } - } - output.Name = id.AutonomousDatabaseName - output.Type = pointer.From(model.Type) - output.Tags = utils.FlattenPtrMapStringString(model.Tags) - - metadata.SetID(id) - return metadata.Encode(&output) - } - return nil - }, - } -} diff --git a/internal/services/oracledatabase/autonomous_database_clone_resource.go b/internal/services/oracledatabase/autonomous_database_clone_resource.go deleted file mode 100644 index ae5f14dcfdbe..000000000000 --- a/internal/services/oracledatabase/autonomous_database_clone_resource.go +++ /dev/null @@ -1,276 +0,0 @@ -// Copyright © 2024, Oracle and/or its affiliates. All rights reserved - -package oracledatabase - -import ( - "context" - "fmt" - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases" - "time" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" -) - -var _ sdk.Resource = AdbsCloneResource{} - -type AdbsCloneResource struct{} - -type AdbsCloneResourceModel struct { - Location string `tfschema:"location"` - Name string `tfschema:"name"` - ResourceGroupName string `tfschema:"resource_group_name"` - Tags map[string]interface{} `tfschema:"tags"` - - DisplayName string `tfschema:"display_name"` - SubnetId string `tfschema:"subnet_id"` - ComputeModel string `tfschema:"compute_model"` - ComputeCount float64 `tfschema:"compute_count"` - LicenseModel string `tfschema:"license_model"` - DataStorageSizeInGbs int64 `tfschema:"data_storage_size_in_gbs"` - DbWorkload string `tfschema:"db_workload"` - AdminPassword string `tfschema:"admin_password"` - DbVersion string `tfschema:"db_version"` - CharacterSet string `tfschema:"character_set"` - NcharacterSet string `tfschema:"ncharacter_set"` - VnetId string `tfschema:"vnet_id"` -} - -func (AdbsCloneResource) Arguments() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{ - "location": commonschema.Location(), - "tags": commonschema.Tags(), - "resource_group_name": { - Type: pluginsdk.TypeString, - Required: true, - }, - "name": { - Type: pluginsdk.TypeString, - Required: true, - }, - - // AdbsCloneResource - "display_name": { - Type: pluginsdk.TypeString, - Required: true, - }, - "subnet_id": { - Type: pluginsdk.TypeString, - Required: true, - }, - "compute_model": { - Type: pluginsdk.TypeString, - Required: true, - }, - "compute_count": { - Type: pluginsdk.TypeFloat, - Required: true, - }, - "license_model": { - Type: pluginsdk.TypeString, - Required: true, - }, - "data_storage_size_in_gbs": { - Type: pluginsdk.TypeInt, - Required: true, - }, - "db_workload": { - Type: pluginsdk.TypeString, - Required: true, - }, - "admin_password": { - Type: pluginsdk.TypeString, - Required: true, - }, - "db_version": { - Type: pluginsdk.TypeString, - Required: true, - }, - "character_set": { - Type: pluginsdk.TypeString, - Required: true, - }, - "ncharacter_set": { - Type: pluginsdk.TypeString, - Required: true, - }, - "vnet_id": { - Type: pluginsdk.TypeString, - Required: true, - }, - } -} - -func (AdbsCloneResource) Attributes() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{} -} - -func (AdbsCloneResource) ModelObject() interface{} { - return &AdbsCloneResource{} -} - -func (AdbsCloneResource) ResourceType() string { - return "azurerm_oracledatabase_autonomous_database_clone" -} - -func (r AdbsCloneResource) Create() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 30 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases - subscriptionId := metadata.Client.Account.SubscriptionId - - var model AdbsCloneResourceModel - if err := metadata.Decode(&model); err != nil { - return err - } - - id := autonomousdatabases.NewAutonomousDatabaseID(subscriptionId, - model.ResourceGroupName, - model.Name) - - existing, err := client.Get(ctx, id) - if err != nil && !response.WasNotFound(existing.HttpResponse) { - return fmt.Errorf("checking for presence of existing %s: %+v", id, err) - } - if !response.WasNotFound(existing.HttpResponse) { - return metadata.ResourceRequiresImport(r.ResourceType(), id) - } - - param := autonomousdatabases.AutonomousDatabase{ - Name: pointer.To(model.Name), - Location: model.Location, - Tags: tags.Expand(model.Tags), - Properties: &autonomousdatabases.AutonomousDatabaseCloneProperties{ - DisplayName: pointer.To(model.DisplayName), - SubnetId: pointer.To(model.SubnetId), - ComputeModel: pointer.To(autonomousdatabases.ComputeModel(model.ComputeModel)), - ComputeCount: pointer.To(model.ComputeCount), - LicenseModel: pointer.To(autonomousdatabases.LicenseModel(model.LicenseModel)), - DataStorageSizeInGbs: pointer.To(model.DataStorageSizeInGbs), - DbWorkload: pointer.To(autonomousdatabases.WorkloadType(model.DbWorkload)), - AdminPassword: pointer.To(model.AdminPassword), - DbVersion: pointer.To(model.DbVersion), - CharacterSet: pointer.To(model.CharacterSet), - NcharacterSet: pointer.To(model.NcharacterSet), - VnetId: pointer.To(model.VnetId), - }, - } - - if err := client.CreateOrUpdateThenPoll(ctx, id, param); err != nil { - return fmt.Errorf("creating %s: %+v", id, err) - } - - metadata.SetID(id) - return nil - }, - } -} - -func (r AdbsCloneResource) Update() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 30 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - - client := metadata.Client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases - id, err := autonomousdatabases.ParseAutonomousDatabaseID(metadata.ResourceData.Id()) - if err != nil { - return err - } - - var model AdbsCloneResourceModel - if err = metadata.Decode(&model); err != nil { - return fmt.Errorf("decoding err: %+v", err) - } - - existing, err := client.Get(ctx, *id) - if err != nil { - return fmt.Errorf("retrieving exists when updating: +%v", *id) - } - if existing.Model == nil && existing.Model.Properties == nil { - return fmt.Errorf("retrieving as nil when updating for %v", *id) - } - - upd := existing.Model - - err = client.CreateOrUpdateThenPoll(ctx, *id, *upd) - if err != nil { - return fmt.Errorf("updating %s: %v", id, err) - } - return nil - }, - } -} - -func (AdbsCloneResource) Read() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 5 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - id, err := autonomousdatabases.ParseAutonomousDatabaseID(metadata.ResourceData.Id()) - if err != nil { - return err - } - - client := metadata.Client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases - result, err := client.Get(ctx, *id) - if err != nil { - if response.WasNotFound(result.HttpResponse) { - return metadata.MarkAsGone(id) - } - return err - } - - if result.Model == nil { - return fmt.Errorf("retrieving %s got nil model", id) - } - prop := result.Model.Properties - switch adbsPropModel := prop.(type) { - case autonomousdatabases.AutonomousDatabaseCloneProperties: - var output AdbsCloneResourceModel - output.DisplayName = pointer.From(adbsPropModel.DisplayName) - output.ComputeModel = string(pointer.From(adbsPropModel.ComputeModel)) - output.ComputeCount = pointer.From(adbsPropModel.ComputeCount) - output.LicenseModel = string(pointer.From(adbsPropModel.LicenseModel)) - output.DataStorageSizeInGbs = pointer.From(adbsPropModel.DataStorageSizeInGbs) - output.DbWorkload = string(pointer.From(adbsPropModel.DbWorkload)) - output.AdminPassword = pointer.From(adbsPropModel.AdminPassword) - output.DbVersion = pointer.From(adbsPropModel.DbVersion) - output.CharacterSet = pointer.From(adbsPropModel.CharacterSet) - output.NcharacterSet = pointer.From(adbsPropModel.NcharacterSet) - output.VnetId = pointer.From(adbsPropModel.VnetId) - - return metadata.Encode(&output) - default: - return fmt.Errorf("unexpected Autonomous Database type, must be of type Clone") - } - }, - } -} - -func (AdbsCloneResource) Delete() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 30 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases - - id, err := autonomousdatabases.ParseAutonomousDatabaseID(metadata.ResourceData.Id()) - if err != nil { - return err - } - - if err = client.DeleteThenPoll(ctx, *id); err != nil { - return fmt.Errorf("deleting %s: %+v", *id, err) - } - - return nil - }, - } -} - -func (AdbsCloneResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { - return autonomousdatabases.ValidateAutonomousDatabaseID -} diff --git a/internal/services/oracledatabase/autonomous_database_clone_resource_test.go b/internal/services/oracledatabase/autonomous_database_clone_resource_test.go deleted file mode 100644 index a87319077eba..000000000000 --- a/internal/services/oracledatabase/autonomous_database_clone_resource_test.go +++ /dev/null @@ -1,209 +0,0 @@ -// Copyright © 2024, Oracle and/or its affiliates. All rights reserved - -package oracledatabase_test - -import ( - "context" - "fmt" - "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases" - "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" - "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" - "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracledatabase" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" - "testing" -) - -type AdbsCloneResource struct{} - -func (a AdbsCloneResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := autonomousdatabases.ParseAutonomousDatabaseID(state.ID) - if err != nil { - return nil, err - } - resp, err := client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases.Get(ctx, *id) - if err != nil { - return nil, fmt.Errorf("retrieving adbs %s: %+v", id, err) - } - return utils.Bool(resp.Model != nil), nil -} - -func (a AdbsCloneResource) Destroy(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := autonomousdatabases.ParseAutonomousDatabaseID(state.ID) - if err != nil { - return nil, err - } - if _, err := client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases.Delete(ctx, *id); err != nil { - return nil, fmt.Errorf("deleting adbs %s: %+v", id, err) - } - return utils.Bool(true), nil -} - -func TestAdbsCloneResource_basic(t *testing.T) { - data := acceptance.BuildTestData(t, oracledatabase.AdbsCloneResource{}.ResourceType(), "test") - r := AdbsCloneResource{} - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.basic(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep(), - }) -} - -func TestAdbsCloneResource_update(t *testing.T) { - data := acceptance.BuildTestData(t, oracledatabase.AdbsCloneResource{}.ResourceType(), "test") - r := AdbsCloneResource{} - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.basic(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep(), - { - Config: r.update(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep(), - }) -} - -func TestAdbsCloneResource_requiresImport(t *testing.T) { - data := acceptance.BuildTestData(t, oracledatabase.AdbsCloneResource{}.ResourceType(), "test") - r := AdbsCloneResource{} - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.basic(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.RequiresImportErrorStep(r.requiresImport), - }) -} - -func (a AdbsCloneResource) basic(data acceptance.TestData) string { - return fmt.Sprintf(` - -%s - -resource "azurerm_oracledatabase_autonomous_database_clone" "test" { - name = "OFake%[2]d" - display_name = "OFake%[2]d" - resource_group_name = azurerm_resource_group.test.name - location = "%[3]s" - compute_model = "ECPU" - compute_count = "2" - license_model = "BringYourOwnLicense" - data_storage_size_in_gbs = "32" - db_workload = "OLTP" - admin_password = "TestPass#2024#" - db_version = "19c" - character_set = "AL32UTF8" - ncharacter_set = "AL16UTF16" - subnet_id = azurerm_subnet.virtual_network_subnet.id - vnet_id = azurerm_virtual_network.virtual_network.id -} -`, a.template(data), data.RandomInteger, data.Locations.Primary) -} - -func (a AdbsCloneResource) update(data acceptance.TestData) string { - return fmt.Sprintf(` - -%s - -resource "azurerm_oracledatabase_autonomous_database_clone" "test" { - name = "OFake%[2]d" - display_name = "OFake%[2]d" - resource_group_name = azurerm_resource_group.test.name - location = "%[3]s" - compute_model = "ECPU" - compute_count = "2" - license_model = "BringYourOwnLicense" - data_storage_size_in_gbs = "32" - db_workload = "OLTP" - admin_password = "TestPass#2024#" - db_version = "19c" - character_set = "AL32UTF8" - ncharacter_set = "AL16UTF16" - subnet_id = azurerm_subnet.virtual_network_subnet.id - vnet_id = azurerm_virtual_network.virtual_network.id - tags = { - test = "test1" - } -} -`, a.template(data), data.RandomInteger, data.Locations.Primary) -} - -func (a AdbsCloneResource) requiresImport(data acceptance.TestData) string { - return fmt.Sprintf(` -%s - -resource "azurerm_oracledatabase_autonomous_database_clone" "import" { - name = azurerm_oracledatabase_autonomous_database_clone.test.name - display_name = azurerm_oracledatabase_autonomous_database_clone.test.display_name - resource_group_name = azurerm_oracledatabase_autonomous_database_clone.test.resource_group_name - location = azurerm_oracledatabase_autonomous_database_clone.test.location - compute_model = azurerm_oracledatabase_autonomous_database_clone.test.compute_model - compute_count = azurerm_oracledatabase_autonomous_database_clone.test.compute_count - license_model = azurerm_oracledatabase_autonomous_database_clone.test.license_model - data_storage_size_in_gbs = azurerm_oracledatabase_autonomous_database_clone.test.data_storage_size_in_gbs - db_workload = azurerm_oracledatabase_autonomous_database_clone.test.db_workload - admin_password = azurerm_oracledatabase_autonomous_database_clone.test.admin_password - db_version = azurerm_oracledatabase_autonomous_database_clone.test.db_version - character_set = azurerm_oracledatabase_autonomous_database_clone.test.character_set - ncharacter_set = azurerm_oracledatabase_autonomous_database_clone.test.ncharacter_set - subnet_id = azurerm_oracledatabase_autonomous_database_clone.test.subnet_id - vnet_id = azurerm_oracledatabase_autonomous_database_clone.test.vnet_id -} -`, a.basic(data)) -} - -func (a AdbsCloneResource) template(data acceptance.TestData) string { - return fmt.Sprintf(` -provider "azurerm" { - features {} -} - -data "azurerm_client_config" "current" {} - -resource "azurerm_resource_group" "test" { - name = "acctestRG-%[1]d" - location = "%[2]s" -} - -resource "azurerm_virtual_network" "virtual_network" { - name = "OFakeacctest%[1]d_vnet" - address_space = ["10.0.0.0/16"] - location = "%[2]s" - resource_group_name = azurerm_resource_group.test.name -} - -resource "azurerm_subnet" "virtual_network_subnet" { - name = "OFakeacctest%[1]d" - resource_group_name = azurerm_resource_group.test.name - virtual_network_name = azurerm_virtual_network.virtual_network.name - address_prefixes = ["10.0.1.0/24"] - - delegation { - name = "delegation" - - service_delegation { - actions = [ - "Microsoft.Network/networkinterfaces/*", - "Microsoft.Network/virtualNetworks/subnets/join/action", - ] - name = "Oracle.Database/networkAttachments" - } - } -} - -`, data.RandomInteger, data.Locations.Primary, data.RandomString) -} diff --git a/internal/services/oracledatabase/autonomous_database_regular_data_source_test.go b/internal/services/oracledatabase/autonomous_database_regular_data_source_test.go new file mode 100644 index 000000000000..99b674a3c0fd --- /dev/null +++ b/internal/services/oracledatabase/autonomous_database_regular_data_source_test.go @@ -0,0 +1,43 @@ +// Copyright © 2024, Oracle and/or its affiliates. All rights reserved + +package oracledatabase_test + +import ( + "fmt" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracledatabase" + "testing" +) + +type AutonomousDatabaseRegularDataSource struct{} + +func TestAdbsRegularDataSource_basic(t *testing.T) { + data := acceptance.BuildTestData(t, oracledatabase.AutonomousDatabaseRegularDataSource{}.ResourceType(), "test") + r := AutonomousDatabaseRegularDataSource{} + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("location").Exists(), + check.That(data.ResourceName).Key("name").Exists(), + check.That(data.ResourceName).Key("resource_group_name").Exists(), + check.That(data.ResourceName).Key("data_storage_size_in_gbs").Exists(), + check.That(data.ResourceName).Key("display_name").Exists(), + check.That(data.ResourceName).Key("license_model").Exists(), + ), + }, + }) +} + +func (d AutonomousDatabaseRegularDataSource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +data "azurerm_oracledatabase_autonomous_database_regular" "test" { + name = azurerm_oracledatabase_autonomous_database_regular.test.name + resource_group_name = azurerm_oracledatabase_autonomous_database_regular.test.resource_group_name +} +`, AdbsRegularResource{}.basic(data)) +} diff --git a/internal/services/oracledatabase/autonomous_database_regular_resource.go b/internal/services/oracledatabase/autonomous_database_regular_resource.go index a7494be4c287..f611424a01f9 100644 --- a/internal/services/oracledatabase/autonomous_database_regular_resource.go +++ b/internal/services/oracledatabase/autonomous_database_regular_resource.go @@ -84,8 +84,9 @@ func (AdbsRegularResource) Arguments() map[string]*pluginsdk.Schema { Required: true, }, "admin_password": { - Type: pluginsdk.TypeString, - Required: true, + Type: pluginsdk.TypeString, + Required: true, + Sensitive: true, }, "db_version": { Type: pluginsdk.TypeString, @@ -120,7 +121,7 @@ func (AdbsRegularResource) ResourceType() string { func (r AdbsRegularResource) Create() sdk.ResourceFunc { return sdk.ResourceFunc{ - Timeout: 30 * time.Minute, + Timeout: 60 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases subscriptionId := metadata.Client.Account.SubscriptionId @@ -196,11 +197,16 @@ func (r AdbsRegularResource) Update() sdk.ResourceFunc { return fmt.Errorf("retrieving as nil when updating for %v", *id) } - upd := existing.Model - - err = client.CreateOrUpdateThenPoll(ctx, *id, *upd) - if err != nil { - return fmt.Errorf("updating %s: %v", id, err) + if metadata.ResourceData.HasChange("tags") { + update := &autonomousdatabases.AutonomousDatabaseUpdate{ + Tags: tags.Expand(model.Tags), + } + err = client.UpdateThenPoll(ctx, *id, *update) + if err != nil { + return fmt.Errorf("updating %s: %v", id, err) + } + } else if metadata.ResourceData.HasChangesExcept("tags") { + return fmt.Errorf("only `tags` currently support updates") } return nil }, @@ -238,7 +244,6 @@ func (AdbsRegularResource) Read() sdk.ResourceFunc { output.Tags = utils.FlattenPtrMapStringString(result.Model.Tags) output.ResourceGroupName = id.ResourceGroupName output.DisplayName = pointer.From(adbsPropModel.DisplayName) - output.AdminPassword = pointer.From(adbsPropModel.AdminPassword) output.ComputeModel = string(pointer.From(adbsPropModel.ComputeModel)) output.ComputeCount = pointer.From(adbsPropModel.ComputeCount) output.LicenseModel = string(pointer.From(adbsPropModel.LicenseModel)) diff --git a/internal/services/oracledatabase/autonomous_database_regular_resource_test.go b/internal/services/oracledatabase/autonomous_database_regular_resource_test.go index 28c7f0f54cb8..0681bc1b29e1 100644 --- a/internal/services/oracledatabase/autonomous_database_regular_resource_test.go +++ b/internal/services/oracledatabase/autonomous_database_regular_resource_test.go @@ -110,6 +110,11 @@ resource "azurerm_oracledatabase_autonomous_database_regular" "test" { ncharacter_set = "AL16UTF16" subnet_id = azurerm_subnet.virtual_network_subnet.id vnet_id = azurerm_virtual_network.virtual_network.id + lifecycle { + ignore_changes = [ + admin_password + ] + } } `, a.template(data), data.RandomInteger, data.Locations.Primary) } @@ -138,6 +143,11 @@ resource "azurerm_oracledatabase_autonomous_database_regular" "test" { tags = { test = "test1" } + lifecycle { + ignore_changes = [ + admin_password + ] + } } `, a.template(data), data.RandomInteger, data.Locations.Primary) } @@ -162,6 +172,11 @@ resource "azurerm_oracledatabase_autonomous_database_regular" "import" { ncharacter_set = azurerm_oracledatabase_autonomous_database_regular.test.ncharacter_set subnet_id = azurerm_oracledatabase_autonomous_database_regular.test.subnet_id vnet_id = azurerm_oracledatabase_autonomous_database_regular.test.vnet_id + lifecycle { + ignore_changes = [ + admin_password + ] + } } `, a.basic(data)) } diff --git a/internal/services/oracledatabase/registration.go b/internal/services/oracledatabase/registration.go index d7318afbcd84..3d37af313cba 100644 --- a/internal/services/oracledatabase/registration.go +++ b/internal/services/oracledatabase/registration.go @@ -17,7 +17,6 @@ func (r Registration) DataSources() []sdk.DataSource { ExadataInfraDataSource{}, CloudVmClusterDataSource{}, DBServersDataSource{}, - AutonomousDatabaseCloneDataSource{}, AutonomousDatabaseRegularDataSource{}, } } @@ -26,7 +25,6 @@ func (r Registration) Resources() []sdk.Resource { return []sdk.Resource{ ExadataInfraResource{}, CloudVmClusterResource{}, - AdbsCloneResource{}, AdbsRegularResource{}, } } From d1e4479f613bdc75f413a3d7ffed2ef302a901ed Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Thu, 5 Sep 2024 16:24:15 +0100 Subject: [PATCH 07/43] * Improvements. --- ...autonomous_database_regular_data_source.go | 13 +- .../autonomous_database_regular_resource.go | 172 ++++++++++++------ ...tonomous_database_regular_resource_test.go | 13 ++ ..._autonomous_database_regular.html.markdown | 157 ++++++++++++++++ ..._autonomous_database_regular.html.markdown | 113 ++++++++++++ 5 files changed, 406 insertions(+), 62 deletions(-) create mode 100644 website/docs/d/oracledatabase_autonomous_database_regular.html.markdown create mode 100644 website/docs/r/oracledatabase_autonomous_database_regular.html.markdown diff --git a/internal/services/oracledatabase/autonomous_database_regular_data_source.go b/internal/services/oracledatabase/autonomous_database_regular_data_source.go index 0136b1f6361f..6099dfac7778 100644 --- a/internal/services/oracledatabase/autonomous_database_regular_data_source.go +++ b/internal/services/oracledatabase/autonomous_database_regular_data_source.go @@ -20,16 +20,16 @@ import ( type AutonomousDatabaseRegularDataSource struct{} type AutonomousDatabaseRegularModel struct { - Name string `tfschema:"name"` - Type string `tfschema:"type"` - Tags map[string]interface{} `tfschema:"tags"` + Location string `tfschema:"location"` + Name string `tfschema:"name"` + Type string `tfschema:"type"` + Tags map[string]interface{} `tfschema:"tags"` // SystemData SystemData []SystemDataModel `tfschema:"system_data"` // AutonomousDatabaseProperties ActualUsedDataStorageSizeInTbs float64 `tfschema:"actual_used_data_storage_size_in_tbs"` - AdminPassword string `tfschema:"admin_password"` AllocatedStorageSizeInTbs float64 `tfschema:"allocated_storage_size_in_tbs"` AutonomousDatabaseId string `tfschema:"autonomous_database_id"` AvailableUpgradeVersions []string `tfschema:"available_upgrade_versions"` @@ -142,10 +142,6 @@ func (d AutonomousDatabaseRegularDataSource) Attributes() map[string]*pluginsdk. Type: pluginsdk.TypeFloat, Computed: true, }, - "admin_password": { - Type: pluginsdk.TypeString, - Computed: true, - }, "allocated_storage_size_in_tbs": { Type: pluginsdk.TypeFloat, Computed: true, @@ -424,7 +420,6 @@ func (d AutonomousDatabaseRegularDataSource) Read() sdk.ResourceFunc { case autonomousdatabases.AutonomousDatabaseProperties: output = AutonomousDatabaseRegularModel{ ActualUsedDataStorageSizeInTbs: pointer.From(adbsPropModel.ActualUsedDataStorageSizeInTbs), - AdminPassword: pointer.From(adbsPropModel.AdminPassword), AllocatedStorageSizeInTbs: pointer.From(adbsPropModel.AllocatedStorageSizeInTbs), AutonomousDatabaseId: pointer.From(adbsPropModel.AutonomousDatabaseId), AvailableUpgradeVersions: pointer.From(adbsPropModel.AvailableUpgradeVersions), diff --git a/internal/services/oracledatabase/autonomous_database_regular_resource.go b/internal/services/oracledatabase/autonomous_database_regular_resource.go index f611424a01f9..cbb04f630a7a 100644 --- a/internal/services/oracledatabase/autonomous_database_regular_resource.go +++ b/internal/services/oracledatabase/autonomous_database_regular_resource.go @@ -22,48 +22,59 @@ var _ sdk.Resource = AdbsRegularResource{} type AdbsRegularResource struct{} type AdbsRegularResourceModel struct { + // Azure Location string `tfschema:"location"` Name string `tfschema:"name"` ResourceGroupName string `tfschema:"resource_group_name"` Tags map[string]interface{} `tfschema:"tags"` - DisplayName string `tfschema:"display_name"` - SubnetId string `tfschema:"subnet_id"` - ComputeModel string `tfschema:"compute_model"` - ComputeCount float64 `tfschema:"compute_count"` - LicenseModel string `tfschema:"license_model"` - DataStorageSizeInGbs int64 `tfschema:"data_storage_size_in_gbs"` - DbWorkload string `tfschema:"db_workload"` - AdminPassword string `tfschema:"admin_password"` - DbVersion string `tfschema:"db_version"` - CharacterSet string `tfschema:"character_set"` - NcharacterSet string `tfschema:"ncharacter_set"` - VnetId string `tfschema:"vnet_id"` + // Required + AdminPassword string `tfschema:"admin_password"` + BackupRetentionPeriodInDays int64 `tfschema:"backup_retention_period_in_days"` + CharacterSet string `tfschema:"character_set"` + ComputeCount float64 `tfschema:"compute_count"` + ComputeModel string `tfschema:"compute_model"` + DataStorageSizeInGbs int64 `tfschema:"data_storage_size_in_gbs"` + DbVersion string `tfschema:"db_version"` + DbWorkload string `tfschema:"db_workload"` + DisplayName string `tfschema:"display_name"` + LicenseModel string `tfschema:"license_model"` + IsAutoScalingEnabled bool `tfschema:"is_auto_scaling_enabled"` + IsAutoScalingForStorageEnabled bool `tfschema:"is_auto_scaling_for_storage_enabled"` + IsMtlsConnectionRequired bool `tfschema:"is_mtls_connection_required"` + NcharacterSet string `tfschema:"ncharacter_set"` + SubnetId string `tfschema:"subnet_id"` + VnetId string `tfschema:"vnet_id"` + + // Optional + CustomerContacts []string `tfschema:"customer_contacts"` } func (AdbsRegularResource) Arguments() map[string]*pluginsdk.Schema { return map[string]*pluginsdk.Schema{ + // Azure "location": commonschema.Location(), - "tags": commonschema.Tags(), - "resource_group_name": { + "name": { Type: pluginsdk.TypeString, Required: true, }, - "name": { + "resource_group_name": { Type: pluginsdk.TypeString, Required: true, }, + "tags": commonschema.Tags(), - // AdbsRegularResource - "display_name": { - Type: pluginsdk.TypeString, - Required: true, + // Required + "admin_password": { + Type: pluginsdk.TypeString, + Required: true, + Sensitive: true, }, - "subnet_id": { - Type: pluginsdk.TypeString, + "backup_retention_period_in_days": { + Type: pluginsdk.TypeInt, Required: true, }, - "compute_model": { + "character_set": { Type: pluginsdk.TypeString, Required: true, }, @@ -71,7 +82,7 @@ func (AdbsRegularResource) Arguments() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeFloat, Required: true, }, - "license_model": { + "compute_model": { Type: pluginsdk.TypeString, Required: true, }, @@ -79,20 +90,31 @@ func (AdbsRegularResource) Arguments() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeInt, Required: true, }, - "db_workload": { + "db_version": { Type: pluginsdk.TypeString, Required: true, }, - "admin_password": { - Type: pluginsdk.TypeString, - Required: true, - Sensitive: true, + "db_workload": { + Type: pluginsdk.TypeString, + Required: true, }, - "db_version": { + "display_name": { Type: pluginsdk.TypeString, Required: true, }, - "character_set": { + "is_auto_scaling_enabled": { + Type: pluginsdk.TypeBool, + Required: true, + }, + "is_auto_scaling_for_storage_enabled": { + Type: pluginsdk.TypeBool, + Required: true, + }, + "is_mtls_connection_required": { + Type: pluginsdk.TypeBool, + Required: true, + }, + "license_model": { Type: pluginsdk.TypeString, Required: true, }, @@ -100,10 +122,24 @@ func (AdbsRegularResource) Arguments() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeString, Required: true, }, + "subnet_id": { + Type: pluginsdk.TypeString, + Required: true, + }, "vnet_id": { Type: pluginsdk.TypeString, Required: true, }, + + // Optional + "customer_contacts": { + Type: pluginsdk.TypeList, + Optional: true, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, } } @@ -119,6 +155,28 @@ func (AdbsRegularResource) ResourceType() string { return "azurerm_oracledatabase_autonomous_database_regular" } +func convertAdbsCustomerContactsToSDK(customerContactsList []string) []autonomousdatabases.CustomerContact { + var customerContacts []autonomousdatabases.CustomerContact + if customerContactsList != nil { + for _, customerContact := range customerContactsList { + customerContacts = append(customerContacts, autonomousdatabases.CustomerContact{ + Email: customerContact, + }) + } + } + return customerContacts +} + +func convertAdbsCustomerContactsToInternalModel(customerContactsList *[]autonomousdatabases.CustomerContact) []string { + var customerContacts []string + if customerContactsList != nil { + for _, customerContact := range *customerContactsList { + customerContacts = append(customerContacts, customerContact.Email) + } + } + return customerContacts +} + func (r AdbsRegularResource) Create() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 60 * time.Minute, @@ -148,18 +206,23 @@ func (r AdbsRegularResource) Create() sdk.ResourceFunc { Location: model.Location, Tags: tags.Expand(model.Tags), Properties: &autonomousdatabases.AutonomousDatabaseProperties{ - DisplayName: pointer.To(model.DisplayName), - SubnetId: pointer.To(model.SubnetId), - ComputeModel: pointer.To(autonomousdatabases.ComputeModel(model.ComputeModel)), - ComputeCount: pointer.To(model.ComputeCount), - LicenseModel: pointer.To(autonomousdatabases.LicenseModel(model.LicenseModel)), - DataStorageSizeInGbs: pointer.To(model.DataStorageSizeInGbs), - DbWorkload: pointer.To(autonomousdatabases.WorkloadType(model.DbWorkload)), - AdminPassword: pointer.To(model.AdminPassword), - DbVersion: pointer.To(model.DbVersion), - CharacterSet: pointer.To(model.CharacterSet), - NcharacterSet: pointer.To(model.NcharacterSet), - VnetId: pointer.To(model.VnetId), + AdminPassword: pointer.To(model.AdminPassword), + BackupRetentionPeriodInDays: pointer.To(model.BackupRetentionPeriodInDays), + CharacterSet: pointer.To(model.CharacterSet), + ComputeCount: pointer.To(model.ComputeCount), + ComputeModel: pointer.To(autonomousdatabases.ComputeModel(model.ComputeModel)), + CustomerContacts: pointer.To(convertAdbsCustomerContactsToSDK(model.CustomerContacts)), + DataStorageSizeInGbs: pointer.To(model.DataStorageSizeInGbs), + DbWorkload: pointer.To(autonomousdatabases.WorkloadType(model.DbWorkload)), + DbVersion: pointer.To(model.DbVersion), + DisplayName: pointer.To(model.DisplayName), + IsAutoScalingEnabled: pointer.To(model.IsAutoScalingEnabled), + IsAutoScalingForStorageEnabled: pointer.To(model.IsAutoScalingForStorageEnabled), + IsMtlsConnectionRequired: pointer.To(model.IsMtlsConnectionRequired), + LicenseModel: pointer.To(autonomousdatabases.LicenseModel(model.LicenseModel)), + NcharacterSet: pointer.To(model.NcharacterSet), + SubnetId: pointer.To(model.SubnetId), + VnetId: pointer.To(model.VnetId), }, } @@ -238,23 +301,26 @@ func (AdbsRegularResource) Read() sdk.ResourceFunc { switch adbsPropModel := prop.(type) { case autonomousdatabases.AutonomousDatabaseProperties: var output AdbsRegularResourceModel - // Azure - output.Name = pointer.ToString(result.Model.Name) - output.Location = result.Model.Location - output.Tags = utils.FlattenPtrMapStringString(result.Model.Tags) - output.ResourceGroupName = id.ResourceGroupName - output.DisplayName = pointer.From(adbsPropModel.DisplayName) - output.ComputeModel = string(pointer.From(adbsPropModel.ComputeModel)) + output.AdminPassword = pointer.From(adbsPropModel.AdminPassword) + output.BackupRetentionPeriodInDays = pointer.From(adbsPropModel.BackupRetentionPeriodInDays) + output.CharacterSet = pointer.From(adbsPropModel.CharacterSet) output.ComputeCount = pointer.From(adbsPropModel.ComputeCount) - output.LicenseModel = string(pointer.From(adbsPropModel.LicenseModel)) + output.ComputeModel = string(pointer.From(adbsPropModel.ComputeModel)) + output.CustomerContacts = convertAdbsCustomerContactsToInternalModel(adbsPropModel.CustomerContacts) output.DataStorageSizeInGbs = pointer.From(adbsPropModel.DataStorageSizeInGbs) output.DbWorkload = string(pointer.From(adbsPropModel.DbWorkload)) - output.AdminPassword = pointer.From(adbsPropModel.AdminPassword) output.DbVersion = pointer.From(adbsPropModel.DbVersion) - output.CharacterSet = pointer.From(adbsPropModel.CharacterSet) + output.DisplayName = pointer.From(adbsPropModel.DisplayName) + output.IsAutoScalingEnabled = pointer.From(adbsPropModel.IsAutoScalingEnabled) + output.IsAutoScalingForStorageEnabled = pointer.From(adbsPropModel.IsAutoScalingForStorageEnabled) + output.Location = result.Model.Location + output.Name = pointer.ToString(result.Model.Name) + output.LicenseModel = string(pointer.From(adbsPropModel.LicenseModel)) output.NcharacterSet = pointer.From(adbsPropModel.NcharacterSet) - output.VnetId = pointer.From(adbsPropModel.VnetId) + output.ResourceGroupName = id.ResourceGroupName output.SubnetId = pointer.From(adbsPropModel.SubnetId) + output.Tags = utils.FlattenPtrMapStringString(result.Model.Tags) + output.VnetId = pointer.From(adbsPropModel.VnetId) return metadata.Encode(&output) default: diff --git a/internal/services/oracledatabase/autonomous_database_regular_resource_test.go b/internal/services/oracledatabase/autonomous_database_regular_resource_test.go index 0681bc1b29e1..6b2b133744b8 100644 --- a/internal/services/oracledatabase/autonomous_database_regular_resource_test.go +++ b/internal/services/oracledatabase/autonomous_database_regular_resource_test.go @@ -96,12 +96,17 @@ func (a AdbsRegularResource) basic(data acceptance.TestData) string { resource "azurerm_oracledatabase_autonomous_database_regular" "test" { name = "OFake%[2]d" + display_name = "OFake%[2]d" resource_group_name = azurerm_resource_group.test.name location = "%[3]s" compute_model = "ECPU" compute_count = "2" license_model = "BringYourOwnLicense" + backup_retention_period_in_days = 12 + is_auto_scaling_enabled = false + is_auto_scaling_for_storage_enabled = false + is_mtls_connection_required = false data_storage_size_in_gbs = "32" db_workload = "OLTP" admin_password = "TestPass#2024#" @@ -132,6 +137,10 @@ resource "azurerm_oracledatabase_autonomous_database_regular" "test" { compute_model = "ECPU" compute_count = "2" license_model = "BringYourOwnLicense" + backup_retention_period_in_days = 12 + is_auto_scaling_enabled = false + is_auto_scaling_for_storage_enabled = false + is_mtls_connection_required = false data_storage_size_in_gbs = "32" db_workload = "OLTP" admin_password = "TestPass#2024#" @@ -164,6 +173,10 @@ resource "azurerm_oracledatabase_autonomous_database_regular" "import" { compute_model = azurerm_oracledatabase_autonomous_database_regular.test.compute_model compute_count = azurerm_oracledatabase_autonomous_database_regular.test.compute_count license_model = azurerm_oracledatabase_autonomous_database_regular.test.license_model + backup_retention_period_in_days = azurerm_oracledatabase_autonomous_database_regular.test.backup_retention_period_in_days + is_auto_scaling_enabled = azurerm_oracledatabase_autonomous_database_regular.test.is_auto_scaling_enabled + is_auto_scaling_for_storage_enabled = azurerm_oracledatabase_autonomous_database_regular.test.is_auto_scaling_for_storage_enabled + is_mtls_connection_required = azurerm_oracledatabase_autonomous_database_regular.test.is_mtls_connection_required data_storage_size_in_gbs = azurerm_oracledatabase_autonomous_database_regular.test.data_storage_size_in_gbs db_workload = azurerm_oracledatabase_autonomous_database_regular.test.db_workload admin_password = azurerm_oracledatabase_autonomous_database_regular.test.admin_password diff --git a/website/docs/d/oracledatabase_autonomous_database_regular.html.markdown b/website/docs/d/oracledatabase_autonomous_database_regular.html.markdown new file mode 100644 index 000000000000..e655b7b639bf --- /dev/null +++ b/website/docs/d/oracledatabase_autonomous_database_regular.html.markdown @@ -0,0 +1,157 @@ +--- +subcategory: "App Service" +layout: "azurerm" +page_title: "Azure Resource Manager: Data Source: azurerm_oracledatabase_autonomous_database_regular" +description: |- + Gets information about an existing Autonomous Databases. +--- + +# Data Source: azurerm_oracledatabase_autonomous_database_regular + +Use this data source to access information about an existing Autonomous Databases. + +## Example Usage + +```hcl +data "azurerm_oracledatabase_autonomous_database_regular" "example" { + name = "existing" + resource_group_name = "existing" +} + +output "id" { + value = data.azurerm_oracledatabase_autonomous_database_regular.example.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name of this Autonomous Databases. + +* `resource_group_name` - (Required) The name of the Resource Group where the Autonomous Databases exists. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Autonomous Databases. + +* `actual_used_data_storage_size_in_tbs` - The current amount of storage in use for user and system data, in terabytes (TB). + +* `allocated_storage_size_in_tbs` - The amount of storage currently allocated for the database tables and billed for, rounded up. When auto-scaling is not enabled, this value is equal to the `dataStorageSizeInTBs` value. You can compare this value to the `actualUsedDataStorageSizeInTBs` value to determine if a manual shrink operation is appropriate for your allocated storage. + +* `autonomous_database_id` - The database [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm). + +* `available_upgrade_versions` - List of Oracle Database versions available for a database upgrade. If there are no version upgrades available, this list is empty. + +* `backup_retention_period_in_days` - Retention period, in days, for backups. + +* `character_set` - The character set for the autonomous database. The default is AL32UTF8. Allowed values are: + * AL32UTF8, AR8ADOS710, AR8ADOS720, AR8APTEC715, AR8ARABICMACS, AR8ASMO8X, AR8ISO8859P6, AR8MSWIN1256, AR8MUSSAD768, AR8NAFITHA711, AR8NAFITHA721, AR8SAKHR706, AR8SAKHR707, AZ8ISO8859P9E, BG8MSWIN, BG8PC437S, BLT8CP921, BLT8ISO8859P13, BLT8MSWIN1257, BLT8PC775, BN8BSCII, CDN8PC863, CEL8ISO8859P14, CL8ISO8859P5, CL8ISOIR111, CL8KOI8R, CL8KOI8U, CL8MACCYRILLICS, CL8MSWIN1251, EE8ISO8859P2, EE8MACCES, EE8MACCROATIANS, EE8MSWIN1250, EE8PC852, EL8DEC, EL8ISO8859P7, EL8MACGREEKS, EL8MSWIN1253, EL8PC437S, EL8PC851, EL8PC869, ET8MSWIN923, HU8ABMOD, HU8CWI2, IN8ISCII, IS8PC861, IW8ISO8859P8, IW8MACHEBREWS, IW8MSWIN1255, IW8PC1507, JA16EUC, JA16EUCTILDE, JA16SJIS, JA16SJISTILDE, JA16VMS, KO16KSC5601, KO16KSCCS, KO16MSWIN949, LA8ISO6937, LA8PASSPORT, LT8MSWIN921, LT8PC772, LT8PC774, LV8PC1117, LV8PC8LR, LV8RST104090, N8PC865, NE8ISO8859P10, NEE8ISO8859P4, RU8BESTA, RU8PC855, RU8PC866, SE8ISO8859P3, TH8MACTHAIS, TH8TISASCII, TR8DEC, TR8MACTURKISHS, TR8MSWIN1254, TR8PC857, US7ASCII, US8PC437, UTF8, VN8MSWIN1258, VN8VN3, WE8DEC, WE8DG, WE8ISO8859P1, WE8ISO8859P15, WE8ISO8859P9, WE8MACROMAN8S, WE8MSWIN1252, WE8NCR4970, WE8NEXTSTEP, WE8PC850, WE8PC858, WE8PC860, WE8ROMAN8, ZHS16CGB231280, ZHS16GBK, ZHT16BIG5, ZHT16CCDC, ZHT16DBT, ZHT16HKSCS, ZHT16MSWIN950, ZHT32EUC, ZHT32SOPS, ZHT32TRIS + +* `compute_count` - The compute amount (CPUs) available to the database. Minimum and maximum values depend on the compute model and whether the database is an Autonomous Database Serverless instance or an Autonomous Database on Dedicated Exadata Infrastructure. For an Autonomous Database Serverless instance, the 'ECPU' compute model requires a minimum value of one, for databases in the elastic resource pool and minimum value of two, otherwise. Required when using the `computeModel` parameter. When using `cpuCoreCount` parameter, it is an error to specify computeCount to a non-null value. Providing `computeModel` and `computeCount` is the preferred method for both OCPU and ECPU. + +* `cpu_core_count` - The number of CPU cores to be made available to the database. When the ECPU is selected, the value for cpuCoreCount is 0. For Autonomous Database on Dedicated Exadata infrastructure, the maximum number of cores is determined by the infrastructure shape. See [Characteristics of Infrastructure Shapes](https://www.oracle.com/pls/topic/lookup?ctx=en/cloud/paas/autonomous-database&id=ATPFG-GUID-B0F033C1-CC5A-42F0-B2E7-3CECFEDA1FD1) for shape details. + +* `data_storage_size_in_gbs` - The quantity of data in the database, in gigabytes. + +* `data_storage_size_in_tbs` - The quantity of data in the database, in terabytes. + +* `db_node_storage_size_in_gbs` - The DB node storage size in, in gigabytes. + +* `db_version` - A valid Oracle Database version for Autonomous Database. + +* `display_name` - The user-friendly name for the Autonomous Database. The name does not have to be unique. + +* `failed_data_recovery_in_seconds` - Indicates the number of seconds of data loss for a Data Guard failover. + +* `in_memory_area_in_gbs` - The area assigned to In-Memory tables in Autonomous Database. + +* `is_auto_scaling_enabled` - Indicates if auto scaling is enabled for the Autonomous Database CPU core count. + +* `is_auto_scaling_for_storage_enabled` - Indicates if auto scaling is enabled for the Autonomous Database storage. + +* `is_local_data_guard_enabled` - Indicates whether the Autonomous Database has local (in-region) Data Guard enabled. Not applicable to cross-region Autonomous Data Guard associations, or to Autonomous Databases using dedicated Exadata infrastructure or Exadata Cloud@Customer infrastructure. + +* `is_mtls_connection_required` - Specifies if the Autonomous Database requires mTLS connections. + +* `is_preview` - Indicates if the Autonomous Database version is a preview version. + +* `is_preview_version_with_service_terms_accepted` - Indicates if the Autonomous Database version is a preview version with service terms accepted. + +* `is_remote_data_guard_enabled` - Indicates whether the Autonomous Database has Cross Region Data Guard enabled. Not applicable to Autonomous Databases using dedicated Exadata infrastructure or Exadata Cloud@Customer infrastructure. + +* `key_history_entry` - Key History Entry. + +* `lifecycle_details` - Information about the current lifecycle state. + +* `local_adg_auto_failover_max_data_loss_limit` - Parameter that allows users to select an acceptable maximum data loss limit in seconds, up to which Automatic Failover will be triggered when necessary for a Local Autonomous Data Guard + +* `location` - The Azure Region where the Autonomous Databases exists. + +* `memory_per_oracle_compute_unit_in_gbs` - The amount of memory (in GBs) enabled per ECPU or OCPU. + +* `ncharacter_set` - The national character set for the autonomous database. The default is AL16UTF16. Allowed values are: AL16UTF16 or UTF8. + +* `next_long_term_backup_time_stamp` - The date and time when the next long-term backup would be created. + +* `oci_url` - The URL of the resource in the OCI console. + +* `ocid` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the autonomous database. + +* `peer_db_ids` - The list of [OCIDs](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of standby databases located in Autonomous Data Guard remote regions that are associated with the source database. Note that for Autonomous Database Serverless instances, standby databases located in the same region as the source primary database do not have OCIDs. + +* `private_endpoint` - The private endpoint for the resource. + +* `private_endpoint_ip` - The private endpoint Ip address for the resource. + +* `private_endpoint_label` - The private endpoint label for the resource. + +* `provisionable_cpus` - An array of CPU values that an Autonomous Database can be scaled to. + +* `service_console_url` - The URL of the Service Console for the Autonomous Database. + +* `sql_web_developer_url` - The URL of the SQL web developer. + +* `subnet_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the subnet the resource is associated with. + +* `supported_regions_to_clone_to` - The list of regions that support the creation of an Autonomous Database clone or an Autonomous Data Guard standby database. + +* `tags` - A mapping of tags assigned to the Autonomous Databases. + +* `time_created` - The date and time the Autonomous Database was created. + +* `time_data_guard_role_changed` - The date and time the Autonomous Data Guard role was switched for the Autonomous Database. For databases that have standbys in both the primary Data Guard region and a remote Data Guard standby region, this is the latest timestamp of either the database using the "primary" role in the primary Data Guard region, or database located in the remote Data Guard standby region. + +* `time_deletion_of_free_autonomous_database` - The date and time the Always Free database will be automatically deleted because of inactivity. If the database is in the STOPPED state and without activity until this time, it will be deleted. + +* `time_local_data_guard_enabled` - The date and time that Autonomous Data Guard was enabled for an Autonomous Database where the standby was provisioned in the same region as the primary database. + +* `time_maintenance_begin` - The date and time when maintenance will begin. + +* `time_maintenance_end` - The date and time when maintenance will end. + +* `time_of_last_failover` - The timestamp of the last failover operation. + +* `time_of_last_refresh` - The date and time when last refresh happened. + +* `time_of_last_refresh_point` - The refresh point timestamp (UTC). The refresh point is the time to which the database was most recently refreshed. Data created after the refresh point is not included in the refresh. + +* `time_of_last_switchover` - The timestamp of the last switchover operation for the Autonomous Database. + +* `time_reclamation_of_free_autonomous_database` - The date and time the Always Free database will be stopped because of inactivity. If this time is reached without any database activity, the database will automatically be put into the STOPPED state. + +* `used_data_storage_size_in_gbs` - The storage space consumed by Autonomous Database in GBs. + +* `used_data_storage_size_in_tbs` - The amount of storage that has been used, in terabytes. + +* `vnet_id` - The ID to an Azure Resource Manager vnet resource. + +* `whitelisted_ips` - The client IP access control list (ACL). This feature is available for [Autonomous Database Serverless] (https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html) and on Exadata Cloud@Customer. Only clients connecting from an IP address included in the ACL may access the Autonomous Database instance. If `arePrimaryWhitelistedIpsUsed` is 'TRUE' then Autonomous Database uses this primary's IP access control list (ACL) for the disaster recovery peer called `standbywhitelistedips`. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the Autonomous Databases. \ No newline at end of file diff --git a/website/docs/r/oracledatabase_autonomous_database_regular.html.markdown b/website/docs/r/oracledatabase_autonomous_database_regular.html.markdown new file mode 100644 index 000000000000..e9e2f09fbe53 --- /dev/null +++ b/website/docs/r/oracledatabase_autonomous_database_regular.html.markdown @@ -0,0 +1,113 @@ +--- +subcategory: "App Service" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_oracledatabase_autonomous_database_regular" +description: |- + Manages a Autonomous Databases. +--- + +# azurerm_oracledatabase_autonomous_database_regular + +Manages a Autonomous Databases. + +## Example Usage + +```hcl +resource "azurerm_oracledatabase_autonomous_database_regular" "example" { + name = "example" + resource_group_name = "example" + location = "West Europe" + subnet_id = "example" + display_name = "example" + db_workload = "example" + is_mtls_connection_required = false + backup_retention_period_in_days = 42 + compute_model = "example" + data_storage_size_in_gbs = 42 + is_auto_scaling_for_storage_enabled = false + vnet_id = "example" + admin_password = "example" + is_auto_scaling_enabled = "example" + character_set = "example" + compute_count = 1.23456 + ncharacter_set = "example" + license_model = false + db_version = "example" +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `admin_password` - (Required) The password must be between 12 and 30 characters long, and must contain at least 1 uppercase, 1 lowercase, and 1 numeric character. It cannot contain the double quote symbol (") or the username "admin", regardless of casing. + +* `backup_retention_period_in_days` - (Optional) (Updatable) Retention period, in days, for backups. + +* `character_set` - (Required) The character set for the autonomous database. The default is AL32UTF8. Allowed values are: + AL32UTF8, AR8ADOS710, AR8ADOS720, AR8APTEC715, AR8ARABICMACS, AR8ASMO8X, AR8ISO8859P6, AR8MSWIN1256, AR8MUSSAD768, AR8NAFITHA711, AR8NAFITHA721, AR8SAKHR706, AR8SAKHR707, AZ8ISO8859P9E, BG8MSWIN, BG8PC437S, BLT8CP921, BLT8ISO8859P13, BLT8MSWIN1257, BLT8PC775, BN8BSCII, CDN8PC863, CEL8ISO8859P14, CL8ISO8859P5, CL8ISOIR111, CL8KOI8R, CL8KOI8U, CL8MACCYRILLICS, CL8MSWIN1251, EE8ISO8859P2, EE8MACCES, EE8MACCROATIANS, EE8MSWIN1250, EE8PC852, EL8DEC, EL8ISO8859P7, EL8MACGREEKS, EL8MSWIN1253, EL8PC437S, EL8PC851, EL8PC869, ET8MSWIN923, HU8ABMOD, HU8CWI2, IN8ISCII, IS8PC861, IW8ISO8859P8, IW8MACHEBREWS, IW8MSWIN1255, IW8PC1507, JA16EUC, JA16EUCTILDE, JA16SJIS, JA16SJISTILDE, JA16VMS, KO16KSC5601, KO16KSCCS, KO16MSWIN949, LA8ISO6937, LA8PASSPORT, LT8MSWIN921, LT8PC772, LT8PC774, LV8PC1117, LV8PC8LR, LV8RST104090, N8PC865, NE8ISO8859P10, NEE8ISO8859P4, RU8BESTA, RU8PC855, RU8PC866, SE8ISO8859P3, TH8MACTHAIS, TH8TISASCII, TR8DEC, TR8MACTURKISHS, TR8MSWIN1254, TR8PC857, US7ASCII, US8PC437, UTF8, VN8MSWIN1258, VN8VN3, WE8DEC, WE8DG, WE8ISO8859P1, WE8ISO8859P15, WE8ISO8859P9, WE8MACROMAN8S, WE8MSWIN1252, WE8NCR4970, WE8NEXTSTEP, WE8PC850, WE8PC858, WE8PC860, WE8ROMAN8, ZHS16CGB231280, ZHS16GBK, ZHT16BIG5, ZHT16CCDC, ZHT16DBT, ZHT16HKSCS, ZHT16MSWIN950, ZHT32EUC, ZHT32SOPS, ZHT32TRIS + +* `compute_count` - (Required) The compute amount (CPUs) available to the database. Minimum and maximum values depend on the compute model and whether the database is an Autonomous Database Serverless instance or an Autonomous Database on Dedicated Exadata Infrastructure. For an Autonomous Database Serverless instance, the 'ECPU' compute model requires a minimum value of one, for databases in the elastic resource pool and minimum value of two, otherwise. Required when using the `computeModel` parameter. When using `cpuCoreCount` parameter, it is an error to specify computeCount to a non-null value. Providing `computeModel` and `computeCount` is the preferred method for both OCPU and ECPU. + +* `compute_model` - (Required) The compute model of the Autonomous Database. This is required if using the `computeCount` parameter. If using `cpuCoreCount` then it is an error to specify `computeModel` to a non-null value. ECPU compute model is the recommended model and OCPU compute model is legacy. + +* `data_storage_size_in_gbs` - (Required) The quantity of data in the database, in gigabytes. + +* `db_version` - (Required) A valid Oracle Database version for Autonomous Database. + +* `db_workload` - (Required) The Autonomous Database workload type. The following values are valid: + * OLTP - indicates an Autonomous Transaction Processing database + * DW - indicates an Autonomous Data Warehouse database + * AJD - indicates an Autonomous JSON Database + * APEX - indicates an Autonomous Database with the Oracle APEX Application Development workload type. + +* `display_name` - (Required) The user-friendly name for the Autonomous Database. The name does not have to be unique. + +* `is_auto_scaling_enabled` - (Required) Indicates if auto scaling is enabled for the Autonomous Database CPU core count. The default value is `TRUE`. + +* `is_auto_scaling_for_storage_enabled` - (Required) Indicates if auto scaling is enabled for the Autonomous Database storage. The default value is `FALSE`. + +* `is_mtls_connection_required` - (Required) Specifies if the Autonomous Database requires mTLS connections. + +* `license_model` - (Required) The Oracle license model that applies to the Oracle Autonomous Database. Bring your own license (BYOL) allows you to apply your current on-premises Oracle software licenses to equivalent, highly automated Oracle services in the cloud. License Included allows you to subscribe to new Oracle Database software licenses and the Oracle Database service. Note that when provisioning an [Autonomous Database on dedicated Exadata infrastructure](https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html), this attribute must be null. It is already set at the Autonomous Exadata Infrastructure level. When provisioning an [Autonomous Database Serverless] (https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html) database, if a value is not specified, the system defaults the value to `BRING_YOUR_OWN_LICENSE`. Bring your own license (BYOL) also allows you to select the DB edition using the optional parameter. + +* `location` - (Required) The Azure Region where the Autonomous Databases should exist. Changing this forces a new Autonomous Databases to be created. + +* `name` - (Required) The name which should be used for this Autonomous Databases. + +* `ncharacter_set` - (Required) The national character set for the autonomous database. The default is AL16UTF16. Allowed values are: AL16UTF16 or UTF8. + +* `resource_group_name` - (Required) The name of the Resource Group where the Autonomous Databases should exist. + +* `subnet_id` - (Required) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the subnet the resource is associated with. + +* `vnet_id` - (Required) The ID of the vnet associated with the cloud VM cluster. + +--- + +* `customer_contacts` - (Optional) Specifies a list of TODO. + +* `tags` - (Optional) A mapping of tags which should be assigned to the Autonomous Databases. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Autonomous Databases. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 1 hour) Used when creating the Autonomous Databases. +* `read` - (Defaults to 5 minutes) Used when retrieving the Autonomous Databases. +* `update` - (Defaults to 30 minutes) Used when updating the Autonomous Databases. +* `delete` - (Defaults to 30 minutes) Used when deleting the Autonomous Databases. + +## Import + +Autonomous Databases can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_oracledatabase_autonomous_database_regular.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup/providers/Oracle.Database/autonomousDatabases/autonomousDatabases1 +``` \ No newline at end of file From f04dc04e046c47213d533c4547e9f2d9f6e6bbdf Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Thu, 17 Oct 2024 22:28:49 +0100 Subject: [PATCH 08/43] * Initial merge. --- internal/clients/client.go | 2 - ...autonomous_database_regular_data_source.go | 39 +- ...omous_database_regular_data_source_test.go | 15 +- .../autonomous_database_regular_resource.go | 47 +- ...tonomous_database_regular_resource_test.go | 74 ++- internal/services/oracle/registration.go | 2 + .../services/oracledatabase/client/client.go | 28 - .../cloud_vm_cluster_data_source.go | 517 ------------------ .../cloud_vm_cluster_data_source_test.go | 43 -- .../cloud_vm_cluster_helpers.go | 71 --- .../cloud_vm_cluster_resource.go | 429 --------------- .../cloud_vm_cluster_resource_test.go | 271 --------- .../oracledatabase/db_servers_data_source.go | 229 -------- .../db_servers_data_source_test.go | 45 -- .../exadata_infrastructure_data_source.go | 458 ---------------- ...exadata_infrastructure_data_source_test.go | 45 -- .../exadata_infrastructure_helpers.go | 102 ---- .../exadata_infrastructure_resource.go | 337 ------------ .../exadata_infrastructure_resource_test.go | 210 ------- .../services/oracledatabase/registration.go | 42 -- ...autonomous_database_regular.html.markdown} | 8 +- ...cledatabase_cloud_vm_cluster.html.markdown | 177 ------ .../d/oracledatabase_db_servers.html.markdown | 88 --- ...abase_exadata_infrastructure.html.markdown | 152 ----- ...autonomous_database_regular.html.markdown} | 8 +- ...cledatabase_cloud_vm_cluster.html.markdown | 165 ------ ...abase_exadata_infrastructure.html.markdown | 106 ---- 27 files changed, 86 insertions(+), 3624 deletions(-) rename internal/services/{oracledatabase => oracle}/autonomous_database_regular_data_source.go (95%) rename internal/services/{oracledatabase => oracle}/autonomous_database_regular_data_source_test.go (74%) rename internal/services/{oracledatabase => oracle}/autonomous_database_regular_resource.go (88%) rename internal/services/{oracledatabase => oracle}/autonomous_database_regular_resource_test.go (63%) delete mode 100644 internal/services/oracledatabase/client/client.go delete mode 100644 internal/services/oracledatabase/cloud_vm_cluster_data_source.go delete mode 100644 internal/services/oracledatabase/cloud_vm_cluster_data_source_test.go delete mode 100644 internal/services/oracledatabase/cloud_vm_cluster_helpers.go delete mode 100644 internal/services/oracledatabase/cloud_vm_cluster_resource.go delete mode 100644 internal/services/oracledatabase/cloud_vm_cluster_resource_test.go delete mode 100644 internal/services/oracledatabase/db_servers_data_source.go delete mode 100644 internal/services/oracledatabase/db_servers_data_source_test.go delete mode 100644 internal/services/oracledatabase/exadata_infrastructure_data_source.go delete mode 100644 internal/services/oracledatabase/exadata_infrastructure_data_source_test.go delete mode 100644 internal/services/oracledatabase/exadata_infrastructure_helpers.go delete mode 100644 internal/services/oracledatabase/exadata_infrastructure_resource.go delete mode 100644 internal/services/oracledatabase/exadata_infrastructure_resource_test.go delete mode 100644 internal/services/oracledatabase/registration.go rename website/docs/d/{oracledatabase_autonomous_database_regular.html.markdown => oracle_autonomous_database_regular.html.markdown} (97%) delete mode 100644 website/docs/d/oracledatabase_cloud_vm_cluster.html.markdown delete mode 100644 website/docs/d/oracledatabase_db_servers.html.markdown delete mode 100644 website/docs/d/oracledatabase_exadata_infrastructure.html.markdown rename website/docs/r/{oracledatabase_autonomous_database_regular.html.markdown => oracle_autonomous_database_regular.html.markdown} (94%) delete mode 100644 website/docs/r/oracledatabase_cloud_vm_cluster.html.markdown delete mode 100644 website/docs/r/oracledatabase_exadata_infrastructure.html.markdown diff --git a/internal/clients/client.go b/internal/clients/client.go index 5b23c14965b7..a6d41ef7e774 100644 --- a/internal/clients/client.go +++ b/internal/clients/client.go @@ -106,7 +106,6 @@ import ( newrelic "github.com/hashicorp/terraform-provider-azurerm/internal/services/newrelic/client" nginx "github.com/hashicorp/terraform-provider-azurerm/internal/services/nginx/client" notificationhub "github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/client" - oracledatabase "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracledatabase/client" oracle "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracle/client" orbital "github.com/hashicorp/terraform-provider-azurerm/internal/services/orbital/client" paloalto "github.com/hashicorp/terraform-provider-azurerm/internal/services/paloalto/client" @@ -238,7 +237,6 @@ type Client struct { NewRelic *newrelic.Client Nginx *nginx_2024_06_01_preview.Client NotificationHubs *notificationhub.Client - OracleDatabase *oracledatabase.Client Oracle *oracle.Client Orbital *orbital.Client PaloAlto *paloalto.Client diff --git a/internal/services/oracledatabase/autonomous_database_regular_data_source.go b/internal/services/oracle/autonomous_database_regular_data_source.go similarity index 95% rename from internal/services/oracledatabase/autonomous_database_regular_data_source.go rename to internal/services/oracle/autonomous_database_regular_data_source.go index 6099dfac7778..0d404621d8fd 100644 --- a/internal/services/oracledatabase/autonomous_database_regular_data_source.go +++ b/internal/services/oracle/autonomous_database_regular_data_source.go @@ -1,15 +1,16 @@ // Copyright © 2024, Oracle and/or its affiliates. All rights reserved -package oracledatabase +package oracle import ( "context" "fmt" + "time" + "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases" "github.com/hashicorp/terraform-provider-azurerm/utils" - "time" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" @@ -19,15 +20,12 @@ import ( type AutonomousDatabaseRegularDataSource struct{} -type AutonomousDatabaseRegularModel struct { +type AutonomousDatabaseRegularDataSourceModel struct { Location string `tfschema:"location"` Name string `tfschema:"name"` Type string `tfschema:"type"` Tags map[string]interface{} `tfschema:"tags"` - // SystemData - SystemData []SystemDataModel `tfschema:"system_data"` - // AutonomousDatabaseProperties ActualUsedDataStorageSizeInTbs float64 `tfschema:"actual_used_data_storage_size_in_tbs"` AllocatedStorageSizeInTbs float64 `tfschema:"allocated_storage_size_in_tbs"` @@ -377,7 +375,7 @@ func (d AutonomousDatabaseRegularDataSource) ModelObject() interface{} { } func (d AutonomousDatabaseRegularDataSource) ResourceType() string { - return "azurerm_oracledatabase_autonomous_database_regular" + return "azurerm_oracle_autonomous_database" } func (d AutonomousDatabaseRegularDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { @@ -388,7 +386,7 @@ func (d AutonomousDatabaseRegularDataSource) Read() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 5 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases + client := metadata.Client.Oracle.OracleClient.AutonomousDatabases subscriptionId := metadata.Client.Account.SubscriptionId id := autonomousdatabases.NewAutonomousDatabaseID(subscriptionId, @@ -410,15 +408,15 @@ func (d AutonomousDatabaseRegularDataSource) Read() sdk.ResourceFunc { return err } - var output AutonomousDatabaseRegularModel + var output AutonomousDatabaseRegularDataSourceModel prop := model.Properties - output = AutonomousDatabaseRegularModel{} + output = AutonomousDatabaseRegularDataSourceModel{} if prop != nil { switch adbsPropModel := prop.(type) { case autonomousdatabases.AutonomousDatabaseProperties: - output = AutonomousDatabaseRegularModel{ + output = AutonomousDatabaseRegularDataSourceModel{ ActualUsedDataStorageSizeInTbs: pointer.From(adbsPropModel.ActualUsedDataStorageSizeInTbs), AllocatedStorageSizeInTbs: pointer.From(adbsPropModel.AllocatedStorageSizeInTbs), AutonomousDatabaseId: pointer.From(adbsPropModel.AutonomousDatabaseId), @@ -445,7 +443,7 @@ func (d AutonomousDatabaseRegularDataSource) Read() sdk.ResourceFunc { MemoryPerOracleComputeUnitInGbs: pointer.From(adbsPropModel.MemoryPerOracleComputeUnitInGbs), NcharacterSet: pointer.From(adbsPropModel.NcharacterSet), NextLongTermBackupTimeStamp: pointer.From(adbsPropModel.NextLongTermBackupTimeStamp), - OciUrl: pointer.From(adbsPropModel.OciUrl), + OciUrl: pointer.From(adbsPropModel.OciURL), Ocid: pointer.From(adbsPropModel.Ocid), PeerDbId: pointer.From(adbsPropModel.PeerDbId), PeerDbIds: pointer.From(adbsPropModel.PeerDbIds), @@ -453,8 +451,8 @@ func (d AutonomousDatabaseRegularDataSource) Read() sdk.ResourceFunc { PrivateEndpointIP: pointer.From(adbsPropModel.PrivateEndpointIP), PrivateEndpointLabel: pointer.From(adbsPropModel.PrivateEndpointLabel), ProvisionableCPUs: pointer.From(adbsPropModel.ProvisionableCPUs), - ServiceConsoleUrl: pointer.From(adbsPropModel.ServiceConsoleUrl), - SqlWebDeveloperUrl: pointer.From(adbsPropModel.SqlWebDeveloperUrl), + ServiceConsoleUrl: pointer.From(adbsPropModel.ServiceConsoleURL), + SqlWebDeveloperUrl: pointer.From(adbsPropModel.SqlWebDeveloperURL), SubnetId: pointer.From(adbsPropModel.SubnetId), SupportedRegionsToCloneTo: pointer.From(adbsPropModel.SupportedRegionsToCloneTo), TimeCreated: pointer.From(adbsPropModel.TimeCreated), @@ -478,19 +476,6 @@ func (d AutonomousDatabaseRegularDataSource) Read() sdk.ResourceFunc { } } - systemData := model.SystemData - if systemData != nil { - output.SystemData = []SystemDataModel{ - { - CreatedBy: systemData.CreatedBy, - CreatedByType: systemData.CreatedByType, - CreatedAt: systemData.CreatedAt, - LastModifiedBy: systemData.LastModifiedBy, - LastModifiedbyType: systemData.LastModifiedbyType, - LastModifiedAt: systemData.LastModifiedAt, - }, - } - } output.Name = id.AutonomousDatabaseName output.Type = pointer.From(model.Type) output.Tags = utils.FlattenPtrMapStringString(model.Tags) diff --git a/internal/services/oracledatabase/autonomous_database_regular_data_source_test.go b/internal/services/oracle/autonomous_database_regular_data_source_test.go similarity index 74% rename from internal/services/oracledatabase/autonomous_database_regular_data_source_test.go rename to internal/services/oracle/autonomous_database_regular_data_source_test.go index 99b674a3c0fd..0725c113f4d9 100644 --- a/internal/services/oracledatabase/autonomous_database_regular_data_source_test.go +++ b/internal/services/oracle/autonomous_database_regular_data_source_test.go @@ -1,19 +1,20 @@ // Copyright © 2024, Oracle and/or its affiliates. All rights reserved -package oracledatabase_test +package oracle_test import ( "fmt" + "testing" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracledatabase" - "testing" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracle" ) type AutonomousDatabaseRegularDataSource struct{} func TestAdbsRegularDataSource_basic(t *testing.T) { - data := acceptance.BuildTestData(t, oracledatabase.AutonomousDatabaseRegularDataSource{}.ResourceType(), "test") + data := acceptance.BuildTestData(t, oracle.AutonomousDatabaseRegularDataSource{}.ResourceType(), "test") r := AutonomousDatabaseRegularDataSource{} data.DataSourceTest(t, []acceptance.TestStep{ @@ -35,9 +36,9 @@ func (d AutonomousDatabaseRegularDataSource) basic(data acceptance.TestData) str return fmt.Sprintf(` %s -data "azurerm_oracledatabase_autonomous_database_regular" "test" { - name = azurerm_oracledatabase_autonomous_database_regular.test.name - resource_group_name = azurerm_oracledatabase_autonomous_database_regular.test.resource_group_name +data "azurerm_oracle_autonomous_database" "test" { + name = azurerm_oracle_autonomous_database.test.name + resource_group_name = azurerm_oracle_autonomous_database.test.resource_group_name } `, AdbsRegularResource{}.basic(data)) } diff --git a/internal/services/oracledatabase/autonomous_database_regular_resource.go b/internal/services/oracle/autonomous_database_regular_resource.go similarity index 88% rename from internal/services/oracledatabase/autonomous_database_regular_resource.go rename to internal/services/oracle/autonomous_database_regular_resource.go index cbb04f630a7a..2c5dca2ea79f 100644 --- a/internal/services/oracledatabase/autonomous_database_regular_resource.go +++ b/internal/services/oracle/autonomous_database_regular_resource.go @@ -1,15 +1,16 @@ // Copyright © 2024, Oracle and/or its affiliates. All rights reserved -package oracledatabase +package oracle import ( "context" "fmt" + "time" + "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases" "github.com/hashicorp/terraform-provider-azurerm/utils" - "time" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" @@ -17,11 +18,11 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) -var _ sdk.Resource = AdbsRegularResource{} +var _ sdk.Resource = AutonomousDatabaseRegularResource{} -type AdbsRegularResource struct{} +type AutonomousDatabaseRegularResource struct{} -type AdbsRegularResourceModel struct { +type AutonomousDatabaseRegularResourceModel struct { // Azure Location string `tfschema:"location"` Name string `tfschema:"name"` @@ -50,7 +51,7 @@ type AdbsRegularResourceModel struct { CustomerContacts []string `tfschema:"customer_contacts"` } -func (AdbsRegularResource) Arguments() map[string]*pluginsdk.Schema { +func (AutonomousDatabaseRegularResource) Arguments() map[string]*pluginsdk.Schema { return map[string]*pluginsdk.Schema{ // Azure "location": commonschema.Location(), @@ -143,16 +144,16 @@ func (AdbsRegularResource) Arguments() map[string]*pluginsdk.Schema { } } -func (AdbsRegularResource) Attributes() map[string]*pluginsdk.Schema { +func (AutonomousDatabaseRegularResource) Attributes() map[string]*pluginsdk.Schema { return map[string]*pluginsdk.Schema{} } -func (AdbsRegularResource) ModelObject() interface{} { - return &AdbsRegularResource{} +func (AutonomousDatabaseRegularResource) ModelObject() interface{} { + return &AutonomousDatabaseRegularResource{} } -func (AdbsRegularResource) ResourceType() string { - return "azurerm_oracledatabase_autonomous_database_regular" +func (AutonomousDatabaseRegularResource) ResourceType() string { + return "azurerm_oracle_autonomous_database" } func convertAdbsCustomerContactsToSDK(customerContactsList []string) []autonomousdatabases.CustomerContact { @@ -177,14 +178,14 @@ func convertAdbsCustomerContactsToInternalModel(customerContactsList *[]autonomo return customerContacts } -func (r AdbsRegularResource) Create() sdk.ResourceFunc { +func (r AutonomousDatabaseRegularResource) Create() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 60 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases + client := metadata.Client.Oracle.OracleClient.AutonomousDatabases subscriptionId := metadata.Client.Account.SubscriptionId - var model AdbsRegularResourceModel + var model AutonomousDatabaseRegularResourceModel if err := metadata.Decode(&model); err != nil { return err } @@ -236,18 +237,18 @@ func (r AdbsRegularResource) Create() sdk.ResourceFunc { } } -func (r AdbsRegularResource) Update() sdk.ResourceFunc { +func (r AutonomousDatabaseRegularResource) Update() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases + client := metadata.Client.Oracle.OracleClient.AutonomousDatabases id, err := autonomousdatabases.ParseAutonomousDatabaseID(metadata.ResourceData.Id()) if err != nil { return err } - var model AdbsRegularResourceModel + var model AutonomousDatabaseRegularResourceModel if err = metadata.Decode(&model); err != nil { return fmt.Errorf("decoding err: %+v", err) } @@ -276,7 +277,7 @@ func (r AdbsRegularResource) Update() sdk.ResourceFunc { } } -func (AdbsRegularResource) Read() sdk.ResourceFunc { +func (AutonomousDatabaseRegularResource) Read() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 5 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { @@ -285,7 +286,7 @@ func (AdbsRegularResource) Read() sdk.ResourceFunc { return err } - client := metadata.Client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases + client := metadata.Client.Oracle.OracleClient.AutonomousDatabases result, err := client.Get(ctx, *id) if err != nil { if response.WasNotFound(result.HttpResponse) { @@ -300,7 +301,7 @@ func (AdbsRegularResource) Read() sdk.ResourceFunc { prop := result.Model.Properties switch adbsPropModel := prop.(type) { case autonomousdatabases.AutonomousDatabaseProperties: - var output AdbsRegularResourceModel + var output AutonomousDatabaseRegularResourceModel output.AdminPassword = pointer.From(adbsPropModel.AdminPassword) output.BackupRetentionPeriodInDays = pointer.From(adbsPropModel.BackupRetentionPeriodInDays) output.CharacterSet = pointer.From(adbsPropModel.CharacterSet) @@ -330,11 +331,11 @@ func (AdbsRegularResource) Read() sdk.ResourceFunc { } } -func (AdbsRegularResource) Delete() sdk.ResourceFunc { +func (AutonomousDatabaseRegularResource) Delete() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases + client := metadata.Client.Oracle.OracleClient.AutonomousDatabases id, err := autonomousdatabases.ParseAutonomousDatabaseID(metadata.ResourceData.Id()) if err != nil { @@ -350,6 +351,6 @@ func (AdbsRegularResource) Delete() sdk.ResourceFunc { } } -func (AdbsRegularResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { +func (AutonomousDatabaseRegularResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { return autonomousdatabases.ValidateAutonomousDatabaseID } diff --git a/internal/services/oracledatabase/autonomous_database_regular_resource_test.go b/internal/services/oracle/autonomous_database_regular_resource_test.go similarity index 63% rename from internal/services/oracledatabase/autonomous_database_regular_resource_test.go rename to internal/services/oracle/autonomous_database_regular_resource_test.go index 6b2b133744b8..f785b572efe2 100644 --- a/internal/services/oracledatabase/autonomous_database_regular_resource_test.go +++ b/internal/services/oracle/autonomous_database_regular_resource_test.go @@ -1,18 +1,19 @@ // Copyright © 2024, Oracle and/or its affiliates. All rights reserved -package oracledatabase_test +package oracle_test import ( "context" "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracledatabase" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracle" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" - "testing" ) type AdbsRegularResource struct{} @@ -22,26 +23,15 @@ func (a AdbsRegularResource) Exists(ctx context.Context, client *clients.Client, if err != nil { return nil, err } - resp, err := client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases.Get(ctx, *id) + resp, err := client.Oracle.OracleClient.AutonomousDatabases.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("retrieving adbs %s: %+v", id, err) } - return utils.Bool(resp.Model != nil), nil -} - -func (a AdbsRegularResource) Destroy(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := autonomousdatabases.ParseAutonomousDatabaseID(state.ID) - if err != nil { - return nil, err - } - if _, err := client.OracleDatabase.OracleDatabaseClient.AutonomousDatabases.Delete(ctx, *id); err != nil { - return nil, fmt.Errorf("deleting adbs %s: %+v", id, err) - } - return utils.Bool(true), nil + return pointer.To(resp.Model != nil), nil } func TestAdbsRegularResource_basic(t *testing.T) { - data := acceptance.BuildTestData(t, oracledatabase.AdbsRegularResource{}.ResourceType(), "test") + data := acceptance.BuildTestData(t, oracle.AutonomousDatabaseRegularResource{}.ResourceType(), "test") r := AdbsRegularResource{} data.ResourceTest(t, r, []acceptance.TestStep{ { @@ -55,7 +45,7 @@ func TestAdbsRegularResource_basic(t *testing.T) { } func TestAdbsRegularResource_update(t *testing.T) { - data := acceptance.BuildTestData(t, oracledatabase.AdbsRegularResource{}.ResourceType(), "test") + data := acceptance.BuildTestData(t, oracle.AutonomousDatabaseRegularResource{}.ResourceType(), "test") r := AdbsRegularResource{} data.ResourceTest(t, r, []acceptance.TestStep{ { @@ -76,7 +66,7 @@ func TestAdbsRegularResource_update(t *testing.T) { } func TestAdbsRegularResource_requiresImport(t *testing.T) { - data := acceptance.BuildTestData(t, oracledatabase.AdbsRegularResource{}.ResourceType(), "test") + data := acceptance.BuildTestData(t, oracle.AutonomousDatabaseRegularResource{}.ResourceType(), "test") r := AdbsRegularResource{} data.ResourceTest(t, r, []acceptance.TestStep{ { @@ -94,7 +84,7 @@ func (a AdbsRegularResource) basic(data acceptance.TestData) string { %s -resource "azurerm_oracledatabase_autonomous_database_regular" "test" { +resource "azurerm_oracle_autonomous_database" "test" { name = "OFake%[2]d" display_name = "OFake%[2]d" @@ -129,7 +119,7 @@ func (a AdbsRegularResource) update(data acceptance.TestData) string { %s -resource "azurerm_oracledatabase_autonomous_database_regular" "test" { +resource "azurerm_oracle_autonomous_database" "test" { name = "OFake%[2]d" display_name = "OFake%[2]d" resource_group_name = azurerm_resource_group.test.name @@ -165,26 +155,26 @@ func (a AdbsRegularResource) requiresImport(data acceptance.TestData) string { return fmt.Sprintf(` %s -resource "azurerm_oracledatabase_autonomous_database_regular" "import" { - name = azurerm_oracledatabase_autonomous_database_regular.test.name - display_name = azurerm_oracledatabase_autonomous_database_regular.test.display_name - resource_group_name = azurerm_oracledatabase_autonomous_database_regular.test.resource_group_name - location = azurerm_oracledatabase_autonomous_database_regular.test.location - compute_model = azurerm_oracledatabase_autonomous_database_regular.test.compute_model - compute_count = azurerm_oracledatabase_autonomous_database_regular.test.compute_count - license_model = azurerm_oracledatabase_autonomous_database_regular.test.license_model - backup_retention_period_in_days = azurerm_oracledatabase_autonomous_database_regular.test.backup_retention_period_in_days - is_auto_scaling_enabled = azurerm_oracledatabase_autonomous_database_regular.test.is_auto_scaling_enabled - is_auto_scaling_for_storage_enabled = azurerm_oracledatabase_autonomous_database_regular.test.is_auto_scaling_for_storage_enabled - is_mtls_connection_required = azurerm_oracledatabase_autonomous_database_regular.test.is_mtls_connection_required - data_storage_size_in_gbs = azurerm_oracledatabase_autonomous_database_regular.test.data_storage_size_in_gbs - db_workload = azurerm_oracledatabase_autonomous_database_regular.test.db_workload - admin_password = azurerm_oracledatabase_autonomous_database_regular.test.admin_password - db_version = azurerm_oracledatabase_autonomous_database_regular.test.db_version - character_set = azurerm_oracledatabase_autonomous_database_regular.test.character_set - ncharacter_set = azurerm_oracledatabase_autonomous_database_regular.test.ncharacter_set - subnet_id = azurerm_oracledatabase_autonomous_database_regular.test.subnet_id - vnet_id = azurerm_oracledatabase_autonomous_database_regular.test.vnet_id +resource "azurerm_oracle_autonomous_database" "import" { + name = azurerm_oracle_autonomous_database.test.name + display_name = azurerm_oracle_autonomous_database.test.display_name + resource_group_name = azurerm_oracle_autonomous_database.test.resource_group_name + location = azurerm_oracle_autonomous_database.test.location + compute_model = azurerm_oracle_autonomous_database.test.compute_model + compute_count = azurerm_oracle_autonomous_database.test.compute_count + license_model = azurerm_oracle_autonomous_database.test.license_model + backup_retention_period_in_days = azurerm_oracle_autonomous_database.test.backup_retention_period_in_days + is_auto_scaling_enabled = azurerm_oracle_autonomous_database.test.is_auto_scaling_enabled + is_auto_scaling_for_storage_enabled = azurerm_oracle_autonomous_database.test.is_auto_scaling_for_storage_enabled + is_mtls_connection_required = azurerm_oracle_autonomous_database.test.is_mtls_connection_required + data_storage_size_in_gbs = azurerm_oracle_autonomous_database.test.data_storage_size_in_gbs + db_workload = azurerm_oracle_autonomous_database.test.db_workload + admin_password = azurerm_oracle_autonomous_database.test.admin_password + db_version = azurerm_oracle_autonomous_database.test.db_version + character_set = azurerm_oracle_autonomous_database.test.character_set + ncharacter_set = azurerm_oracle_autonomous_database.test.ncharacter_set + subnet_id = azurerm_oracle_autonomous_database.test.subnet_id + vnet_id = azurerm_oracle_autonomous_database.test.vnet_id lifecycle { ignore_changes = [ admin_password diff --git a/internal/services/oracle/registration.go b/internal/services/oracle/registration.go index 4fd63cffb9f4..9fe6c6af8a09 100644 --- a/internal/services/oracle/registration.go +++ b/internal/services/oracle/registration.go @@ -17,6 +17,7 @@ func (r Registration) DataSources() []sdk.DataSource { CloudVmClusterDataSource{}, DBServersDataSource{}, ExadataInfraDataSource{}, + AutonomousDatabaseRegularDataSource{}, } } @@ -24,6 +25,7 @@ func (r Registration) Resources() []sdk.Resource { return []sdk.Resource{ CloudVmClusterResource{}, ExadataInfraResource{}, + AutonomousDatabaseRegularResource{}, } } diff --git a/internal/services/oracledatabase/client/client.go b/internal/services/oracledatabase/client/client.go deleted file mode 100644 index 729c482bc395..000000000000 --- a/internal/services/oracledatabase/client/client.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright © 2024, Oracle and/or its affiliates. All rights reserved - -package client - -import ( - "fmt" - - oracedatabase "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01" - "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/terraform-provider-azurerm/internal/common" -) - -type Client struct { - OracleDatabaseClient *oracedatabase.Client -} - -func NewClient(o *common.ClientOptions) (*Client, error) { - o.DisableCorrelationRequestID = true - oracleDatabaseClient, err := oracedatabase.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) { - o.Configure(c, o.Authorizers.ResourceManager) - }) - if err != nil { - return nil, fmt.Errorf("building Database client: %+v", err) - } - return &Client{ - OracleDatabaseClient: oracleDatabaseClient, - }, nil -} diff --git a/internal/services/oracledatabase/cloud_vm_cluster_data_source.go b/internal/services/oracledatabase/cloud_vm_cluster_data_source.go deleted file mode 100644 index c1c5db93b552..000000000000 --- a/internal/services/oracledatabase/cloud_vm_cluster_data_source.go +++ /dev/null @@ -1,517 +0,0 @@ -// Copyright © 2024, Oracle and/or its affiliates. All rights reserved - -package oracledatabase - -import ( - "context" - "fmt" - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters" - "github.com/hashicorp/terraform-provider-azurerm/utils" - "time" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" -) - -type CloudVmClusterDataSource struct{} - -type CloudVmClusterDataModel struct { - Name string `tfschema:"name"` - Type string `tfschema:"type"` - Tags map[string]interface{} `tfschema:"tags"` - - // SystemData - SystemData []SystemDataModel `tfschema:"system_data"` - - // CloudVMClusterProperties - BackupSubnetCidr string `tfschema:"backup_subnet_cidr"` - CloudExadataInfrastructureId string `tfschema:"cloud_exadata_infrastructure_id"` - ClusterName string `tfschema:"cluster_name"` - CompartmentId string `tfschema:"compartment_id"` - ComputeNodes []string `tfschema:"compute_nodes"` - CpuCoreCount int64 `tfschema:"cpu_core_count"` - DataCollectionOptions []DataCollectionOptionsModel `tfschema:"data_collection_options"` - DataStoragePercentage int64 `tfschema:"data_storage_percentage"` - DataStorageSizeInTbs float64 `tfschema:"data_storage_size_in_tbs"` - DbNodeStorageSizeInGbs int64 `tfschema:"db_node_storage_size_in_gbs"` - DbServers []string `tfschema:"db_servers"` - DiskRedundancy string `tfschema:"disk_redundancy"` - DisplayName string `tfschema:"display_name"` - Domain string `tfschema:"domain"` - GiVersion string `tfschema:"gi_version"` - Hostname string `tfschema:"hostname"` - IormConfigCache []ExadataIormConfigModel `tfschema:"iorm_config_cache"` - IsLocalBackupEnabled bool `tfschema:"is_local_backup_enabled"` - IsSparseDiskgroupEnabled bool `tfschema:"is_sparse_diskgroup_enabled"` - LastUpdateHistoryEntryId string `tfschema:"last_update_history_entry_id"` - LicenseModel string `tfschema:"license_model"` - LifecycleDetails string `tfschema:"lifecycle_details"` - LifecycleState string `tfschema:"lifecycle_state"` - ListenerPort int64 `tfschema:"listener_port"` - MemorySizeInGbs int64 `tfschema:"memory_size_in_gbs"` - NodeCount int64 `tfschema:"node_count"` - NsgUrl string `tfschema:"nsg_url"` - OciUrl string `tfschema:"oci_url"` - Ocid string `tfschema:"ocid"` - OcpuCount float64 `tfschema:"ocpu_count"` - ProvisioningState string `tfschema:"provisioning_state"` - ScanDnsName string `tfschema:"scan_dns_name"` - ScanDnsRecordId string `tfschema:"scan_dns_record_id"` - ScanIPIds []string `tfschema:"scan_ip_ids"` - ScanListenerPortTcp int64 `tfschema:"scan_listener_port_tcp"` - ScanListenerPortTcpSsl int64 `tfschema:"scan_listener_port_tcp_ssl"` - Shape string `tfschema:"shape"` - SshPublicKeys []string `tfschema:"ssh_public_keys"` - StorageSizeInGbs int64 `tfschema:"storage_size_in_gbs"` - SubnetId string `tfschema:"subnet_id"` - SubnetOcid string `tfschema:"subnet_ocid"` - SystemVersion string `tfschema:"system_version"` - TimeCreated string `tfschema:"time_created"` - TimeZone string `tfschema:"time_zone"` - VipIds []string `tfschema:"vip_ods"` - VnetId string `tfschema:"vnet_id"` - ZoneId string `tfschema:"zone_id"` -} - -type DataCollectionOptionsModel struct { - IsDiagnosticsEventsEnabled bool `tfschema:"is_diagnostics_events_enabled"` - IsHealthMonitoringEnabled bool `tfschema:"is_health_monitoring_enabled"` - IsIncidentLogsEnabled bool `tfschema:"is_incident_logs_enabled"` -} - -type ExadataIormConfigModel struct { - DbPlans []DbIormConfigModel `tfschema:"db_plans"` - LifecycleDetails string `tfschema:"lifecycle_details"` - LifecycleState string `tfschema:"lifecycle_state"` - Objective string `tfschema:"objective"` -} - -type DbIormConfigModel struct { - DbName string `tfschema:"db_name"` - FlashCacheLimit string `tfschema:"flash_cache_limit"` - Share int64 `tfschema:"share"` -} - -func (d CloudVmClusterDataSource) Arguments() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{ - "resource_group_name": commonschema.ResourceGroupNameForDataSource(), - "name": { - Type: pluginsdk.TypeString, - Required: true, - }, - } -} - -func (d CloudVmClusterDataSource) Attributes() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{ - "location": commonschema.LocationComputed(), - "type": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "tags": commonschema.TagsDataSource(), - - // SystemData - "system_data": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "created_by": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "created_by_type": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "created_at": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "last_modified_by": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "last_modified_by_type": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "last_modified_at": { - Type: pluginsdk.TypeString, - Computed: true, - }, - }, - }, - }, - - // CloudVMClusterProperties - "backup_subnet_cidr": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "cloud_exadata_infrastructure_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "cluster_name": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "compartment_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "compute_nodes": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - "cpu_core_count": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "data_collection_options": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "is_diagnostics_events_enabled": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - "is_health_monitoring_enabled": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - "is_incident_logs_enabled": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - }, - }, - }, - "data_storage_percentage": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "data_storage_size_in_tbs": { - Type: pluginsdk.TypeFloat, - Computed: true, - }, - "db_node_storage_size_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "db_servers": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - "disk_redundancy": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "display_name": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "domain": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "gi_version": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "hostname": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "iorm_config_cache": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "db_plans": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "db_name": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "flash_cache_limit": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "share": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - }, - }, - }, - "lifecycle_details": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "lifecycle_state": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "objective": { - Type: pluginsdk.TypeString, - Computed: true, - }, - }, - }, - }, - - "is_local_backup_enabled": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - "is_sparse_diskgroup_enabled": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - "last_update_history_entry_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "license_model": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "lifecycle_details": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "lifecycle_state": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "listener_port": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "memory_size_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "node_count": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "nsg_url": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "oci_url": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "ocid": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "ocpu_count": { - Type: pluginsdk.TypeFloat, - Computed: true, - }, - "provisioning_state": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "scan_dns_name": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "scan_dns_record_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "scan_ip_ids": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - "scan_listener_port_tcp": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "scan_listener_port_tcp_ssl": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "shape": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "ssh_public_keys": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - "storage_size_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "subnet_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "subnet_ocid": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "system_version": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "time_created": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "time_zone": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "vip_ods": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - "vnet_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "zone_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - } -} - -func (d CloudVmClusterDataSource) ModelObject() interface{} { - return nil -} - -func (d CloudVmClusterDataSource) ResourceType() string { - return "azurerm_oracledatabase_cloud_vm_cluster" -} - -func (d CloudVmClusterDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { - return cloudvmclusters.ValidateCloudVMClusterID -} - -func (d CloudVmClusterDataSource) Read() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 5 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudVMClusters - subscriptionId := metadata.Client.Account.SubscriptionId - - id := cloudvmclusters.NewCloudVMClusterID(subscriptionId, - metadata.ResourceData.Get("resource_group_name").(string), - metadata.ResourceData.Get("name").(string)) - - resp, err := client.Get(ctx, id) - if err != nil { - if response.WasNotFound(resp.HttpResponse) { - return fmt.Errorf("%s was not found", id) - } - return fmt.Errorf("retrieving %s: %+v", id, err) - } - - if model := resp.Model; model != nil { - err := metadata.ResourceData.Set("location", location.NormalizeNilable(&model.Location)) - if err != nil { - return err - } - - var output CloudVmClusterDataModel - prop := model.Properties - if prop != nil { - output = CloudVmClusterDataModel{ - BackupSubnetCidr: pointer.From(prop.BackupSubnetCidr), - CloudExadataInfrastructureId: prop.CloudExadataInfrastructureId, - ClusterName: pointer.From(prop.ClusterName), - CompartmentId: pointer.From(prop.CompartmentId), - ComputeNodes: pointer.From(prop.ComputeNodes), - CpuCoreCount: prop.CpuCoreCount, - DataStoragePercentage: pointer.From(prop.DataStoragePercentage), - DataStorageSizeInTbs: pointer.From(prop.DataStorageSizeInTbs), - DbNodeStorageSizeInGbs: pointer.From(prop.DbNodeStorageSizeInGbs), - DbServers: pointer.From(prop.DbServers), - DiskRedundancy: string(pointer.From(prop.DiskRedundancy)), - DisplayName: prop.DisplayName, - Domain: pointer.From(prop.Domain), - GiVersion: prop.GiVersion, - Hostname: prop.Hostname, - IormConfigCache: ConvertExadataIormConfigToInternal(prop.IormConfigCache), - IsLocalBackupEnabled: pointer.From(prop.IsLocalBackupEnabled), - IsSparseDiskgroupEnabled: pointer.From(prop.IsSparseDiskgroupEnabled), - LastUpdateHistoryEntryId: pointer.From(prop.LastUpdateHistoryEntryId), - LicenseModel: string(pointer.From(prop.LicenseModel)), - LifecycleDetails: pointer.From(prop.LifecycleDetails), - LifecycleState: string(*prop.LifecycleState), - ListenerPort: pointer.From(prop.ListenerPort), - MemorySizeInGbs: pointer.From(prop.MemorySizeInGbs), - NodeCount: pointer.From(prop.NodeCount), - NsgUrl: pointer.From(prop.NsgUrl), - OciUrl: pointer.From(prop.OciUrl), - Ocid: pointer.From(prop.Ocid), - ProvisioningState: string(pointer.From(prop.ProvisioningState)), - Shape: pointer.From(prop.Shape), - StorageSizeInGbs: pointer.From(prop.StorageSizeInGbs), - SubnetId: prop.SubnetId, - SubnetOcid: pointer.From(prop.SubnetOcid), - SystemVersion: pointer.From(prop.SystemVersion), - TimeCreated: pointer.From(prop.TimeCreated), - TimeZone: pointer.From(prop.TimeZone), - ZoneId: pointer.From(prop.ZoneId), - } - } - - systemData := model.SystemData - if systemData != nil { - output.SystemData = []SystemDataModel{ - { - CreatedBy: systemData.CreatedBy, - CreatedByType: systemData.CreatedByType, - CreatedAt: systemData.CreatedAt, - LastModifiedBy: systemData.LastModifiedBy, - LastModifiedbyType: systemData.LastModifiedbyType, - LastModifiedAt: systemData.LastModifiedAt, - }, - } - } - output.Name = id.CloudVmClusterName - output.Type = pointer.From(model.Type) - output.Tags = utils.FlattenPtrMapStringString(model.Tags) - - metadata.SetID(id) - return metadata.Encode(&output) - } - return nil - }, - } -} diff --git a/internal/services/oracledatabase/cloud_vm_cluster_data_source_test.go b/internal/services/oracledatabase/cloud_vm_cluster_data_source_test.go deleted file mode 100644 index 8cca65a3a706..000000000000 --- a/internal/services/oracledatabase/cloud_vm_cluster_data_source_test.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright © 2024, Oracle and/or its affiliates. All rights reserved - -package oracledatabase_test - -import ( - "fmt" - "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" - "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracledatabase" - "testing" -) - -type CloudVmClusterDataSource struct{} - -func TestCloudVmClusterDataSource_basic(t *testing.T) { - data := acceptance.BuildTestData(t, oracledatabase.CloudVmClusterDataSource{}.ResourceType(), "test") - r := CloudVmClusterDataSource{} - - data.DataSourceTest(t, []acceptance.TestStep{ - { - Config: r.basic(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).Key("location").Exists(), - check.That(data.ResourceName).Key("name").Exists(), - check.That(data.ResourceName).Key("resource_group_name").Exists(), - check.That(data.ResourceName).Key("cloud_exadata_infrastructure_id").Exists(), - check.That(data.ResourceName).Key("display_name").Exists(), - check.That(data.ResourceName).Key("cpu_core_count").Exists(), - ), - }, - }) -} - -func (d CloudVmClusterDataSource) basic(data acceptance.TestData) string { - return fmt.Sprintf(` -%s - -data "azurerm_oracledatabase_cloud_vm_cluster" "test" { - name = azurerm_oracledatabase_cloud_vm_cluster.test.name - resource_group_name = azurerm_oracledatabase_cloud_vm_cluster.test.resource_group_name -} -`, CloudVmClusterResource{}.basic(data)) -} diff --git a/internal/services/oracledatabase/cloud_vm_cluster_helpers.go b/internal/services/oracledatabase/cloud_vm_cluster_helpers.go deleted file mode 100644 index ad63c8087135..000000000000 --- a/internal/services/oracledatabase/cloud_vm_cluster_helpers.go +++ /dev/null @@ -1,71 +0,0 @@ -package oracledatabase - -import ( - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "strings" -) - -func ConvertDataCollectionOptionsToInternal(dataCollectionOptions *cloudvmclusters.DataCollectionOptions) []DataCollectionOptionsModel { - if dataCollectionOptions != nil { - return []DataCollectionOptionsModel{ - { - IsDiagnosticsEventsEnabled: pointer.From(dataCollectionOptions.IsDiagnosticsEventsEnabled), - IsHealthMonitoringEnabled: pointer.From(dataCollectionOptions.IsHealthMonitoringEnabled), - IsIncidentLogsEnabled: pointer.From(dataCollectionOptions.IsIncidentLogsEnabled), - }, - } - } - return nil -} - -func ConvertExadataIormConfigToInternal(exadataIormConfig *cloudvmclusters.ExadataIormConfig) []ExadataIormConfigModel { - if exadataIormConfig != nil { - var dbIormConfigModel []DbIormConfigModel - if exadataIormConfig.DbPlans != nil { - dbPlans := *exadataIormConfig.DbPlans - for _, dbPlan := range dbPlans { - dbIormConfigModel = append(dbIormConfigModel, DbIormConfigModel{ - DbName: pointer.From(dbPlan.DbName), - FlashCacheLimit: pointer.From(dbPlan.FlashCacheLimit), - Share: pointer.From(dbPlan.Share), - }) - } - } - return []ExadataIormConfigModel{ - { - DbPlans: dbIormConfigModel, - LifecycleDetails: pointer.From(exadataIormConfig.LifecycleDetails), - LifecycleState: string(pointer.From(exadataIormConfig.LifecycleState)), - Objective: string(pointer.From(exadataIormConfig.Objective)), - }, - } - } - return nil -} - -func GiVersionDiffSuppress(key string, old string, new string, d *schema.ResourceData) bool { - if old == "" || new == "" { - return false - } - oldVersion := strings.Split(old, ".") - newVersion := strings.Split(new, ".") - - if oldVersion[0] == newVersion[0] { - return true - } - return false -} - -func DbSystemHostnameDiffSuppress(key string, old string, new string, d *schema.ResourceData) bool { - return EqualIgnoreCaseSuppressDiff(key, old, new, d) || NewIsPrefixOfOldDiffSuppress(key, old, new, d) -} - -func NewIsPrefixOfOldDiffSuppress(key string, old string, new string, d *schema.ResourceData) bool { - return strings.HasPrefix(strings.ToLower(old), strings.ToLower(new)) -} - -func EqualIgnoreCaseSuppressDiff(key string, old string, new string, d *schema.ResourceData) bool { - return strings.EqualFold(old, new) -} diff --git a/internal/services/oracledatabase/cloud_vm_cluster_resource.go b/internal/services/oracledatabase/cloud_vm_cluster_resource.go deleted file mode 100644 index ffb4354237e0..000000000000 --- a/internal/services/oracledatabase/cloud_vm_cluster_resource.go +++ /dev/null @@ -1,429 +0,0 @@ -// Copyright © 2024, Oracle and/or its affiliates. All rights reserved - -package oracledatabase - -import ( - "context" - "fmt" - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-provider-azurerm/utils" - "time" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" -) - -var _ sdk.Resource = CloudVmClusterResource{} - -type CloudVmClusterResource struct{} - -type CloudVmClusterResourceModel struct { - // Azure - Location string `tfschema:"location"` - Name string `tfschema:"name"` - ResourceGroupName string `tfschema:"resource_group_name"` - Tags map[string]interface{} `tfschema:"tags"` - - // Required - CloudExadataInfrastructureId string `tfschema:"cloud_exadata_infrastructure_id"` - CpuCoreCount int64 `tfschema:"cpu_core_count"` - DataStorageSizeInTbs float64 `tfschema:"data_storage_size_in_tbs"` - DbNodeStorageSizeInGbs int64 `tfschema:"db_node_storage_size_in_gbs"` - DbServers []string `tfschema:"db_servers"` - DisplayName string `tfschema:"display_name"` - GiVersion string `tfschema:"gi_version"` - Hostname string `tfschema:"hostname"` - LicenseModel string `tfschema:"license_model"` - MemorySizeInGbs int64 `tfschema:"memory_size_in_gbs"` - SshPublicKeys []string `tfschema:"ssh_public_keys"` - SubnetId string `tfschema:"subnet_id"` - VnetId string `tfschema:"vnet_id"` - - // Optional - BackupSubnetCidr string `tfschema:"backup_subnet_cidr"` - ClusterName string `tfschema:"cluster_name"` - DataCollectionOptions []DataCollectionOptionsModel `tfschema:"data_collection_options"` - DataStoragePercentage int64 `tfschema:"data_storage_percentage"` - IsLocalBackupEnabled bool `tfschema:"is_local_backup_enabled"` - IsSparseDiskgroupEnabled bool `tfschema:"is_sparse_diskgroup_enabled"` - TimeZone string `tfschema:"time_zone"` -} - -func (CloudVmClusterResource) Arguments() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{ - // Azure - "location": commonschema.Location(), - "name": { - Type: pluginsdk.TypeString, - Required: true, - }, - "resource_group_name": { - Type: pluginsdk.TypeString, - Required: true, - }, - "tags": commonschema.Tags(), - - // Required - "cloud_exadata_infrastructure_id": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - }, - "cpu_core_count": { - Type: pluginsdk.TypeInt, - Required: true, - }, - "data_storage_size_in_tbs": { - Type: pluginsdk.TypeFloat, - Optional: true, - Computed: true, - ForceNew: true, - }, - "db_node_storage_size_in_gbs": { - Type: pluginsdk.TypeInt, - Optional: true, - Computed: true, - }, - "db_servers": { - Type: pluginsdk.TypeList, - Required: true, - ForceNew: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - "display_name": { - Type: pluginsdk.TypeString, - Required: true, - }, - "gi_version": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - DiffSuppressFunc: GiVersionDiffSuppress, - }, - "hostname": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - DiffSuppressFunc: DbSystemHostnameDiffSuppress, - }, - "license_model": { - Type: pluginsdk.TypeString, - Required: true, - }, - "memory_size_in_gbs": { - Type: pluginsdk.TypeInt, - Optional: true, - Computed: true, - }, - "ssh_public_keys": { - Type: pluginsdk.TypeList, - Required: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - "subnet_id": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - }, - "vnet_id": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - }, - - // Optional - "backup_subnet_cidr": { - Type: pluginsdk.TypeString, - Optional: true, - }, - "cluster_name": { - Type: pluginsdk.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - }, - "data_collection_options": { - Type: pluginsdk.TypeList, - Optional: true, - Computed: true, - MaxItems: 1, - MinItems: 1, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "is_diagnostics_events_enabled": { - Type: pluginsdk.TypeBool, - Optional: true, - Computed: true, - }, - "is_health_monitoring_enabled": { - Type: pluginsdk.TypeBool, - Optional: true, - Computed: true, - }, - "is_incident_logs_enabled": { - Type: pluginsdk.TypeBool, - Optional: true, - Computed: true, - }, - }, - }, - }, - "data_storage_percentage": { - Type: schema.TypeInt, - Optional: true, - Computed: true, - ForceNew: true, - }, - "is_local_backup_enabled": { - Type: pluginsdk.TypeBool, - Optional: true, - Computed: true, - ForceNew: true, - }, - "is_sparse_diskgroup_enabled": { - Type: pluginsdk.TypeBool, - Optional: true, - Computed: true, - ForceNew: true, - }, - "time_zone": { - Type: pluginsdk.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - }, - } -} - -func (CloudVmClusterResource) Attributes() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{} -} - -func (CloudVmClusterResource) ModelObject() interface{} { - return &ExadataInfraResource{} -} - -func (CloudVmClusterResource) ResourceType() string { - return "azurerm_oracledatabase_cloud_vm_cluster" -} - -func (r CloudVmClusterResource) Create() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 30 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudVMClusters - subscriptionId := metadata.Client.Account.SubscriptionId - - var model CloudVmClusterResourceModel - if err := metadata.Decode(&model); err != nil { - return err - } - - id := cloudvmclusters.NewCloudVMClusterID(subscriptionId, - model.ResourceGroupName, - model.Name) - - existing, err := client.Get(ctx, id) - if err != nil && !response.WasNotFound(existing.HttpResponse) { - return fmt.Errorf("checking for presence of existing %s: %+v", id, err) - } - if !response.WasNotFound(existing.HttpResponse) { - return metadata.ResourceRequiresImport(r.ResourceType(), id) - } - - param := cloudvmclusters.CloudVMCluster{ - // Azure - Name: pointer.To(model.Name), - Location: model.Location, - Tags: tags.Expand(model.Tags), - Properties: &cloudvmclusters.CloudVMClusterProperties{ - // Required - CloudExadataInfrastructureId: model.CloudExadataInfrastructureId, - CpuCoreCount: model.CpuCoreCount, - DbServers: pointer.To(model.DbServers), - DisplayName: model.DisplayName, - GiVersion: model.GiVersion, - Hostname: model.Hostname, - LicenseModel: pointer.To(cloudvmclusters.LicenseModel(model.LicenseModel)), - SshPublicKeys: model.SshPublicKeys, - SubnetId: model.SubnetId, - VnetId: model.VnetId, - }, - } - - if model.BackupSubnetCidr != "" { - param.Properties.BackupSubnetCidr = pointer.To(model.BackupSubnetCidr) - } - if model.ClusterName != "" { - param.Properties.ClusterName = pointer.To(model.ClusterName) - } - if model.DataCollectionOptions != nil && len(model.DataCollectionOptions) > 0 { - param.Properties.DataCollectionOptions = &cloudvmclusters.DataCollectionOptions{ - IsDiagnosticsEventsEnabled: pointer.To(model.DataCollectionOptions[0].IsDiagnosticsEventsEnabled), - IsHealthMonitoringEnabled: pointer.To(model.DataCollectionOptions[0].IsHealthMonitoringEnabled), - IsIncidentLogsEnabled: pointer.To(model.DataCollectionOptions[0].IsIncidentLogsEnabled), - } - } - if model.TimeZone != "" { - param.Properties.ClusterName = pointer.To(model.TimeZone) - } - if model.DataStoragePercentage != 0 { - param.Properties.DataStoragePercentage = pointer.To(model.DataStoragePercentage) - } - if model.DataStorageSizeInTbs != 0 { - param.Properties.DataStorageSizeInTbs = pointer.To(model.DataStorageSizeInTbs) - } - if model.DbNodeStorageSizeInGbs != 0 { - param.Properties.DbNodeStorageSizeInGbs = pointer.To(model.DbNodeStorageSizeInGbs) - } - param.Properties.IsLocalBackupEnabled = pointer.To(model.IsLocalBackupEnabled) - param.Properties.IsSparseDiskgroupEnabled = pointer.To(model.IsSparseDiskgroupEnabled) - if model.MemorySizeInGbs != 0 { - param.Properties.MemorySizeInGbs = pointer.To(model.MemorySizeInGbs) - } - - if err := client.CreateOrUpdateThenPoll(ctx, id, param); err != nil { - return fmt.Errorf("creating %s: %+v", id, err) - } - - metadata.SetID(id) - return nil - }, - } -} - -func (r CloudVmClusterResource) Update() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 30 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - - client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudVMClusters - id, err := cloudvmclusters.ParseCloudVMClusterID(metadata.ResourceData.Id()) - if err != nil { - return err - } - - var model CloudVmClusterResourceModel - if err = metadata.Decode(&model); err != nil { - return fmt.Errorf("decoding err: %+v", err) - } - - existing, err := client.Get(ctx, *id) - if err != nil { - return fmt.Errorf("retrieving exists when updating: +%v", *id) - } - if existing.Model == nil && existing.Model.Properties == nil { - return fmt.Errorf("retrieving as nil when updating for %v", *id) - } - - if metadata.ResourceData.HasChange("tags") { - update := &cloudvmclusters.CloudVMClusterUpdate{ - Tags: tags.Expand(model.Tags), - } - err = client.UpdateThenPoll(ctx, *id, *update) - if err != nil { - return fmt.Errorf("updating %s: %v", id, err) - } - } else if metadata.ResourceData.HasChangesExcept("tags") { - return fmt.Errorf("only `tags` currently support updates") - } - return nil - }, - } -} - -func (CloudVmClusterResource) Read() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 5 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - id, err := cloudvmclusters.ParseCloudVMClusterID(metadata.ResourceData.Id()) - if err != nil { - return err - } - - client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudVMClusters - result, err := client.Get(ctx, *id) - if err != nil { - if response.WasNotFound(result.HttpResponse) { - return metadata.MarkAsGone(id) - } - return err - } - - if result.Model == nil { - return fmt.Errorf("retrieving %s got nil model", id) - } - var output CloudVmClusterResourceModel - - // Azure - output.Name = pointer.ToString(result.Model.Name) - output.Location = result.Model.Location - output.Tags = utils.FlattenPtrMapStringString(result.Model.Tags) - output.ResourceGroupName = id.ResourceGroupName - // Required - output.CloudExadataInfrastructureId = result.Model.Properties.CloudExadataInfrastructureId - output.CpuCoreCount = result.Model.Properties.CpuCoreCount - output.DataStorageSizeInTbs = pointer.From(result.Model.Properties.DataStorageSizeInTbs) - output.DbNodeStorageSizeInGbs = pointer.From(result.Model.Properties.DbNodeStorageSizeInGbs) - output.DbServers = pointer.From(result.Model.Properties.DbServers) - output.DisplayName = result.Model.Properties.DisplayName - output.GiVersion = result.Model.Properties.GiVersion - output.Hostname = result.Model.Properties.Hostname - output.LicenseModel = string(pointer.From(result.Model.Properties.LicenseModel)) - output.MemorySizeInGbs = pointer.From(result.Model.Properties.MemorySizeInGbs) - //output.SshPublicKeys = result.Model.Properties.SshPublicKeys - tmp := make([]string, 0) - for _, key := range result.Model.Properties.SshPublicKeys { - if key != "" { - tmp = append(tmp, key) - } - } - output.SshPublicKeys = tmp - output.SubnetId = result.Model.Properties.SubnetId - output.VnetId = result.Model.Properties.VnetId - // Optional - output.BackupSubnetCidr = pointer.From(result.Model.Properties.BackupSubnetCidr) - output.ClusterName = pointer.From(result.Model.Properties.ClusterName) - output.DataCollectionOptions = ConvertDataCollectionOptionsToInternal(result.Model.Properties.DataCollectionOptions) - output.DataStoragePercentage = pointer.From(result.Model.Properties.DataStoragePercentage) - output.IsLocalBackupEnabled = pointer.From(result.Model.Properties.IsLocalBackupEnabled) - output.IsSparseDiskgroupEnabled = pointer.From(result.Model.Properties.IsSparseDiskgroupEnabled) - output.TimeZone = pointer.From(result.Model.Properties.TimeZone) - - return metadata.Encode(&output) - }, - } -} - -func (CloudVmClusterResource) Delete() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 30 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudVMClusters - - id, err := cloudvmclusters.ParseCloudVMClusterID(metadata.ResourceData.Id()) - if err != nil { - return err - } - - if err = client.DeleteThenPoll(ctx, *id); err != nil { - return fmt.Errorf("deleting %s: %+v", *id, err) - } - - return nil - }, - } -} - -func (CloudVmClusterResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { - return cloudvmclusters.ValidateCloudVMClusterID -} diff --git a/internal/services/oracledatabase/cloud_vm_cluster_resource_test.go b/internal/services/oracledatabase/cloud_vm_cluster_resource_test.go deleted file mode 100644 index d40a9a09698a..000000000000 --- a/internal/services/oracledatabase/cloud_vm_cluster_resource_test.go +++ /dev/null @@ -1,271 +0,0 @@ -// Copyright © 2024, Oracle and/or its affiliates. All rights reserved - -package oracledatabase_test - -import ( - "context" - "fmt" - "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters" - "testing" - - "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" - "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" - "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracledatabase" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" -) - -type CloudVmClusterResource struct{} - -func (a CloudVmClusterResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := cloudvmclusters.ParseCloudVMClusterID(state.ID) - if err != nil { - return nil, err - } - resp, err := client.OracleDatabase.OracleDatabaseClient.CloudVMClusters.Get(ctx, *id) - if err != nil { - return nil, fmt.Errorf("retrieving cloud vm cluster %s: %+v", id, err) - } - return utils.Bool(resp.Model != nil), nil -} - -func (a CloudVmClusterResource) Destroy(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := cloudvmclusters.ParseCloudVMClusterID(state.ID) - if err != nil { - return nil, err - } - if _, err := client.OracleDatabase.OracleDatabaseClient.CloudVMClusters.Delete(ctx, *id); err != nil { - return nil, fmt.Errorf("deleting vm cluster %s: %+v", id, err) - } - return utils.Bool(true), nil -} - -func TestCloudVmClusterResource_basic(t *testing.T) { - data := acceptance.BuildTestData(t, oracledatabase.CloudVmClusterResource{}.ResourceType(), "test") - r := CloudVmClusterResource{} - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.basic(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep(), - }) -} - -func TestCloudVmClusterResource_allFields(t *testing.T) { - data := acceptance.BuildTestData(t, oracledatabase.CloudVmClusterResource{}.ResourceType(), "test") - r := CloudVmClusterResource{} - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.allFields(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep(), - }) -} - -func TestCloudVmClusterResource_requiresImport(t *testing.T) { - data := acceptance.BuildTestData(t, oracledatabase.CloudVmClusterResource{}.ResourceType(), "test") - r := CloudVmClusterResource{} - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.basic(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.RequiresImportErrorStep(r.requiresImport), - }) -} - -func TestCloudVmClusterResource_update(t *testing.T) { - data := acceptance.BuildTestData(t, oracledatabase.CloudVmClusterResource{}.ResourceType(), "test") - r := CloudVmClusterResource{} - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.basic(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep(), - { - Config: r.update(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep(), - }) -} - -func (a CloudVmClusterResource) basic(data acceptance.TestData) string { - return fmt.Sprintf(` - %s -resource "azurerm_oracledatabase_cloud_vm_cluster" "test" { - location = "%[3]s" - name = "OFakeVmacctest%[2]d" - resource_group_name = azurerm_resource_group.test.name - cloud_exadata_infrastructure_id = azurerm_oracledatabase_exadata_infrastructure.test.id - cpu_core_count = 4 - data_storage_size_in_tbs = 2 - db_node_storage_size_in_gbs = 120 - db_servers = [for obj in data.azurerm_oracledatabase_db_servers.test.db_servers : obj.ocid] - display_name = "OFakeVmacctest%[2]d" - gi_version = "23.0.0.0" - license_model = "BringYourOwnLicense" - memory_size_in_gbs = 60 - hostname = "hostname" - ssh_public_keys = ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN you@me.com"] - subnet_id = azurerm_subnet.virtual_network_subnet.id - vnet_id = azurerm_virtual_network.virtual_network.id -}`, a.template(data), data.RandomInteger, data.Locations.Primary) -} - -func (a CloudVmClusterResource) allFields(data acceptance.TestData) string { - return fmt.Sprintf(` - %s -resource "azurerm_oracledatabase_cloud_vm_cluster" "test" { - location = "%[3]s" - name = "OFakeVmacctest%[2]d" - resource_group_name = azurerm_resource_group.test.name - cloud_exadata_infrastructure_id = azurerm_oracledatabase_exadata_infrastructure.test.id - cpu_core_count = 4 - data_collection_options { - is_diagnostics_events_enabled = true - is_health_monitoring_enabled = true - is_incident_logs_enabled = true - } - data_storage_size_in_tbs = 2 - db_node_storage_size_in_gbs = 120 - db_servers = [for obj in data.azurerm_oracledatabase_db_servers.test.db_servers : obj.ocid] - display_name = "OFakeVmacctest%[2]d" - gi_version = "23.0.0.0" - is_local_backup_enabled = true - is_sparse_diskgroup_enabled = true - license_model = "BringYourOwnLicense" - memory_size_in_gbs = 60 - hostname = "hostname" - ssh_public_keys = ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN you@me.com"] - subnet_id = azurerm_subnet.virtual_network_subnet.id - tags = { - test = "testTag1" - } - time_zone = "UTC" - vnet_id = azurerm_virtual_network.virtual_network.id -}`, a.template(data), data.RandomInteger, data.Locations.Primary) -} - -func (a CloudVmClusterResource) update(data acceptance.TestData) string { - return fmt.Sprintf(` -%s -resource "azurerm_oracledatabase_cloud_vm_cluster" "test" { - location = "%[3]s" - name = "OFakeVmacctest%[2]d" - resource_group_name = azurerm_resource_group.test.name - cloud_exadata_infrastructure_id = azurerm_oracledatabase_exadata_infrastructure.test.id - cpu_core_count = 4 - data_storage_size_in_tbs = 2 - db_node_storage_size_in_gbs = 120 - db_servers = [for obj in data.azurerm_oracledatabase_db_servers.test.db_servers : obj.ocid] - display_name = "OFakeVmacctest%[2]d" - gi_version = "23.0.0.0" - license_model = "BringYourOwnLicense" - memory_size_in_gbs = 60 - hostname = "hostname" - ssh_public_keys = ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN you@me.com"] - subnet_id = azurerm_subnet.virtual_network_subnet.id - tags = { - test = "testTag1" - } - vnet_id = azurerm_virtual_network.virtual_network.id -}`, a.template(data), data.RandomInteger, data.Locations.Primary) -} - -func (a CloudVmClusterResource) requiresImport(data acceptance.TestData) string { - return fmt.Sprintf(` -%s - -resource "azurerm_oracledatabase_cloud_vm_cluster" "import" { - location = azurerm_oracledatabase_cloud_vm_cluster.test.location - name = azurerm_oracledatabase_cloud_vm_cluster.test.name - resource_group_name = azurerm_oracledatabase_cloud_vm_cluster.test.resource_group_name - cloud_exadata_infrastructure_id = azurerm_oracledatabase_cloud_vm_cluster.test.cloud_exadata_infrastructure_id - cpu_core_count = azurerm_oracledatabase_cloud_vm_cluster.test.cpu_core_count - data_storage_size_in_tbs = azurerm_oracledatabase_cloud_vm_cluster.test.data_storage_size_in_tbs - db_node_storage_size_in_gbs = azurerm_oracledatabase_cloud_vm_cluster.test.db_node_storage_size_in_gbs - db_servers = azurerm_oracledatabase_cloud_vm_cluster.test.db_servers - display_name = azurerm_oracledatabase_cloud_vm_cluster.test.display_name - gi_version = azurerm_oracledatabase_cloud_vm_cluster.test.gi_version - license_model = azurerm_oracledatabase_cloud_vm_cluster.test.license_model - memory_size_in_gbs = azurerm_oracledatabase_cloud_vm_cluster.test.memory_size_in_gbs - hostname = azurerm_oracledatabase_cloud_vm_cluster.test.hostname - ssh_public_keys = azurerm_oracledatabase_cloud_vm_cluster.test.ssh_public_keys - subnet_id = azurerm_oracledatabase_cloud_vm_cluster.test.subnet_id - vnet_id = azurerm_oracledatabase_cloud_vm_cluster.test.vnet_id -} -`, a.basic(data)) -} - -func (a CloudVmClusterResource) template(data acceptance.TestData) string { - return fmt.Sprintf(` -provider "azurerm" { - features {} -} - -data "azurerm_client_config" "current" {} - -resource "azurerm_resource_group" "test" { - name = "acctestRG-%[1]d" - location = "%[2]s" -} - -resource "azurerm_virtual_network" "virtual_network" { - name = "OFakeacctest%[1]d_vnet" - address_space = ["10.0.0.0/16"] - location = "%[2]s" - resource_group_name = azurerm_resource_group.test.name -} - -resource "azurerm_subnet" "virtual_network_subnet" { - name = "OFakeacctest%[1]d" - resource_group_name = azurerm_resource_group.test.name - virtual_network_name = azurerm_virtual_network.virtual_network.name - address_prefixes = ["10.0.1.0/24"] - - delegation { - name = "delegation" - - service_delegation { - actions = [ - "Microsoft.Network/networkinterfaces/*", - "Microsoft.Network/virtualNetworks/subnets/join/action", - ] - name = "Oracle.Database/networkAttachments" - } - } -} - -resource "azurerm_oracledatabase_exadata_infrastructure" "test" { - name = "OFakeacctest%[1]d" - location = "%[2]s" - resource_group_name = azurerm_resource_group.test.name - compute_count = "2" - display_name = "OFakeacctest%[1]d" - shape = "Exadata.X9M" - storage_count = "3" - zones = ["3"] -} - -data "azurerm_oracledatabase_db_servers" "test" { - resource_group_name = azurerm_resource_group.test.name - cloud_exadata_infrastructure_name = azurerm_oracledatabase_exadata_infrastructure.test.name -} - -`, data.RandomInteger, data.Locations.Primary, data.RandomString) -} diff --git a/internal/services/oracledatabase/db_servers_data_source.go b/internal/services/oracledatabase/db_servers_data_source.go deleted file mode 100644 index 671f955e8070..000000000000 --- a/internal/services/oracledatabase/db_servers_data_source.go +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright © 2024, Oracle and/or its affiliates. All rights reserved - -package oracledatabase - -import ( - "context" - "fmt" - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers" - "time" - - "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" -) - -type DBServersDataSource struct{} - -type DBServersDataModel struct { - DBServers []DBServerDataModel `tfschema:"db_servers"` -} - -type DBServerDataModel struct { - AutonomousVMClusterIds []string `tfschema:"autonomous_vm_cluster_ids"` - AutonomousVirtualMachineIds []string `tfschema:"autonomous_virtual_machine_ds"` - CompartmentId string `tfschema:"compartment_id"` - CpuCoreCount int64 `tfschema:"cpu_core_count"` - DbNodeIds []string `tfschema:"db_node_ids"` - DbNodeStorageSizeInGbs int64 `tfschema:"db_node_storage_size_in_gbs"` - DisplayName string `tfschema:"display_name"` - ExadataInfrastructureId string `tfschema:"exadata_infrastructure_id"` - LifecycleDetails string `tfschema:"lifecycle_details"` - LifecycleState string `tfschema:"lifecycle_state"` - MaxCPUCount int64 `tfschema:"max_cpu_count"` - MaxDbNodeStorageInGbs int64 `tfschema:"max_db_node_storage_in_gbs"` - MaxMemoryInGbs int64 `tfschema:"max_memory_in_gbs"` - MemorySizeInGbs int64 `tfschema:"memory_size_in_gbs"` - Ocid string `tfschema:"ocid"` - ProvisioningState string `tfschema:"provisioning_state"` - Shape string `tfschema:"shape"` - TimeCreated string `tfschema:"time_created"` - VMClusterIds []string `tfschema:"vm_cluster_ids"` -} - -func (d DBServersDataSource) Arguments() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{ - "resource_group_name": { - Type: pluginsdk.TypeString, - Required: true, - }, - "cloud_exadata_infrastructure_name": { - Type: pluginsdk.TypeString, - Required: true, - }, - } -} - -func (d DBServersDataSource) Attributes() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{ - "db_servers": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "autonomous_vm_cluster_ids": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - "autonomous_virtual_machine_ds": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - "compartment_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "cpu_core_count": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "db_node_ids": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - "db_node_storage_size_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "display_name": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "exadata_infrastructure_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "lifecycle_details": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "lifecycle_state": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "max_cpu_count": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "max_db_node_storage_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "max_memory_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "memory_size_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "ocid": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "provisioning_state": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "shape": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "time_created": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "vm_cluster_ids": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - }, - }, - }, - } -} - -func (d DBServersDataSource) ModelObject() interface{} { - return nil -} - -func (d DBServersDataSource) ResourceType() string { - return "azurerm_oracledatabase_db_servers" -} - -func (d DBServersDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { - return dbservers.ValidateDbServerID -} - -func (d DBServersDataSource) Read() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 5 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.OracleDatabase.OracleDatabaseClient.DbServers - subscriptionId := metadata.Client.Account.SubscriptionId - - id := dbservers.NewCloudExadataInfrastructureID(subscriptionId, - metadata.ResourceData.Get("resource_group_name").(string), - metadata.ResourceData.Get("cloud_exadata_infrastructure_name").(string)) - - resp, err := client.ListByCloudExadataInfrastructure(ctx, id) - if err != nil { - if response.WasNotFound(resp.HttpResponse) { - return fmt.Errorf("%s was not found", id) - } - return fmt.Errorf("retrieving %s: %+v", id, err) - } - - if model := resp.Model; model != nil { - output := DBServersDataModel{ - DBServers: make([]DBServerDataModel, 0), - } - for _, element := range *model { - if element.Properties != nil { - properties := element.Properties - dbServer := DBServerDataModel{ - AutonomousVMClusterIds: pointer.From(properties.AutonomousVMClusterIds), - AutonomousVirtualMachineIds: pointer.From(properties.AutonomousVirtualMachineIds), - CompartmentId: pointer.From(properties.CompartmentId), - CpuCoreCount: pointer.From(properties.CpuCoreCount), - DbNodeIds: pointer.From(properties.DbNodeIds), - DbNodeStorageSizeInGbs: pointer.From(properties.DbNodeStorageSizeInGbs), - DisplayName: pointer.From(properties.DisplayName), - ExadataInfrastructureId: pointer.From(properties.ExadataInfrastructureId), - LifecycleDetails: pointer.From(properties.LifecycleDetails), - LifecycleState: string(pointer.From(properties.LifecycleState)), - MaxCPUCount: pointer.From(properties.MaxCPUCount), - MaxDbNodeStorageInGbs: pointer.From(properties.MaxDbNodeStorageInGbs), - MaxMemoryInGbs: pointer.From(properties.MaxMemoryInGbs), - MemorySizeInGbs: pointer.From(properties.MemorySizeInGbs), - Ocid: pointer.From(properties.Ocid), - ProvisioningState: string(pointer.From(properties.ProvisioningState)), - Shape: pointer.From(properties.Shape), - TimeCreated: pointer.From(properties.TimeCreated), - VMClusterIds: pointer.From(properties.VMClusterIds), - } - output.DBServers = append(output.DBServers, dbServer) - } - } - metadata.SetID(id) - if err := metadata.Encode(&output); err != nil { - return fmt.Errorf("encoding %s: %+v", id, err) - } - } - return nil - }, - } -} diff --git a/internal/services/oracledatabase/db_servers_data_source_test.go b/internal/services/oracledatabase/db_servers_data_source_test.go deleted file mode 100644 index 1b84da59b6ea..000000000000 --- a/internal/services/oracledatabase/db_servers_data_source_test.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright © 2024, Oracle and/or its affiliates. All rights reserved - -package oracledatabase_test - -import ( - "fmt" - "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" - "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" - "testing" -) - -type DBServersDataSource struct{} - -func TestDBServersDataSource_basic(t *testing.T) { - data := acceptance.BuildTestData(t, "data.azurerm_oracledatabase_db_servers", "test") - r := DBServersDataSource{} - - data.DataSourceTest(t, []acceptance.TestStep{ - { - Config: r.basic(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).Key("db_servers.0.compartment_id").Exists(), - ), - }, - }) -} - -func (d DBServersDataSource) basic(data acceptance.TestData) string { - return fmt.Sprintf(` - -%s - -data "azurerm_oracledatabase_db_servers" "test" { - resource_group_name = azurerm_resource_group.test.name - cloud_exadata_infrastructure_name = azurerm_oracledatabase_exadata_infrastructure.test.name -} -`, d.template(data)) -} - -func (d DBServersDataSource) template(data acceptance.TestData) string { - return fmt.Sprintf(` -%s - -`, ExadataInfraResource{}.basic(data)) -} diff --git a/internal/services/oracledatabase/exadata_infrastructure_data_source.go b/internal/services/oracledatabase/exadata_infrastructure_data_source.go deleted file mode 100644 index 52c26869d5b6..000000000000 --- a/internal/services/oracledatabase/exadata_infrastructure_data_source.go +++ /dev/null @@ -1,458 +0,0 @@ -// Copyright © 2024, Oracle and/or its affiliates. All rights reserved - -package oracledatabase - -import ( - "context" - "fmt" - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" - "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures" - "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" - "time" -) - -type ExadataInfraDataSource struct{} - -type ExadataInfraDataModel struct { - Location string `tfschema:"location"` - Name string `tfschema:"name"` - ResourceGroupName string `tfschema:"resource_group_name"` - Type string `tfschema:"type"` - Tags map[string]interface{} `tfschema:"tags"` - Zones zones.Schema `tfschema:"zones"` - - // SystemData - SystemData []SystemDataModel `tfschema:"system_data"` - - // CloudExadataInfrastructureProperties - ActivatedStorageCount int64 `tfschema:"activated_storage_count"` - AdditionalStorageCount int64 `tfschema:"additional_storage_count"` - AvailableStorageSizeInGbs int64 `tfschema:"available_storage_size_in_gbs"` - ComputeCount int64 `tfschema:"compute_count"` - CpuCount int64 `tfschema:"cpu_count"` - CustomerContacts []string `tfschema:"customer_contacts"` - DataStorageSizeInTbs float64 `tfschema:"data_storage_size_in_tbs"` - DbNodeStorageSizeInGbs int64 `tfschema:"db_node_storage_size_in_gbs"` - DbServerVersion string `tfschema:"db_server_version"` - DisplayName string `tfschema:"display_name"` - EstimatedPatchingTime []EstimatedPatchingTimeModel `tfschema:"estimated_patching_time"` - LastMaintenanceRunId string `tfschema:"last_maintenance_run_id"` - LifecycleDetails string `tfschema:"lifecycle_details"` - LifecycleState string `tfschema:"lifecycle_state"` - MaintenanceWindow []MaintenanceWindowModel `tfschema:"maintenance_window"` - MaxCPUCount int64 `tfschema:"max_cpu_count"` - MaxDataStorageInTbs float64 `tfschema:"max_data_storage_in_tbs"` - MaxDbNodeStorageSizeInGbs int64 `tfschema:"max_db_node_storage_size_in_gbs"` - MaxMemoryInGbs int64 `tfschema:"max_memory_in_gbs"` - MemorySizeInGbs int64 `tfschema:"memory_size_in_gbs"` - MonthlyDbServerVersion string `tfschema:"monthly_db_server_version"` - MonthlyStorageServerVersion string `tfschema:"monthly_storage_server_version"` - NextMaintenanceRunId string `tfschema:"next_maintenance_run_id"` - OciUrl string `tfschema:"oci_url"` - Ocid string `tfschema:"ocid"` - ProvisioningState string `tfschema:"provisioning_state"` - Shape string `tfschema:"shape"` - StorageCount int64 `tfschema:"storage_count"` - StorageServerVersion string `tfschema:"storage_server_version"` - TimeCreated string `tfschema:"time_created"` - TotalStorageSizeInGbs int64 `tfschema:"total_storage_size_in_gbs"` -} - -type SystemDataModel struct { - CreatedBy string `tfschema:"created_by"` - CreatedByType string `tfschema:"created_by_type"` - CreatedAt string `tfschema:"created_at"` - LastModifiedBy string `tfschema:"last_modified_by"` - LastModifiedbyType string `tfschema:"last_modified_by_type"` - LastModifiedAt string `tfschema:"last_modified_at"` -} - -type EstimatedPatchingTimeModel struct { - EstimatedDbServerPatchingTime *int64 `tfschema:"estimated_db_server_patching_time"` - EstimatedNetworkSwitchesPatchingTime *int64 `tfschema:"estimated_network_switches_patching_time"` - EstimatedStorageServerPatchingTime *int64 `tfschema:"estimated_storage_server_patching_time"` - TotalEstimatedPatchingTime *int64 `tfschema:"total_estimated_patching_time"` -} - -type MaintenanceWindowModel struct { - CustomActionTimeoutInMins int64 `tfschema:"custom_action_timeout_in_mins"` - DaysOfWeek []string `tfschema:"days_of_week"` - HoursOfDay []int64 `tfschema:"hours_of_day"` - IsCustomActionTimeoutEnabled bool `tfschema:"is_custom_action_timeout_enabled"` - IsMonthlyPatchingEnabled bool `tfschema:"is_monthly_patching_enabled"` - LeadTimeInWeeks int64 `tfschema:"lead_time_in_weeks"` - Months []string `tfschema:"months"` - PatchingMode string `tfschema:"patching_mode"` - Preference string `tfschema:"preference"` - WeeksOfMonth []int64 `tfschema:"weeks_of_month"` -} - -func (d ExadataInfraDataSource) Arguments() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{ - "resource_group_name": commonschema.ResourceGroupNameForDataSource(), - "name": { - Type: pluginsdk.TypeString, - Required: true, - }, - } -} - -func (d ExadataInfraDataSource) Attributes() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{ - "location": commonschema.LocationComputed(), - "type": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "tags": commonschema.TagsDataSource(), - "zones": commonschema.ZonesMultipleComputed(), - - // SystemData - "system_data": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "created_by": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "created_by_type": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "created_at": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "last_modified_by": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "last_modified_by_type": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "last_modified_at": { - Type: pluginsdk.TypeString, - Computed: true, - }, - }, - }, - }, - - // CloudExadataInfrastructureProperties - "activated_storage_count": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "additional_storage_count": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "available_storage_size_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "compute_count": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "cpu_count": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "customer_contacts": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - "data_storage_size_in_tbs": { - Type: pluginsdk.TypeFloat, - Computed: true, - }, - "db_node_storage_size_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "db_server_version": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "display_name": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "estimated_patching_time": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "estimated_db_server_patching_time": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "estimated_network_switches_patching_time": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "estimated_storage_server_patching_time": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "total_estimated_patching_time": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - }, - }, - }, - "last_maintenance_run_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "lifecycle_details": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "lifecycle_state": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "maintenance_window": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "custom_action_timeout_in_mins": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "days_of_week": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - "hours_of_day": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeInt, - }, - }, - "is_custom_action_timeout_enabled": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - "is_monthly_patching_enabled": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - "lead_time_in_weeks": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "months": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - "patching_mode": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "preference": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "weeks_of_month": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeInt, - }, - }, - }, - }, - }, - "max_cpu_count": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "max_data_storage_in_tbs": { - Type: pluginsdk.TypeFloat, - Computed: true, - }, - "max_db_node_storage_size_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "max_memory_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "memory_size_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "monthly_db_server_version": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "monthly_storage_server_version": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "next_maintenance_run_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "oci_url": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "ocid": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "provisioning_state": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "shape": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "storage_count": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - "storage_server_version": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "time_created": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "total_storage_size_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - } -} - -func (d ExadataInfraDataSource) ModelObject() interface{} { - return nil -} - -func (d ExadataInfraDataSource) ResourceType() string { - return "azurerm_oracledatabase_exadata_infrastructure" -} - -func (d ExadataInfraDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { - return cloudexadatainfrastructures.ValidateCloudExadataInfrastructureID -} - -func (d ExadataInfraDataSource) Read() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 5 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudExadataInfrastructures - subscriptionId := metadata.Client.Account.SubscriptionId - - id := cloudexadatainfrastructures.NewCloudExadataInfrastructureID(subscriptionId, - metadata.ResourceData.Get("resource_group_name").(string), - metadata.ResourceData.Get("name").(string)) - - resp, err := client.Get(ctx, id) - if err != nil { - if response.WasNotFound(resp.HttpResponse) { - return fmt.Errorf("%s was not found", id) - } - return fmt.Errorf("retrieving %s: %+v", id, err) - } - - if model := resp.Model; model != nil { - err := metadata.ResourceData.Set("location", location.NormalizeNilable(&model.Location)) - if err != nil { - return err - } - - var output ExadataInfraDataModel - prop := model.Properties - if prop != nil { - output = ExadataInfraDataModel{ - ActivatedStorageCount: pointer.From(prop.ActivatedStorageCount), - AdditionalStorageCount: pointer.From(prop.AdditionalStorageCount), - AvailableStorageSizeInGbs: pointer.From(prop.AvailableStorageSizeInGbs), - CpuCount: pointer.From(prop.CpuCount), - ComputeCount: pointer.From(prop.ComputeCount), - CustomerContacts: ConvertCustomerContactsToInternalModel(prop.CustomerContacts), - DataStorageSizeInTbs: pointer.From(prop.DataStorageSizeInTbs), - DbNodeStorageSizeInGbs: pointer.From(prop.DbNodeStorageSizeInGbs), - DbServerVersion: pointer.From(prop.DbServerVersion), - DisplayName: prop.DisplayName, - EstimatedPatchingTime: ConvertEstimatedPatchingTimesToInternalModel(prop.EstimatedPatchingTime), - LastMaintenanceRunId: pointer.From(prop.LastMaintenanceRunId), - LifecycleDetails: pointer.From(prop.LifecycleDetails), - LifecycleState: string(*prop.LifecycleState), - MaintenanceWindow: ConvertMaintenanceWindowToInternalModel(prop.MaintenanceWindow), - MaxCPUCount: pointer.From(prop.MaxCPUCount), - MaxDataStorageInTbs: pointer.From(prop.MaxDataStorageInTbs), - MaxDbNodeStorageSizeInGbs: pointer.From(prop.MaxDbNodeStorageSizeInGbs), - MaxMemoryInGbs: pointer.From(prop.MaxMemoryInGbs), - MemorySizeInGbs: pointer.From(prop.MemorySizeInGbs), - MonthlyDbServerVersion: pointer.From(prop.MonthlyDbServerVersion), - MonthlyStorageServerVersion: pointer.From(prop.MonthlyStorageServerVersion), - NextMaintenanceRunId: pointer.From(prop.NextMaintenanceRunId), - OciUrl: pointer.From(prop.OciUrl), - Ocid: pointer.From(prop.Ocid), - ProvisioningState: string(*prop.ProvisioningState), - Shape: prop.Shape, - StorageCount: pointer.From(prop.StorageCount), - StorageServerVersion: pointer.From(prop.StorageServerVersion), - TimeCreated: pointer.From(prop.TimeCreated), - TotalStorageSizeInGbs: pointer.From(prop.TotalStorageSizeInGbs), - } - } - - systemData := model.SystemData - if systemData != nil { - output.SystemData = []SystemDataModel{ - { - CreatedBy: systemData.CreatedBy, - CreatedByType: systemData.CreatedByType, - CreatedAt: systemData.CreatedAt, - LastModifiedBy: systemData.LastModifiedBy, - LastModifiedbyType: systemData.LastModifiedbyType, - LastModifiedAt: systemData.LastModifiedAt, - }, - } - } - output.Name = id.CloudExadataInfrastructureName - output.ResourceGroupName = id.ResourceGroupName - output.Type = pointer.From(model.Type) - output.Tags = utils.FlattenPtrMapStringString(model.Tags) - output.Location = model.Location - output.Zones = model.Zones - - metadata.SetID(id) - return metadata.Encode(&output) - } - return nil - }, - } -} diff --git a/internal/services/oracledatabase/exadata_infrastructure_data_source_test.go b/internal/services/oracledatabase/exadata_infrastructure_data_source_test.go deleted file mode 100644 index f9daca462216..000000000000 --- a/internal/services/oracledatabase/exadata_infrastructure_data_source_test.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright © 2024, Oracle and/or its affiliates. All rights reserved - -package oracledatabase_test - -import ( - "fmt" - "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" - "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracledatabase" - "testing" -) - -type ExadataInfraDataSource struct{} - -func TestExadataInfraDataSource_basic(t *testing.T) { - data := acceptance.BuildTestData(t, oracledatabase.ExadataInfraDataSource{}.ResourceType(), "test") - r := ExadataInfraDataSource{} - - data.DataSourceTest(t, []acceptance.TestStep{ - { - Config: r.basic(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).Key("name").Exists(), - check.That(data.ResourceName).Key("location").Exists(), - check.That(data.ResourceName).Key("resource_group_name").Exists(), - check.That(data.ResourceName).Key("compute_count").Exists(), - check.That(data.ResourceName).Key("display_name").Exists(), - check.That(data.ResourceName).Key("shape").Exists(), - check.That(data.ResourceName).Key("storage_count").Exists(), - check.That(data.ResourceName).Key("zones.#").HasValue("1"), - ), - }, - }) -} - -func (d ExadataInfraDataSource) basic(data acceptance.TestData) string { - return fmt.Sprintf(` -%s - -data "azurerm_oracledatabase_exadata_infrastructure" "test" { - name = azurerm_oracledatabase_exadata_infrastructure.test.name - resource_group_name = azurerm_oracledatabase_exadata_infrastructure.test.resource_group_name -} -`, ExadataInfraResource{}.basic(data)) -} diff --git a/internal/services/oracledatabase/exadata_infrastructure_helpers.go b/internal/services/oracledatabase/exadata_infrastructure_helpers.go deleted file mode 100644 index 16739c5402e0..000000000000 --- a/internal/services/oracledatabase/exadata_infrastructure_helpers.go +++ /dev/null @@ -1,102 +0,0 @@ -package oracledatabase - -import ( - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures" -) - -func ConvertCustomerContactsToInternalModel(customerContactsList *[]cloudexadatainfrastructures.CustomerContact) []string { - var customerContacts []string - if customerContactsList != nil { - for _, customerContact := range *customerContactsList { - customerContacts = append(customerContacts, customerContact.Email) - } - } - return customerContacts -} - -func ConvertEstimatedPatchingTimesToInternalModel(estimatedPatchingTime *cloudexadatainfrastructures.EstimatedPatchingTime) []EstimatedPatchingTimeModel { - if estimatedPatchingTime != nil { - return []EstimatedPatchingTimeModel{ - { - EstimatedDbServerPatchingTime: estimatedPatchingTime.EstimatedDbServerPatchingTime, - EstimatedNetworkSwitchesPatchingTime: estimatedPatchingTime.EstimatedNetworkSwitchesPatchingTime, - EstimatedStorageServerPatchingTime: estimatedPatchingTime.EstimatedStorageServerPatchingTime, - TotalEstimatedPatchingTime: estimatedPatchingTime.TotalEstimatedPatchingTime, - }, - } - } - return nil -} - -func ConvertMaintenanceWindowToInternalModel(maintenanceWindow *cloudexadatainfrastructures.MaintenanceWindow) []MaintenanceWindowModel { - if maintenanceWindow != nil { - return []MaintenanceWindowModel{ - { - CustomActionTimeoutInMins: pointer.From(maintenanceWindow.CustomActionTimeoutInMins), - DaysOfWeek: ConvertDayOfWeekToInternalModel(maintenanceWindow.DaysOfWeek), - HoursOfDay: pointer.From(maintenanceWindow.HoursOfDay), - IsCustomActionTimeoutEnabled: pointer.From(maintenanceWindow.IsCustomActionTimeoutEnabled), - IsMonthlyPatchingEnabled: pointer.From(maintenanceWindow.IsMonthlyPatchingEnabled), - LeadTimeInWeeks: pointer.From(maintenanceWindow.LeadTimeInWeeks), - Months: ConvertMonthsToInternalModel(maintenanceWindow.Months), - PatchingMode: string(pointer.From(maintenanceWindow.PatchingMode)), - Preference: string(pointer.From(maintenanceWindow.Preference)), - WeeksOfMonth: pointer.From(maintenanceWindow.WeeksOfMonth), - }, - } - } - return nil -} - -func ConvertDayOfWeekToInternalModel(dayOfWeeks *[]cloudexadatainfrastructures.DayOfWeek) []string { - var dayOfWeeksArray []string - if dayOfWeeks != nil { - for _, dayOfWeek := range *dayOfWeeks { - dayOfWeeksArray = append(dayOfWeeksArray, string(dayOfWeek.Name)) - } - } - return dayOfWeeksArray -} - -func ConvertMonthsToInternalModel(months *[]cloudexadatainfrastructures.Month) []string { - var monthsArray []string - if months != nil { - for _, month := range *months { - monthsArray = append(monthsArray, string(month.Name)) - } - } - return monthsArray -} - -func ConvertCustomerContactsToSDK(customerContactsList []string) []cloudexadatainfrastructures.CustomerContact { - var customerContacts []cloudexadatainfrastructures.CustomerContact - if customerContactsList != nil { - for _, customerContact := range customerContactsList { - customerContacts = append(customerContacts, cloudexadatainfrastructures.CustomerContact{ - Email: customerContact, - }) - } - } - return customerContacts -} - -func ConvertDayOfWeekToSDK(daysOfWeek []string) []cloudexadatainfrastructures.DayOfWeek { - var daysOfWeekConverted []cloudexadatainfrastructures.DayOfWeek - for _, day := range daysOfWeek { - daysOfWeekConverted = append(daysOfWeekConverted, cloudexadatainfrastructures.DayOfWeek{ - Name: cloudexadatainfrastructures.DayOfWeekName(day), - }) - } - return daysOfWeekConverted -} - -func ConvertMonthsToSDK(months []string) []cloudexadatainfrastructures.Month { - var monthsConverted []cloudexadatainfrastructures.Month - for _, month := range months { - monthsConverted = append(monthsConverted, cloudexadatainfrastructures.Month{ - Name: cloudexadatainfrastructures.MonthName(month), - }) - } - return monthsConverted -} diff --git a/internal/services/oracledatabase/exadata_infrastructure_resource.go b/internal/services/oracledatabase/exadata_infrastructure_resource.go deleted file mode 100644 index bc6a7099a107..000000000000 --- a/internal/services/oracledatabase/exadata_infrastructure_resource.go +++ /dev/null @@ -1,337 +0,0 @@ -// Copyright © 2024, Oracle and/or its affiliates. All rights reserved - -package oracledatabase - -import ( - "context" - "fmt" - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" - "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures" - "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" - "time" -) - -var _ sdk.Resource = ExadataInfraResource{} - -type ExadataInfraResource struct{} - -type ExadataInfraResourceModel struct { - // Azure - Location string `tfschema:"location"` - Name string `tfschema:"name"` - ResourceGroupName string `tfschema:"resource_group_name"` - Tags map[string]interface{} `tfschema:"tags"` - Zones zones.Schema `tfschema:"zones"` - - // Required - ComputeCount int64 `tfschema:"compute_count"` - DisplayName string `tfschema:"display_name"` - Shape string `tfschema:"shape"` - StorageCount int64 `tfschema:"storage_count"` - - // Optional - CustomerContacts []string `tfschema:"customer_contacts"` - MaintenanceWindow []MaintenanceWindowModel `tfschema:"maintenance_window"` -} - -func (ExadataInfraResource) Arguments() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{ - // Azure - "location": commonschema.Location(), - "name": { - Type: pluginsdk.TypeString, - Required: true, - }, - "resource_group_name": { - Type: pluginsdk.TypeString, - Required: true, - }, - "tags": commonschema.Tags(), - "zones": commonschema.ZonesMultipleRequired(), - - // Required - "compute_count": { - Type: pluginsdk.TypeInt, - Required: true, - }, - "display_name": { - Type: pluginsdk.TypeString, - Required: true, - }, - "shape": { - Type: pluginsdk.TypeString, - Required: true, - }, - "storage_count": { - Type: pluginsdk.TypeInt, - Required: true, - }, - - // Optional - "customer_contacts": { - Type: pluginsdk.TypeList, - Optional: true, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - "maintenance_window": { - Type: pluginsdk.TypeList, - Optional: true, - Computed: true, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "custom_action_timeout_in_mins": { - Type: pluginsdk.TypeInt, - Optional: true, - Computed: true, - }, - "days_of_week": { - Type: pluginsdk.TypeList, - Optional: true, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - "hours_of_day": { - Type: pluginsdk.TypeList, - Optional: true, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeInt, - }, - }, - "is_custom_action_timeout_enabled": { - Type: pluginsdk.TypeBool, - Optional: true, - Computed: true, - }, - "is_monthly_patching_enabled": { - Type: pluginsdk.TypeBool, - Optional: true, - Computed: true, - }, - "lead_time_in_weeks": { - Type: pluginsdk.TypeInt, - Optional: true, - Computed: true, - }, - "months": { - Type: pluginsdk.TypeList, - Optional: true, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - "patching_mode": { - Type: pluginsdk.TypeString, - Optional: true, - Computed: true, - }, - "preference": { - Type: pluginsdk.TypeString, - Optional: true, - Computed: true, - }, - "weeks_of_month": { - Type: pluginsdk.TypeList, - Optional: true, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeInt, - }, - }, - }, - }, - }, - } -} - -func (ExadataInfraResource) Attributes() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{} -} - -func (ExadataInfraResource) ModelObject() interface{} { - return &ExadataInfraResource{} -} - -func (ExadataInfraResource) ResourceType() string { - return "azurerm_oracledatabase_exadata_infrastructure" -} - -func (r ExadataInfraResource) Create() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 30 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudExadataInfrastructures - subscriptionId := metadata.Client.Account.SubscriptionId - - var model ExadataInfraResourceModel - if err := metadata.Decode(&model); err != nil { - return err - } - - id := cloudexadatainfrastructures.NewCloudExadataInfrastructureID(subscriptionId, - model.ResourceGroupName, - model.Name) - - existing, err := client.Get(ctx, id) - if err != nil && !response.WasNotFound(existing.HttpResponse) { - return fmt.Errorf("checking for presence of existing %s: %+v", id, err) - } - if !response.WasNotFound(existing.HttpResponse) { - return metadata.ResourceRequiresImport(r.ResourceType(), id) - } - - param := cloudexadatainfrastructures.CloudExadataInfrastructure{ - Name: pointer.To(model.Name), - Location: model.Location, - Tags: tags.Expand(model.Tags), - Zones: model.Zones, - Properties: &cloudexadatainfrastructures.CloudExadataInfrastructureProperties{ - ComputeCount: pointer.To(model.ComputeCount), - DisplayName: model.DisplayName, - StorageCount: pointer.To(model.StorageCount), - Shape: model.Shape, - CustomerContacts: pointer.To(ConvertCustomerContactsToSDK(model.CustomerContacts)), - }, - } - - if model.MaintenanceWindow != nil && len(model.MaintenanceWindow) > 0 { - param.Properties.MaintenanceWindow = &cloudexadatainfrastructures.MaintenanceWindow{ - CustomActionTimeoutInMins: pointer.To(model.MaintenanceWindow[0].CustomActionTimeoutInMins), - DaysOfWeek: pointer.To(ConvertDayOfWeekToSDK(model.MaintenanceWindow[0].DaysOfWeek)), - HoursOfDay: pointer.To(model.MaintenanceWindow[0].HoursOfDay), - IsCustomActionTimeoutEnabled: pointer.To(model.MaintenanceWindow[0].IsCustomActionTimeoutEnabled), - IsMonthlyPatchingEnabled: pointer.To(model.MaintenanceWindow[0].IsMonthlyPatchingEnabled), - LeadTimeInWeeks: pointer.To(model.MaintenanceWindow[0].LeadTimeInWeeks), - Months: pointer.To(ConvertMonthsToSDK(model.MaintenanceWindow[0].Months)), - PatchingMode: pointer.To(cloudexadatainfrastructures.PatchingMode(model.MaintenanceWindow[0].PatchingMode)), - Preference: pointer.To(cloudexadatainfrastructures.Preference(model.MaintenanceWindow[0].Preference)), - WeeksOfMonth: pointer.To(model.MaintenanceWindow[0].WeeksOfMonth), - } - } - - if err := client.CreateOrUpdateThenPoll(ctx, id, param); err != nil { - return fmt.Errorf("creating %s: %+v", id, err) - } - - metadata.SetID(id) - return nil - }, - } -} - -func (r ExadataInfraResource) Update() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 30 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - - client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudExadataInfrastructures - id, err := cloudexadatainfrastructures.ParseCloudExadataInfrastructureID(metadata.ResourceData.Id()) - if err != nil { - return err - } - - var model ExadataInfraResourceModel - if err = metadata.Decode(&model); err != nil { - return fmt.Errorf("decoding err: %+v", err) - } - - existing, err := client.Get(ctx, *id) - if err != nil { - return fmt.Errorf("retrieving exists when updating: +%v", *id) - } - if existing.Model == nil && existing.Model.Properties == nil { - return fmt.Errorf("retrieving as nil when updating for %v", *id) - } - - if metadata.ResourceData.HasChange("tags") { - update := &cloudexadatainfrastructures.CloudExadataInfrastructureUpdate{ - Tags: tags.Expand(model.Tags), - } - err = client.UpdateThenPoll(ctx, *id, *update) - if err != nil { - return fmt.Errorf("updating %s: %v", id, err) - } - } else if metadata.ResourceData.HasChangesExcept("tags") { - return fmt.Errorf("only `tags` currently support updates") - } - return nil - }, - } -} - -func (ExadataInfraResource) Read() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 5 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - id, err := cloudexadatainfrastructures.ParseCloudExadataInfrastructureID(metadata.ResourceData.Id()) - if err != nil { - return err - } - - client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudExadataInfrastructures - result, err := client.Get(ctx, *id) - if err != nil { - if response.WasNotFound(result.HttpResponse) { - return metadata.MarkAsGone(id) - } - return err - } - - if result.Model == nil { - return fmt.Errorf("retrieving %s got nil model", id) - } - var output ExadataInfraResourceModel - - output.CustomerContacts = ConvertCustomerContactsToInternalModel(result.Model.Properties.CustomerContacts) - output.Name = pointer.ToString(result.Model.Name) - output.Location = result.Model.Location - output.Zones = result.Model.Zones - output.ResourceGroupName = id.ResourceGroupName - output.Tags = utils.FlattenPtrMapStringString(result.Model.Tags) - prop := result.Model.Properties - output.ComputeCount = pointer.From(prop.ComputeCount) - output.DisplayName = prop.DisplayName - output.StorageCount = pointer.From(prop.StorageCount) - output.Shape = prop.Shape - output.MaintenanceWindow = ConvertMaintenanceWindowToInternalModel(prop.MaintenanceWindow) - - return metadata.Encode(&output) - }, - } -} - -func (ExadataInfraResource) Delete() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 30 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudExadataInfrastructures - - id, err := cloudexadatainfrastructures.ParseCloudExadataInfrastructureID(metadata.ResourceData.Id()) - if err != nil { - return err - } - - if err = client.DeleteThenPoll(ctx, *id); err != nil { - return fmt.Errorf("deleting %s: %+v", *id, err) - } - - return nil - }, - } -} - -func (ExadataInfraResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { - return cloudexadatainfrastructures.ValidateCloudExadataInfrastructureID -} diff --git a/internal/services/oracledatabase/exadata_infrastructure_resource_test.go b/internal/services/oracledatabase/exadata_infrastructure_resource_test.go deleted file mode 100644 index 9b912d8f5635..000000000000 --- a/internal/services/oracledatabase/exadata_infrastructure_resource_test.go +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright © 2024, Oracle and/or its affiliates. All rights reserved - -package oracledatabase_test - -import ( - "context" - "fmt" - "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracledatabase" - "testing" - - "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" - "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" - "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" -) - -type ExadataInfraResource struct{} - -func (a ExadataInfraResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := cloudexadatainfrastructures.ParseCloudExadataInfrastructureID(state.ID) - if err != nil { - return nil, err - } - resp, err := client.OracleDatabase.OracleDatabaseClient.CloudExadataInfrastructures.Get(ctx, *id) - if err != nil { - return nil, fmt.Errorf("retrieving Exadata Infrastructure %s: %+v", id, err) - } - return utils.Bool(resp.Model != nil), nil -} - -func (a ExadataInfraResource) Destroy(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := cloudexadatainfrastructures.ParseCloudExadataInfrastructureID(state.ID) - if err != nil { - return nil, err - } - if _, err := client.OracleDatabase.OracleDatabaseClient.CloudExadataInfrastructures.Delete(ctx, *id); err != nil { - return nil, fmt.Errorf("deleting Exadata Infrastructure %s: %+v", id, err) - } - return utils.Bool(true), nil -} - -func TestExaInfra_basic(t *testing.T) { - data := acceptance.BuildTestData(t, oracledatabase.ExadataInfraResource{}.ResourceType(), "test") - r := ExadataInfraResource{} - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.basic(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep(), - }) -} - -func TestExaInfra_allFields(t *testing.T) { - data := acceptance.BuildTestData(t, oracledatabase.ExadataInfraResource{}.ResourceType(), "test") - r := ExadataInfraResource{} - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.allFields(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep(), - }) -} - -func TestExaInfra_requiresImport(t *testing.T) { - data := acceptance.BuildTestData(t, oracledatabase.ExadataInfraResource{}.ResourceType(), "test") - r := ExadataInfraResource{} - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.basic(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.RequiresImportErrorStep(r.requiresImport), - }) -} - -func TestExaInfra_update(t *testing.T) { - data := acceptance.BuildTestData(t, oracledatabase.ExadataInfraResource{}.ResourceType(), "test") - r := ExadataInfraResource{} - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.basic(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep(), - { - Config: r.update(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep(), - }) -} - -func (a ExadataInfraResource) basic(data acceptance.TestData) string { - return fmt.Sprintf(` - -%s - -resource "azurerm_oracledatabase_exadata_infrastructure" "test" { - name = "OFakeacctest%[2]d" - location = "%[3]s" - resource_group_name = azurerm_resource_group.test.name - compute_count = "2" - display_name = "OFakeacctest%[2]d" - shape = "Exadata.X9M" - storage_count = "3" - zones = ["3"] -} -`, a.template(data), data.RandomInteger, data.Locations.Primary) -} - -func (a ExadataInfraResource) allFields(data acceptance.TestData) string { - return fmt.Sprintf(` - -%s - -resource "azurerm_oracledatabase_exadata_infrastructure" "test" { - name = "OFakeacctest%[2]d" - location = "%[3]s" - resource_group_name = azurerm_resource_group.test.name - compute_count = "2" - display_name = "OFakeacctest%[2]d" - shape = "Exadata.X9M" - storage_count = "3" - zones = ["3"] - customer_contacts = ["test@test.com"] - maintenance_window { - custom_action_timeout_in_mins = 0 - days_of_week = ["Monday"] - hours_of_day = [1] - is_custom_action_timeout_enabled = false - is_monthly_patching_enabled = true - months = ["January"] - weeks_of_month = [2] - lead_time_in_weeks = 1 - patching_mode = "Rolling" - preference = "NoPreference" - } - tags = { - test = "testTag1" - } -} -`, a.template(data), data.RandomInteger, data.Locations.Primary) -} - -func (a ExadataInfraResource) update(data acceptance.TestData) string { - return fmt.Sprintf(` - -%s - -resource "azurerm_oracledatabase_exadata_infrastructure" "test" { - name = "OFakeacctest%[2]d" - location = "%[3]s" - resource_group_name = azurerm_resource_group.test.name - compute_count = "2" - display_name = "OFakeacctest%[2]d" - shape = "Exadata.X9M" - storage_count = "3" - zones = ["3"] - tags = { - test = "testTag1" - } -} -`, a.template(data), data.RandomInteger, data.Locations.Primary) -} - -func (a ExadataInfraResource) requiresImport(data acceptance.TestData) string { - return fmt.Sprintf(` -%s - -resource "azurerm_oracledatabase_exadata_infrastructure" "import" { - name = azurerm_oracledatabase_exadata_infrastructure.test.name - location = azurerm_oracledatabase_exadata_infrastructure.test.location - resource_group_name = azurerm_oracledatabase_exadata_infrastructure.test.resource_group_name - compute_count = azurerm_oracledatabase_exadata_infrastructure.test.compute_count - display_name = azurerm_oracledatabase_exadata_infrastructure.test.display_name - shape = azurerm_oracledatabase_exadata_infrastructure.test.shape - storage_count = azurerm_oracledatabase_exadata_infrastructure.test.storage_count - zones = azurerm_oracledatabase_exadata_infrastructure.test.zones -} -`, a.basic(data)) -} - -func (a ExadataInfraResource) template(data acceptance.TestData) string { - return fmt.Sprintf(` -provider "azurerm" { - features {} -} - -data "azurerm_client_config" "current" {} - -resource "azurerm_resource_group" "test" { - name = "acctestRG-%[1]d" - location = "%[2]s" -} -`, data.RandomInteger, data.Locations.Primary, data.RandomString) -} diff --git a/internal/services/oracledatabase/registration.go b/internal/services/oracledatabase/registration.go deleted file mode 100644 index 3d37af313cba..000000000000 --- a/internal/services/oracledatabase/registration.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright © 2024, Oracle and/or its affiliates. All rights reserved - -package oracledatabase - -import ( - "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" -) - -type Registration struct{} - -var ( - _ sdk.TypedServiceRegistration = Registration{} -) - -func (r Registration) DataSources() []sdk.DataSource { - return []sdk.DataSource{ - ExadataInfraDataSource{}, - CloudVmClusterDataSource{}, - DBServersDataSource{}, - AutonomousDatabaseRegularDataSource{}, - } -} - -func (r Registration) Resources() []sdk.Resource { - return []sdk.Resource{ - ExadataInfraResource{}, - CloudVmClusterResource{}, - AdbsRegularResource{}, - } -} - -// Name is the name of this Service -func (r Registration) Name() string { - return "App Service" -} - -// WebsiteCategories returns a list of categories which can be used for the sidebar -func (r Registration) WebsiteCategories() []string { - return []string{ - "App Service", - } -} diff --git a/website/docs/d/oracledatabase_autonomous_database_regular.html.markdown b/website/docs/d/oracle_autonomous_database_regular.html.markdown similarity index 97% rename from website/docs/d/oracledatabase_autonomous_database_regular.html.markdown rename to website/docs/d/oracle_autonomous_database_regular.html.markdown index e655b7b639bf..f2e7c5104642 100644 --- a/website/docs/d/oracledatabase_autonomous_database_regular.html.markdown +++ b/website/docs/d/oracle_autonomous_database_regular.html.markdown @@ -1,25 +1,25 @@ --- subcategory: "App Service" layout: "azurerm" -page_title: "Azure Resource Manager: Data Source: azurerm_oracledatabase_autonomous_database_regular" +page_title: "Azure Resource Manager: Data Source: azurerm_oracle_autonomous_database" description: |- Gets information about an existing Autonomous Databases. --- -# Data Source: azurerm_oracledatabase_autonomous_database_regular +# Data Source: azurerm_oracle_autonomous_database Use this data source to access information about an existing Autonomous Databases. ## Example Usage ```hcl -data "azurerm_oracledatabase_autonomous_database_regular" "example" { +data "azurerm_oracle_autonomous_database" "example" { name = "existing" resource_group_name = "existing" } output "id" { - value = data.azurerm_oracledatabase_autonomous_database_regular.example.id + value = data.azurerm_oracle_autonomous_database.example.id } ``` diff --git a/website/docs/d/oracledatabase_cloud_vm_cluster.html.markdown b/website/docs/d/oracledatabase_cloud_vm_cluster.html.markdown deleted file mode 100644 index 16f86e0726d1..000000000000 --- a/website/docs/d/oracledatabase_cloud_vm_cluster.html.markdown +++ /dev/null @@ -1,177 +0,0 @@ ---- -subcategory: "App Service" -layout: "azurerm" -page_title: "Azure Resource Manager: Data Source: azurerm_oracledatabase_cloud_vm_cluster" -description: |- - Gets information about an existing Cloud VM Cluster. ---- - -# Data Source: azurerm_oracledatabase_cloud_vm_cluster - -Use this data source to access information about an existing Cloud VM Cluster. - -## Example Usage - -```hcl -data "azurerm_oracledatabase_cloud_vm_cluster" "example" { - name = "existing" - resource_group_name = "existing" -} - -output "id" { - value = data.azurerm_oracledatabase_cloud_vm_cluster.example.id -} -``` - -## Arguments Reference - -The following arguments are supported: - -* `name` - (Required) The name of this Cloud VM Cluster. - -* `resource_group_name` - (Required) The name of the Resource Group where the Cloud VM Cluster exists. - -## Attributes Reference - -In addition to the Arguments listed above - the following Attributes are exported: - -* `id` - The ID of the Cloud VM Cluster. - -* `backup_subnet_cidr` - Client OCI backup subnet CIDR, default is 192.168.252.0/22. - -* `cloud_exadata_infrastructure_id` - Cloud Exadata Infrastructure ID. - -* `cluster_name` - The cluster name for cloud VM cluster. - -* `compartment_id` - The OCID of the compartment. - -* `compute_nodes` - A `compute_nodes` block as defined below. - -* `cpu_core_count` - The number of CPU cores enabled on the cloud VM cluster. - -* `data_collection_options` - A `data_collection_options` block as defined below. - -* `data_storage_percentage` - The percentage assigned to DATA storage (user data and database files). The remaining percentage is assigned to RECO storage (database redo logs, archive logs, and recovery manager backups). Accepted values are 35, 40, 60 and 80. The default is 80 percent assigned to DATA storage. See [Storage Configuration](https://docs.oracle.com/en-us/iaas/exadatacloud/index.html#Exadata) in the Exadata documentation for details on the impact of the configuration settings on storage. - -* `data_storage_size_in_tbs` - The data disk group size to be allocated in TBs. - -* `db_node_storage_size_in_gbs` - The local node storage to be allocated in GBs. - -* `db_servers` - A `db_servers` block as defined below. - -* `disk_redundancy` - The type of redundancy configured for the cloud Vm cluster. NORMAL is 2-way redundancy. HIGH is 3-way redundancy. - -* `display_name` - The user-friendly name for the cloud VM cluster. The name does not need to be unique. - -* `domain` - The domain name for the cloud VM cluster. - -* `gi_version` - A valid Oracle Grid Infrastructure (GI) software version. - -* `hostname` - The hostname for the cloud VM cluster. - -* `iorm_config_cache` - A `iorm_config_cache` block as defined below. - -* `is_local_backup_enabled` - If true, database backup on local Exadata storage is configured for the cloud VM cluster. If false, database backup on local Exadata storage is not available in the cloud VM cluster. - -* `is_sparse_diskgroup_enabled` - If true, sparse disk group is configured for the cloud VM cluster. If false, sparse disk group is not created. - -* `last_update_history_entry_id` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the last maintenance update history entry. This value is updated when a maintenance update starts. - -* `license_model` - The Oracle license model that applies to the cloud VM cluster. - -* `lifecycle_details` - Additional information about the current lifecycle state. - -* `lifecycle_state` - Cloud VM Cluster lifecycle state enum. - -* `listener_port` - The port number configured for the listener on the cloud VM cluster. - -* `location` - The Azure Region where the Cloud VM Cluster exists. - -* `memory_size_in_gbs` - The memory to be allocated in GBs. - -* `node_count` - The number of nodes in the cloud VM cluster. - -* `nsg_url` - The list of [OCIDs](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) for the network security groups (NSGs) to which this resource belongs. Setting this to an empty list removes all resources from all NSGs. For more information about NSGs, see [Security Rules](https://docs.oracle.com/en-us/iaas/Content/Network/Concepts/securityrules.htm). NsgIds restrictions: - * A network security group (NSG) is optional for Autonomous Databases with private access. The nsgIds list can be empty. - -* `oci_url` - The URL of the resource in the OCI console. - -* `ocid` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the cloud VM cluster. - -* `ocpu_count` - The number of OCPU cores to enable on the cloud VM cluster. Only 1 decimal place is allowed for the fractional part. - -* `provisioning_state` - Azure resource provisioning state. - -* `scan_dns_name` - The FQDN of the DNS record for the SCAN IP addresses that are associated with the cloud VM cluster. - -* `scan_dns_record_id` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the DNS record for the SCAN IP addresses that are associated with the cloud VM cluster. - -* `scan_ip_ids` - A `scan_ip_ids` block as defined below. - -* `scan_listener_port_tcp` - The TCP Single Client Access Name (SCAN) port. The default port is 1521. - -* `scan_listener_port_tcp_ssl` - The TCPS Single Client Access Name (SCAN) port. The default port is 2484. - -* `shape` - The model name of the Exadata hardware running the cloud VM cluster. - -* `ssh_public_keys` - The public key portion of one or more key pairs used for SSH access to the cloud VM cluster. - -* `storage_size_in_gbs` - The storage allocation for the disk group, in gigabytes (GB). - -* `subnet_id` - The ID of the Azure Resource Manager subnet resource. - -* `subnet_ocid` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the subnet associated with the cloud VM cluster. - -* `system_data` - A `system_data` block as defined below. - -* `system_version` - Operating system version of the image. - -* `tags` - A mapping of tags assigned to the Cloud VM Cluster. - -* `time_created` - The date and time that the cloud VM cluster was created. - -* `time_zone` - The time zone of the cloud VM cluster. For details, see [Exadata Infrastructure Time Zones](https://docs.oracle.com/en-us/iaas/base-database/doc/manage-time-zone.html). - -* `vip_ods` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the virtual IP (VIP) addresses associated with the cloud VM cluster. The Cluster Ready Services (CRS) creates and maintains one VIP address for each node in the Exadata Cloud Service instance to enable failover. If one node fails, the VIP is reassigned to another active node in the cluster. **Note:** For a single-node DB system, this list is empty. - -* `vnet_id` - The ID to an Azure Resource Manager vnet resource. - -* `zone_id` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the zone the cloud VM cluster is associated with. - ---- - -A `data_collection_options` block exports the following: - -* `is_diagnostics_events_enabled` - Indicates whether diagnostic collection is enabled for the VM cluster/Cloud VM cluster/VMBM DBCS. Enabling diagnostic collection allows you to receive Events service notifications for guest VM issues. Diagnostic collection also allows Oracle to provide enhanced service and proactive support for your Exadata system. You can enable diagnostic collection during VM cluster/Cloud VM cluster provisioning. You can also disable or enable it at any time using the `UpdateVmCluster` or `updateCloudVmCluster` API. - -* `is_health_monitoring_enabled` - Indicates whether health monitoring is enabled for the VM cluster / Cloud VM cluster / VMBM DBCS. Enabling health monitoring allows Oracle to collect diagnostic data and share it with its operations and support personnel. You may also receive notifications for some events. Collecting health diagnostics enables Oracle to provide proactive support and enhanced service for your system. Optionally enable health monitoring while provisioning a system. You can also disable or enable health monitoring anytime using the `UpdateVmCluster`, `UpdateCloudVmCluster` or `updateDbsystem` API. - -* `is_incident_logs_enabled` - Indicates whether incident logs and trace collection are enabled for the VM cluster / Cloud VM cluster / VMBM DBCS. Enabling incident logs collection allows Oracle to receive Events service notifications for guest VM issues, collect incident logs and traces, and use them to diagnose issues and resolve them. Optionally enable incident logs collection while provisioning a system. You can also disable or enable incident logs collection anytime using the `UpdateVmCluster`, `updateCloudVmCluster` or `updateDbsystem` API. - ---- - -A `db_plans` block exports the following: - -* `db_name` - The database name. For the default `DbPlan`, the `dbName` is `default`. - -* `flash_cache_limit` - The flash cache limit for this database. This value is internally configured based on the share value assigned to the database. - -* `share` - The relative priority of this database. - ---- - -A `iorm_config_cache` block exports the following: - -* `db_plans` - A `db_plans` block as defined above. - -* `lifecycle_details` - Additional information about the current `lifecycleState`. - -* `lifecycle_state` - The current state of IORM configuration for the Exadata DB system. - -* `objective` - The current value for the IORM objective. The default is `AUTO`. - -## Timeouts - -The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: - -* `read` - (Defaults to 5 minutes) Used when retrieving the Cloud VM Cluster. \ No newline at end of file diff --git a/website/docs/d/oracledatabase_db_servers.html.markdown b/website/docs/d/oracledatabase_db_servers.html.markdown deleted file mode 100644 index defc14dd898e..000000000000 --- a/website/docs/d/oracledatabase_db_servers.html.markdown +++ /dev/null @@ -1,88 +0,0 @@ ---- -subcategory: "App Service" -layout: "azurerm" -page_title: "Azure Resource Manager: Data Source: azurerm_oracledatabase_db_servers" -description: |- - Gets information about an existing DB Server. ---- - -# Data Source: azurerm_oracledatabase_db_servers - -Use this data source to access information about an existing DB Server. - -## Example Usage - -```hcl -data "azurerm_oracledatabase_db_servers" "example" { - resource_group_name = "existing" - cloud_exadata_infrastructure_name = "existing" -} - -output "id" { - value = data.azurerm_oracledatabase_db_servers.example.id -} -``` - -## Arguments Reference - -The following arguments are supported: - -* `cloud_exadata_infrastructure_name` - (Required) The name of the ExadataInfrastructure. - -* `resource_group_name` - (Required) The name of the Resource Group where the DB Server exists. - -## Attributes Reference - -In addition to the Arguments listed above - the following Attributes are exported: - -* `id` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the Exacc Db server. - -* `db_servers` - A `db_servers` block as defined below. - ---- - -A `db_servers` block exports the following: - -* `autonomous_virtual_machine_ds` - The list of [OCIDs](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the Autonomous Virtual Machines associated with the Db server. - -* `autonomous_vm_cluster_ids` - The list of [OCIDs](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the Autonomous VM Clusters associated with the Db server. - -* `compartment_id` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the compartment. - -* `cpu_core_count` - The number of CPU cores enabled on the Db server. - -* `db_node_ids` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the Db nodes associated with the Db server. - -* `db_node_storage_size_in_gbs` - The allocated local node storage in GBs on the Db server. - -* `display_name` - The user-friendly name for the Db server. The name does not need to be unique. - -* `exadata_infrastructure_id` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the Exadata infrastructure. - -* `lifecycle_details` - Additional information about the current lifecycle state. - -* `lifecycle_state` - The current state of the DB server. - -* `max_cpu_count` - The total number of CPU cores available. - -* `max_db_node_storage_in_gbs` -The total local node storage available in GBs. - -* `max_memory_in_gbs` - The total memory available in GBs. - -* `memory_size_in_gbs` - The allocated memory in GBs on the Db server. - -* `ocid` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the DB server. - -* `provisioning_state` - DbServer provisioning state. - -* `shape` - The shape of the Db server. The shape determines the amount of CPU, storage, and memory resources available. - -* `time_created` - The date and time that the Db Server was created. - -* `vm_cluster_ids` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the VM Clusters associated with the Db server. - -## Timeouts - -The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: - -* `read` - (Defaults to 5 minutes) Used when retrieving the DB Server. \ No newline at end of file diff --git a/website/docs/d/oracledatabase_exadata_infrastructure.html.markdown b/website/docs/d/oracledatabase_exadata_infrastructure.html.markdown deleted file mode 100644 index 293b354eae61..000000000000 --- a/website/docs/d/oracledatabase_exadata_infrastructure.html.markdown +++ /dev/null @@ -1,152 +0,0 @@ ---- -subcategory: "App Service" -layout: "azurerm" -page_title: "Azure Resource Manager: Data Source: azurerm_oracledatabase_exadata_infrastructure" -description: |- - Gets information about an existing Exadata Infrastructure. ---- - -# Data Source: azurerm_oracledatabase_exadata_infrastructure - -Use this data source to access information about an existing Exadata Infrastructure. - -## Example Usage - -```hcl -data "azurerm_oracledatabase_exadata_infrastructure" "example" { - name = "existing" - resource_group_name = "existing" -} - -output "id" { - value = data.azurerm_oracledatabase_exadata_infrastructure.example.id -} -``` - -## Arguments Reference - -The following arguments are supported: - -* `name` - (Required) The name of this Exadata Infrastructure. - -* `resource_group_name` - (Required) The name of the Resource Group where the Exadata Infrastructure exists. - -## Attributes Reference - -In addition to the Arguments listed above - the following Attributes are exported: - -* `id` - The ID of the Exadata Infrastructure. - -* `activated_storage_count` - The requested number of additional storage servers activated for the Exadata infrastructure. - -* `additional_storage_count` - The requested number of additional storage servers for the Exadata infrastructure. - -* `available_storage_size_in_gbs` - The available storage can be allocated to the cloud Exadata infrastructure resource, in gigabytes (GB). - -* `compute_count` - The number of compute servers for the cloud Exadata infrastructure. - -* `cpu_count` - The total number of CPU cores allocated. - -* `customer_contacts` - A `customer_contacts` block as defined below. - -* `data_storage_size_in_tbs` - Size, in terabytes, of the DATA disk group. - -* `db_node_storage_size_in_gbs` - The local node storage allocated in GBs. - -* `db_server_version` - The software version of the database servers (dom0) in the cloud Exadata infrastructure. Example: 20.1.15 - -* `display_name` - The user-friendly name for the cloud Exadata infrastructure resource. The name does not need to be unique. - -* `estimated_patching_time` - A `estimated_patching_time` block as defined below. - -* `last_maintenance_run_id` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the last maintenance run. - -* `lifecycle_details` - Additional information about the current lifecycle state. - -* `lifecycle_state` - CloudExadataInfrastructure lifecycle state. - -* `location` - The Azure Region where the Exadata Infrastructure exists. - -* `maintenance_window` - A `maintenance_window` block as defined below. - -* `max_cpu_count` - The total number of CPU cores available. - -* `max_data_storage_in_tbs` - The total available DATA disk group size. - -* `max_db_node_storage_size_in_gbs` - The total local node storage available in GBs. - -* `max_memory_in_gbs` - The total memory available in GBs. - -* `memory_size_in_gbs` - The memory allocated in GBs. - -* `monthly_db_server_version` - The monthly software version of the database servers (dom0) in the cloud Exadata infrastructure. Example: 20.1.15 - -* `monthly_storage_server_version` - The monthly software version of the storage servers (cells) in the cloud Exadata infrastructure. Example: 20.1.15 - -* `next_maintenance_run_id` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the next maintenance run. - -* `oci_url` - The URL of the resource in the OCI console. - -* `ocid` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the Exadata infrastructure. - -* `provisioning_state` - CloudExadataInfrastructure provisioning state - -* `shape` - The model name of the cloud Exadata infrastructure resource. - -* `storage_count` - The number of storage servers for the cloud Exadata infrastructure. - -* `storage_server_version` - The software version of the storage servers (cells) in the Exadata infrastructure. Example: 20.1.15 - -* `system_data` - A `system_data` block as defined below. - -* `tags` - A mapping of tags assigned to the Exadata Infrastructure. - -* `time_created` - The date and time the cloud Exadata infrastructure resource was created. - -* `total_storage_size_in_gbs` - The total storage allocated to the cloud Exadata infrastructure resource, in gigabytes (GB). - -* `zones` - The Exadata infrastructure Azure zones. - ---- - -A `estimated_patching_time` block exports the following: - -* `estimated_db_server_patching_time` - The estimated time required in minutes for database server patching. - -* `estimated_network_switches_patching_time` - The estimated time required in minutes for network switch patching. - -* `estimated_storage_server_patching_time` - The estimated time required in minutes for storage server patching. - -* `total_estimated_patching_time` - The estimated total time required in minutes for all patching operations. - ---- - -A `maintenance_window` block exports the following: - -* `custom_action_timeout_in_mins` - Determines the amount of time the system will wait before the start of each database server patching operation. Custom action timeout is in minutes and valid value is between 15 to 120 (inclusive). - -* `days_of_week` - Days during the week when maintenance should be performed. - -* `hours_of_day` - The window of hours during the day when maintenance should be performed. The window is a 4 hour slot. Valid values are: 0 - represents time slot 0:00 - 3:59 UTC - 4 - represents time slot 4:00 - 7:59 UTC - 8 - represents time slot 8:00 - 11:59 UTC - 12 - represents time slot 12:00 - 15:59 UTC - 16 - represents time slot 16:00 - 19:59 UTC - 20 - represents time slot 20:00 - 23:59 UTC - -* `is_custom_action_timeout_enabled` - If true, enables the configuration of a custom action timeout (waiting period) between database server patching operations. - -* `is_monthly_patching_enabled` - If true, enables the monthly patching option. - -* `lead_time_in_weeks` - Lead time window allows user to set a lead time to prepare for a down time. The lead time is in weeks and valid value is between 1 to 4. - -* `months` - A `months` block as defined below. - -* `patching_mode` - Cloud Exadata infrastructure node patching method, either "ROLLING" or "NONROLLING". - -* `preference` - The maintenance window scheduling preference. - -* `weeks_of_month` - Weeks during the month when maintenance should be performed. Weeks start on the 1st, 8th, 15th, and 22nd days of the month, and have a duration of 7 days. Weeks start and end based on calendar dates, not days of the week. For example, to allow maintenance during the 2nd week of the month (from the 8th day to the 14th day of the month), use the value 2. Maintenance cannot be scheduled for the fifth week of months that contain more than 28 days. Note that this parameter works in conjunction with the daysOfWeek and hoursOfDay parameters to allow you to specify specific days of the week and hours that maintenance will be performed. - ---- - -## Timeouts - -The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: - -* `read` - (Defaults to 5 minutes) Used when retrieving the Exadata Infrastructure. \ No newline at end of file diff --git a/website/docs/r/oracledatabase_autonomous_database_regular.html.markdown b/website/docs/r/oracle_autonomous_database_regular.html.markdown similarity index 94% rename from website/docs/r/oracledatabase_autonomous_database_regular.html.markdown rename to website/docs/r/oracle_autonomous_database_regular.html.markdown index e9e2f09fbe53..cbb8aa01cf26 100644 --- a/website/docs/r/oracledatabase_autonomous_database_regular.html.markdown +++ b/website/docs/r/oracle_autonomous_database_regular.html.markdown @@ -1,19 +1,19 @@ --- subcategory: "App Service" layout: "azurerm" -page_title: "Azure Resource Manager: azurerm_oracledatabase_autonomous_database_regular" +page_title: "Azure Resource Manager: azurerm_oracle_autonomous_database" description: |- Manages a Autonomous Databases. --- -# azurerm_oracledatabase_autonomous_database_regular +# azurerm_oracle_autonomous_database Manages a Autonomous Databases. ## Example Usage ```hcl -resource "azurerm_oracledatabase_autonomous_database_regular" "example" { +resource "azurerm_oracle_autonomous_database" "example" { name = "example" resource_group_name = "example" location = "West Europe" @@ -109,5 +109,5 @@ The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/l Autonomous Databases can be imported using the `resource id`, e.g. ```shell -terraform import azurerm_oracledatabase_autonomous_database_regular.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup/providers/Oracle.Database/autonomousDatabases/autonomousDatabases1 +terraform import azurerm_oracle_autonomous_database.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup/providers/Oracle.Database/autonomousDatabases/autonomousDatabases1 ``` \ No newline at end of file diff --git a/website/docs/r/oracledatabase_cloud_vm_cluster.html.markdown b/website/docs/r/oracledatabase_cloud_vm_cluster.html.markdown deleted file mode 100644 index 3193330527ab..000000000000 --- a/website/docs/r/oracledatabase_cloud_vm_cluster.html.markdown +++ /dev/null @@ -1,165 +0,0 @@ ---- -subcategory: "App Service" -layout: "azurerm" -page_title: "Azure Resource Manager: azurerm_oracledatabase_cloud_vm_cluster" -description: |- - Manages a Cloud VM Cluster. ---- - -# azurerm_oracledatabase_cloud_vm_cluster - -Manages a Cloud VM Cluster. - -## Example Usage - -```hcl -resource "azurerm_resource_group" "example" { - name = "example-resources" - location = "West Europe" -} - -resource "azurerm_oracledatabase_exadata_infrastructure" "example" { - name = "example-exadata-infrastructure" - display_name = "example-exadata-infrastructure" - location = azurerm_resource_group.example.location - resource_group_name = azurerm_resource_group.example.name - shape = "Exadata.X9M" - storage_count = "3" - compute_count = "2" - zones = ["3"] -} - -resource "azurerm_virtual_network" "example" { - name = "example-virtual-network" - address_space = ["10.0.0.0/16"] - location = azurerm_resource_group.example.location - resource_group_name = azurerm_resource_group.example.name -} - -resource "azurerm_subnet" "example" { - name = "example-subnet" - resource_group_name = azurerm_resource_group.example.name - virtual_network_name = azurerm_virtual_network.example.name - address_prefixes = ["10.0.1.0/24"] - - delegation { - name = "delegation" - - service_delegation { - actions = [ - "Microsoft.Network/networkinterfaces/*", - "Microsoft.Network/virtualNetworks/subnets/join/action", - ] - name = "Oracle.Database/networkAttachments" - } - } -} - -data "azurerm_oracledatabase_db_servers" "example" { - resource_group_name = azurerm_resource_group.example.name - cloud_exadata_infrastructure_name = azurerm_oracledatabase_exadata_infrastructure.example.name -} - -resource "azurerm_oracledatabase_cloud_vm_cluster" "example" { - name = "example-cloud-vm-cluster" - resource_group_name = azurerm_resource_group.example.name - location = azurerm_resource_group.example.location - gi_version = "23.0.0.0" - vnet_id = azurerm_virtual_network.example.id - license_model = "BringYourOwnLicense" - db_servers = [for obj in data.azurerm_oracledatabase_db_servers.example.db_servers : obj.ocid] - ssh_public_keys = [ file("~/.ssh/id_rsa.pub") ] - display_name = "example-cloud-vm-cluster" - cloud_exadata_infrastructure_id = azurerm_oracledatabase_exadata_infrastructure.example.id - cpu_core_count = 2 - hostname = "hostname" - subnet_id = azurerm_subnet.example.id -} -``` - -## Arguments Reference - -The following arguments are supported: - -* `cloud_exadata_infrastructure_id` - (Required) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the cloud Exadata infrastructure. - -* `cpu_core_count` - (Required) The number of CPU cores enabled on the cloud VM cluster. - -* `db_servers` - (Required) The list of DB servers. - -* `display_name` - (Required) The user-friendly name for the cloud VM cluster. The name does not need to be unique.. - -* `gi_version` - (Required) A valid Oracle Grid Infrastructure (GI) software version. - -* `hostname` - (Required) The hostname for the cloud VM cluster. - -* `license_model` - (Required) The Oracle license model that applies to the cloud VM cluster, either `BringYourOwnLicense` or `LicenseIncluded`. - -* `location` - (Required) The Azure Region where the Cloud VM Cluster should exist. - -* `name` - (Required) The name which should be used for this Cloud VM Cluster. - -* `resource_group_name` - (Required) The name of the Resource Group where the Cloud VM Cluster should exist. - -* `ssh_public_keys` - (Required) The public key portion of one or more key pairs used for SSH access to the cloud VM cluster. - -* `subnet_id` - (Required) The ID of the subnet associated with the cloud VM cluster. - -* `vnet_id` - (Required) The ID of the vnet associated with the cloud VM cluster. - ---- - -* `backup_subnet_cidr` - (Optional) The backup subnet CIDR of the vnet associated with the cloud VM cluster.. - -* `cluster_name` - (Optional) The cluster name for cloud VM cluster. - -* `data_collection_options` - (Optional) A `data_collection_options` block as defined below. - -* `data_storage_percentage` - (Optional) The percentage assigned to DATA storage (user data and database files). The remaining percentage is assigned to RECO storage (database redo logs, archive logs, and recovery manager backups). Accepted values are 35, 40, 60 and 80. - -* `data_storage_size_in_tbs` - (Optional) The data disk group size to be allocated in TBs. - -* `db_node_storage_size_in_gbs` - (Optional) The local node storage to be allocated in GBs. - -* `is_local_backup_enabled` - (Optional) If true, database backup on local Exadata storage is configured for the cloud VM cluster. If false, database backup on local Exadata storage is not available in the cloud VM cluster. - -* `is_sparse_diskgroup_enabled` - (Optional) If true, the sparse disk group is configured for the cloud VM cluster. If false, the sparse disk group is not created. - -* `memory_size_in_gbs` - (Optional) The memory to be allocated in GBs. - -* `tags` - (Optional) A mapping of tags which should be assigned to the Cloud VM Cluster. - -* `time_zone` - (Optional) The time zone of the cloud VM cluster. For details, see [Exadata Infrastructure Time Zones](https://docs.cloud.oracle.com/iaas/Content/Database/References/timezones.htm). - ---- - -A `data_collection_options` block supports the following: - -* `is_diagnostics_events_enabled` - (Optional) Indicates whether diagnostic collection is enabled for the VM cluster/Cloud VM cluster/VMBM DBCS. Enabling diagnostic collection allows you to receive Events service notifications for guest VM issues. Diagnostic collection also allows Oracle to provide enhanced service and proactive support for your Exadata system. You can enable diagnostic collection during VM cluster/Cloud VM cluster provisioning. You can also disable or enable it at any time using the `UpdateVmCluster` or `updateCloudVmCluster` API. - -* `is_health_monitoring_enabled` - (Optional) Indicates whether health monitoring is enabled for the VM cluster / Cloud VM cluster / VMBM DBCS. Enabling health monitoring allows Oracle to collect diagnostic data and share it with its operations and support personnel. You may also receive notifications for some events. Collecting health diagnostics enables Oracle to provide proactive support and enhanced service for your system. Optionally enable health monitoring while provisioning a system. You can also disable or enable health monitoring anytime using the `UpdateVmCluster`, `UpdateCloudVmCluster` or `updateDbsystem` API. - -* `is_incident_logs_enabled` - (Optional) Indicates whether incident logs and trace collection are enabled for the VM cluster / Cloud VM cluster / VMBM DBCS. Enabling incident logs collection allows Oracle to receive Events service notifications for guest VM issues, collect incident logs and traces, and use them to diagnose issues and resolve them. Optionally enable incident logs collection while provisioning a system. You can also disable or enable incident logs collection anytime using the `UpdateVmCluster`, `updateCloudVmCluster` or `updateDbsystem` API. - -## Attributes Reference - -In addition to the Arguments listed above - the following Attributes are exported: - -* `id` - The ID of the Cloud VM Cluster. - -## Timeouts - -The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: - -* `create` - (Defaults to 30 minutes) Used when creating the Cloud VM Cluster. -* `read` - (Defaults to 5 minutes) Used when retrieving the Cloud VM Cluster. -* `update` - (Defaults to 30 minutes) Used when updating the Cloud VM Cluster. -* `delete` - (Defaults to 30 minutes) Used when deleting the Cloud VM Cluster. - -## Import - -Cloud VM Clusters can be imported using the `resource id`, e.g. - -```shell -terraform import azurerm_oracledatabase_cloud_vm_cluster.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup/providers/Oracle.Database/cloudVmClusters/cloudVmClusters1 -``` \ No newline at end of file diff --git a/website/docs/r/oracledatabase_exadata_infrastructure.html.markdown b/website/docs/r/oracledatabase_exadata_infrastructure.html.markdown deleted file mode 100644 index 416b9cd937c7..000000000000 --- a/website/docs/r/oracledatabase_exadata_infrastructure.html.markdown +++ /dev/null @@ -1,106 +0,0 @@ ---- -subcategory: "App Service" -layout: "azurerm" -page_title: "Azure Resource Manager: azurerm_oracledatabase_exadata_infrastructure" -description: |- - Manages a Exadata Infrastructure. ---- - -# azurerm_oracledatabase_exadata_infrastructure - -Manages a Exadata Infrastructure. - -## Example Usage - -```hcl -resource "azurerm_resource_group" "example" { - name = "example-resources" - location = "West Europe" -} - -resource "azurerm_oracledatabase_exadata_infrastructure" "example" { - name = "example-exadata-infra" - resource_group_name = azurerm_resource_group.example.name - location = azurerm_resource_group.example.location - zones = [ "1" ] - display_name = "example-exadata-infra" - storage_count = 3 - compute_count = 2 - shape = "Exadata.X9M" -} -``` - -## Arguments Reference - -The following arguments are supported: - -* `compute_count` - (Required) The number of compute servers for the cloud Exadata infrastructure. - -* `display_name` - (Required) The user-friendly name for the cloud Exadata infrastructure resource. The name does not need to be unique. - -* `location` - (Required) The Azure Region where the Exadata Infrastructure should exist. Changing this forces a new Exadata Infrastructure to be created. - -* `name` - (Required) The name which should be used for this Exadata Infrastructure. - -* `resource_group_name` - (Required) The name of the Resource Group where the Exadata Infrastructure should exist. - -* `shape` - (Required) The shape of the cloud Exadata infrastructure resource. - -* `storage_count` - (Required) The number of storage servers for the cloud Exadata infrastructure. - -* `zones` - (Required) CloudExadataInfrastructure zones. - ---- - -* `customer_contacts` - (Optional) The email address used by Oracle to send notifications regarding databases and infrastructure. - -* `maintenance_window` - (Optional) One or more `maintenance_window` blocks as defined below. - -* `tags` - (Optional) A mapping of tags which should be assigned to the Exadata Infrastructure. - ---- - -A `maintenance_window` block supports the following: - -* `custom_action_timeout_in_mins` - (Optional) Determines the amount of time the system will wait before the start of each database server patching operation. Custom action timeout is in minutes and valid value is between 15 to 120 (inclusive). - -* `days_of_week` - (Optional) Days during the week when maintenance should be performed. Valid values are: 0 - represents time slot 0:00 - 3:59 UTC - 4 - represents time slot 4:00 - 7:59 UTC - 8 - represents time slot 8:00 - 11:59 UTC - 12 - represents time slot 12:00 - 15:59 UTC - 16 - represents time slot 16:00 - 19:59 UTC - 20 - represents time slot 20:00 - 23:59 UTC - -* `hours_of_day` - (Optional) The window of hours during the day when maintenance should be performed. The window is a 4 hour slot. - -* `is_custom_action_timeout_enabled` - (Optional) If true, enables the configuration of a custom action timeout (waiting period) between database server patching operations. - -* `is_monthly_patching_enabled` - (Optional) If true, enables the monthly patching option. - -* `lead_time_in_weeks` - (Optional) Lead time window allows user to set a lead time to prepare for a down time. The lead time is in weeks and valid value is between 1 to 4. - -* `months` - (Optional) Months during the year when maintenance should be performed. - -* `patching_mode` - (Optional) Cloud Exadata infrastructure node patching method, either "ROLLING" or "NONROLLING". Default value is ROLLING. IMPORTANT: Non-rolling infrastructure patching involves system down time. See [Oracle-Managed Infrastructure Maintenance Updates](https://docs.cloud.oracle.com/iaas/Content/Database/Concepts/examaintenance.htm#Oracle) for more information. - -* `preference` - (Optional) The maintenance window scheduling preference. - -* `weeks_of_month` - (Optional) Weeks during the month when maintenance should be performed. Weeks start on the 1st, 8th, 15th, and 22nd days of the month, and have a duration of 7 days. Weeks start and end based on calendar dates, not days of the week. For example, to allow maintenance during the 2nd week of the month (from the 8th day to the 14th day of the month), use the value 2. Maintenance cannot be scheduled for the fifth week of months that contain more than 28 days. Note that this parameter works in conjunction with the daysOfWeek and hoursOfDay parameters to allow you to specify specific days of the week and hours that maintenance will be performed. - -## Attributes Reference - -In addition to the Arguments listed above - the following Attributes are exported: - -* `id` - The ID of the Exadata Infrastructure. - -## Timeouts - -The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: - -* `create` - (Defaults to 30 minutes) Used when creating the Exadata Infrastructure. -* `read` - (Defaults to 5 minutes) Used when retrieving the Exadata Infrastructure. -* `update` - (Defaults to 30 minutes) Used when updating the Exadata Infrastructure. -* `delete` - (Defaults to 30 minutes) Used when deleting the Exadata Infrastructure. - -## Import - -Exadata Infrastructures can be imported using the `resource id`, e.g. - -```shell -terraform import azurerm_oracledatabase_exadata_infrastructure.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup/providers/Oracle.Database/cloudExadataInfrastructures/cloudExadataInfrastructures1 -``` \ No newline at end of file From e4ef87f7470badce1874a32a5dd872bc8f0a2f0c Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Thu, 17 Oct 2024 22:41:34 +0100 Subject: [PATCH 09/43] * Update. --- .teamcity/components/generated/services.kt | 1 - website/allowed-subcategories | 1 - 2 files changed, 2 deletions(-) diff --git a/.teamcity/components/generated/services.kt b/.teamcity/components/generated/services.kt index 0c0a2a27f8f5..a84ce744aaa8 100644 --- a/.teamcity/components/generated/services.kt +++ b/.teamcity/components/generated/services.kt @@ -8,7 +8,6 @@ var services = mapOf( "advisor" to "Advisor", "analysisservices" to "Analysis Services", "appconfiguration" to "App Configuration", - "oracledatabase" to "App Service", "appservice" to "AppService", "applicationinsights" to "Application Insights", "arcresourcebridge" to "Arc Resource Bridge", diff --git a/website/allowed-subcategories b/website/allowed-subcategories index 97d447f0722a..f2245db4b136 100644 --- a/website/allowed-subcategories +++ b/website/allowed-subcategories @@ -4,7 +4,6 @@ Active Directory Domain Services Advisor Analysis Services App Configuration -App Service App Service (Web Apps) Application Insights Arc Resource Bridge From 7cf80a421d97de9e951eedb1b3a8543114d9e186 Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Thu, 17 Oct 2024 23:14:40 +0100 Subject: [PATCH 10/43] * Data source changes. --- ...autonomous_database_regular_data_source.go | 430 +++++++++--------- ...omous_database_regular_data_source_test.go | 2 +- .../autonomous_database_regular_resource.go | 12 +- ...tonomous_database_regular_resource_test.go | 117 ++--- .../validate/autonomous_database_regular.go | 35 ++ ..._autonomous_database_regular.html.markdown | 18 +- ..._autonomous_database_regular.html.markdown | 46 +- 7 files changed, 350 insertions(+), 310 deletions(-) create mode 100644 internal/services/oracle/validate/autonomous_database_regular.go diff --git a/internal/services/oracle/autonomous_database_regular_data_source.go b/internal/services/oracle/autonomous_database_regular_data_source.go index 0d404621d8fd..adc54796cfc5 100644 --- a/internal/services/oracle/autonomous_database_regular_data_source.go +++ b/internal/services/oracle/autonomous_database_regular_data_source.go @@ -9,85 +9,86 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases" - "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracle/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) type AutonomousDatabaseRegularDataSource struct{} type AutonomousDatabaseRegularDataSourceModel struct { - Location string `tfschema:"location"` - Name string `tfschema:"name"` - Type string `tfschema:"type"` - Tags map[string]interface{} `tfschema:"tags"` + Location string `tfschema:"location"` + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Tags map[string]string `tfschema:"tags"` // AutonomousDatabaseProperties - ActualUsedDataStorageSizeInTbs float64 `tfschema:"actual_used_data_storage_size_in_tbs"` - AllocatedStorageSizeInTbs float64 `tfschema:"allocated_storage_size_in_tbs"` - AutonomousDatabaseId string `tfschema:"autonomous_database_id"` - AvailableUpgradeVersions []string `tfschema:"available_upgrade_versions"` - BackupRetentionPeriodInDays int64 `tfschema:"backup_retention_period_in_days"` - CharacterSet string `tfschema:"character_set"` - ComputeCount float64 `tfschema:"compute_count"` - CpuCoreCount int64 `tfschema:"cpu_core_count"` - DataStorageSizeInGbs int64 `tfschema:"data_storage_size_in_gbs"` - DataStorageSizeInTbs int64 `tfschema:"data_storage_size_in_tbs"` - DbVersion string `tfschema:"db_version"` - DisplayName string `tfschema:"display_name"` - FailedDataRecoveryInSeconds int64 `tfschema:"failed_data_recovery_in_seconds"` - InMemoryAreaInGbs int64 `tfschema:"in_memory_area_in_gbs"` - IsAutoScalingEnabled bool `tfschema:"is_auto_scaling_enabled"` - IsAutoScalingForStorageEnabled bool `tfschema:"is_auto_scaling_for_storage_enabled"` - IsLocalDataGuardEnabled bool `tfschema:"is_local_data_guard_enabled"` - IsMtlsConnectionRequired bool `tfschema:"is_mtls_connection_required"` - IsPreview bool `tfschema:"is_preview"` - IsPreviewVersionWithServiceTermsAccepted bool `tfschema:"is_preview_version_with_service_terms_accepted"` - IsRemoteDataGuardEnabled bool `tfschema:"is_remote_data_guard_enabled"` - LifecycleDetails string `tfschema:"lifecycle_details"` - LocalAdgAutoFailoverMaxDataLossLimit int64 `tfschema:"local_adg_auto_failover_max_data_loss_limit"` - MemoryPerOracleComputeUnitInGbs int64 `tfschema:"memory_per_oracle_compute_unit_in_gbs"` - NcharacterSet string `tfschema:"ncharacter_set"` - NextLongTermBackupTimeStamp string `tfschema:"next_long_term_backup_time_stamp"` - OciUrl string `tfschema:"oci_url"` - Ocid string `tfschema:"ocid"` - PeerDbId string `tfschema:"peer_db_id"` - PeerDbIds []string `tfschema:"peer_db_ids"` - PrivateEndpoint string `tfschema:"private_endpoint"` - PrivateEndpointIP string `tfschema:"private_endpoint_ip"` - PrivateEndpointLabel string `tfschema:"private_endpoint_label"` - ProvisionableCPUs []int64 `tfschema:"provisionable_cpus"` - ServiceConsoleUrl string `tfschema:"service_console_url"` - SqlWebDeveloperUrl string `tfschema:"sql_web_developer_url"` - SubnetId string `tfschema:"subnet_id"` - SupportedRegionsToCloneTo []string `tfschema:"supported_regions_to_clone_to"` - TimeCreated string `tfschema:"time_created"` - TimeDataGuardRoleChanged string `tfschema:"time_data_guard_role_changed"` - TimeDeletionOfFreeAutonomousDatabase string `tfschema:"time_deletion_of_free_autonomous_database"` - TimeLocalDataGuardEnabled string `tfschema:"time_local_data_guard_enabled"` - TimeMaintenanceBegin string `tfschema:"time_maintenance_begin"` - TimeMaintenanceEnd string `tfschema:"time_maintenance_end"` - TimeOfLastFailover string `tfschema:"time_of_last_failover"` - TimeOfLastRefresh string `tfschema:"time_of_last_refresh"` - TimeOfLastRefreshPoint string `tfschema:"time_of_last_refresh_point"` - TimeOfLastSwitchover string `tfschema:"time_of_last_switchover"` - TimeReclamationOfFreeAutonomousDatabase string `tfschema:"time_reclamation_of_free_autonomous_database"` - UsedDataStorageSizeInGbs int64 `tfschema:"used_data_storage_size_in_gbs"` - UsedDataStorageSizeInTbs int64 `tfschema:"used_data_storage_size_in_tbs"` - VnetId string `tfschema:"vnet_id"` - WhitelistedIPs []string `tfschema:"whitelisted_ips"` + ActualUsedDataStorageSizeInTbs float64 `tfschema:"actual_used_data_storage_size_in_tbs"` + AllocatedStorageSizeInTbs float64 `tfschema:"allocated_storage_size_in_tbs"` + AutonomousDatabaseId string `tfschema:"autonomous_database_id"` + AutoScalingEnabled bool `tfschema:"auto_scaling_enabled"` + AutoScalingForStorageEnabled bool `tfschema:"auto_scaling_for_storage_enabled"` + AvailableUpgradeVersions []string `tfschema:"available_upgrade_versions"` + BackupRetentionPeriodInDays int64 `tfschema:"backup_retention_period_in_days"` + CharacterSet string `tfschema:"character_set"` + ComputeCount float64 `tfschema:"compute_count"` + CpuCoreCount int64 `tfschema:"cpu_core_count"` + DataStorageSizeInGbs int64 `tfschema:"data_storage_size_in_gbs"` + DataStorageSizeInTbs int64 `tfschema:"data_storage_size_in_tbs"` + DbVersion string `tfschema:"db_version"` + DisplayName string `tfschema:"display_name"` + FailedDataRecoveryInSeconds int64 `tfschema:"failed_data_recovery_in_seconds"` + LifecycleDetails string `tfschema:"lifecycle_details"` + LocalAdgAutoFailoverMaxDataLossLimit int64 `tfschema:"local_adg_auto_failover_max_data_loss_limit"` + LocalDataGuardEnabled bool `tfschema:"local_data_guard_enabled"` + MemoryAreaInGbs int64 `tfschema:"in_memory_area_in_gbs"` + MemoryPerOracleComputeUnitInGbs int64 `tfschema:"memory_per_oracle_compute_unit_in_gbs"` + MtlsConnectionRequired bool `tfschema:"mtls_connection_required"` + NcharacterSet string `tfschema:"ncharacter_set"` + NextLongTermBackupTimeStamp string `tfschema:"next_long_term_backup_time_stamp"` + Ocid string `tfschema:"ocid"` + OciUrl string `tfschema:"oci_url"` + PeerDbId string `tfschema:"peer_db_id"` + PeerDbIds []string `tfschema:"peer_db_ids"` + Preview bool `tfschema:"preview"` + PreviewVersionWithServiceTermsAccepted bool `tfschema:"preview_version_with_service_terms_accepted"` + PrivateEndpoint string `tfschema:"private_endpoint"` + PrivateEndpointIP string `tfschema:"private_endpoint_ip"` + PrivateEndpointLabel string `tfschema:"private_endpoint_label"` + ProvisionableCPUs []int64 `tfschema:"provisionable_cpus"` + RemoteDataGuardEnabled bool `tfschema:"remote_data_guard_enabled"` + ServiceConsoleUrl string `tfschema:"service_console_url"` + SqlWebDeveloperUrl string `tfschema:"sql_web_developer_url"` + SubnetId string `tfschema:"subnet_id"` + SupportedRegionsToCloneTo []string `tfschema:"supported_regions_to_clone_to"` + TimeCreated string `tfschema:"time_created"` + TimeDataGuardRoleChanged string `tfschema:"time_data_guard_role_changed"` + TimeDeletionOfFreeAutonomousDatabase string `tfschema:"time_deletion_of_free_autonomous_database"` + TimeLocalDataGuardEnabled string `tfschema:"time_local_data_guard_enabled"` + TimeMaintenanceBegin string `tfschema:"time_maintenance_begin"` + TimeMaintenanceEnd string `tfschema:"time_maintenance_end"` + TimeOfLastFailover string `tfschema:"time_of_last_failover"` + TimeOfLastRefresh string `tfschema:"time_of_last_refresh"` + TimeOfLastRefreshPoint string `tfschema:"time_of_last_refresh_point"` + TimeOfLastSwitchover string `tfschema:"time_of_last_switchover"` + TimeReclamationOfFreeAutonomousDatabase string `tfschema:"time_reclamation_of_free_autonomous_database"` + UsedDataStorageSizeInGbs int64 `tfschema:"used_data_storage_size_in_gbs"` + UsedDataStorageSizeInTbs int64 `tfschema:"used_data_storage_size_in_tbs"` + VnetId string `tfschema:"vnet_id"` + WhitelistedIPs []string `tfschema:"whitelisted_ips"` } func (d AutonomousDatabaseRegularDataSource) Arguments() map[string]*pluginsdk.Schema { return map[string]*pluginsdk.Schema{ "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + "name": { - Type: pluginsdk.TypeString, - Required: true, + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validate.AutonomousDatabaseName, }, } } @@ -95,59 +96,33 @@ func (d AutonomousDatabaseRegularDataSource) Arguments() map[string]*pluginsdk.S func (d AutonomousDatabaseRegularDataSource) Attributes() map[string]*pluginsdk.Schema { return map[string]*pluginsdk.Schema{ "location": commonschema.LocationComputed(), - "type": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "tags": commonschema.TagsDataSource(), - - // SystemData - "system_data": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "created_by": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "created_by_type": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "created_at": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "last_modified_by": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "last_modified_by_type": { - Type: pluginsdk.TypeString, - Computed: true, - }, - "last_modified_at": { - Type: pluginsdk.TypeString, - Computed: true, - }, - }, - }, - }, // AutonomousDatabaseProperties "actual_used_data_storage_size_in_tbs": { Type: pluginsdk.TypeFloat, Computed: true, }, + "allocated_storage_size_in_tbs": { Type: pluginsdk.TypeFloat, Computed: true, }, + + "auto_scaling_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + "auto_scaling_for_storage_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "autonomous_database_id": { Type: pluginsdk.TypeString, Computed: true, }, + "available_upgrade_versions": { Type: pluginsdk.TypeList, Computed: true, @@ -155,110 +130,127 @@ func (d AutonomousDatabaseRegularDataSource) Attributes() map[string]*pluginsdk. Type: pluginsdk.TypeString, }, }, + "backup_retention_period_in_days": { Type: pluginsdk.TypeInt, Computed: true, }, + "character_set": { Type: pluginsdk.TypeString, Computed: true, }, + "compute_count": { Type: pluginsdk.TypeFloat, Computed: true, }, + "cpu_core_count": { Type: pluginsdk.TypeInt, Computed: true, }, - "db_node_storage_size_in_gbs": { + + "data_storage_size_in_gbs": { Type: pluginsdk.TypeInt, Computed: true, }, - "data_storage_size_in_gbs": { + + "data_storage_size_in_tbs": { Type: pluginsdk.TypeInt, Computed: true, }, - "data_storage_size_in_tbs": { + + "db_node_storage_size_in_gbs": { Type: pluginsdk.TypeInt, Computed: true, }, + "db_version": { Type: pluginsdk.TypeString, Computed: true, }, + "display_name": { Type: pluginsdk.TypeString, Computed: true, }, + "failed_data_recovery_in_seconds": { Type: pluginsdk.TypeInt, Computed: true, }, + "in_memory_area_in_gbs": { Type: pluginsdk.TypeInt, Computed: true, }, - "is_auto_scaling_enabled": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - "is_auto_scaling_for_storage_enabled": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - "is_local_data_guard_enabled": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - "is_mtls_connection_required": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - "is_preview": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - "is_preview_version_with_service_terms_accepted": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - "is_remote_data_guard_enabled": { - Type: pluginsdk.TypeBool, - Computed: true, - }, + "lifecycle_details": { Type: pluginsdk.TypeString, Computed: true, }, + "local_adg_auto_failover_max_data_loss_limit": { Type: pluginsdk.TypeInt, Computed: true, }, + + "local_data_guard_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "memory_per_oracle_compute_unit_in_gbs": { Type: pluginsdk.TypeInt, Computed: true, }, + + "mtls_connection_required": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "ncharacter_set": { Type: pluginsdk.TypeString, Computed: true, }, + "next_long_term_backup_time_stamp": { Type: pluginsdk.TypeString, Computed: true, }, + "oci_url": { Type: pluginsdk.TypeString, Computed: true, }, + "ocid": { Type: pluginsdk.TypeString, Computed: true, }, + + "preview": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + "preview_version_with_service_terms_accepted": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + "remote_data_guard_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "peer_db_id": { Type: pluginsdk.TypeString, Computed: true, }, + "peer_db_ids": { Type: pluginsdk.TypeList, Computed: true, @@ -266,18 +258,22 @@ func (d AutonomousDatabaseRegularDataSource) Attributes() map[string]*pluginsdk. Type: pluginsdk.TypeString, }, }, + "private_endpoint": { Type: pluginsdk.TypeString, Computed: true, }, + "private_endpoint_ip": { Type: pluginsdk.TypeString, Computed: true, }, + "private_endpoint_label": { Type: pluginsdk.TypeString, Computed: true, }, + "provisionable_cpus": { Type: pluginsdk.TypeList, Computed: true, @@ -285,18 +281,22 @@ func (d AutonomousDatabaseRegularDataSource) Attributes() map[string]*pluginsdk. Type: pluginsdk.TypeInt, }, }, + "service_console_url": { Type: pluginsdk.TypeString, Computed: true, }, + "sql_web_developer_url": { Type: pluginsdk.TypeString, Computed: true, }, + "subnet_id": { Type: pluginsdk.TypeString, Computed: true, }, + "supported_regions_to_clone_to": { Type: pluginsdk.TypeList, Computed: true, @@ -304,62 +304,77 @@ func (d AutonomousDatabaseRegularDataSource) Attributes() map[string]*pluginsdk. Type: pluginsdk.TypeInt, }, }, + "time_created": { Type: pluginsdk.TypeString, Computed: true, }, + "time_data_guard_role_changed": { Type: pluginsdk.TypeString, Computed: true, }, + "time_deletion_of_free_autonomous_database": { Type: pluginsdk.TypeString, Computed: true, }, + "time_local_data_guard_enabled": { Type: pluginsdk.TypeString, Computed: true, }, + "time_maintenance_begin": { Type: pluginsdk.TypeString, Computed: true, }, + "time_maintenance_end": { Type: pluginsdk.TypeString, Computed: true, }, + "time_of_last_failover": { Type: pluginsdk.TypeString, Computed: true, }, + "time_of_last_refresh": { Type: pluginsdk.TypeString, Computed: true, }, + "time_of_last_refresh_point": { Type: pluginsdk.TypeString, Computed: true, }, + "time_of_last_switchover": { Type: pluginsdk.TypeString, Computed: true, }, + "time_reclamation_of_free_autonomous_database": { Type: pluginsdk.TypeString, Computed: true, }, + "used_data_storage_size_in_gbs": { Type: pluginsdk.TypeInt, Computed: true, }, + "used_data_storage_size_in_tbs": { Type: pluginsdk.TypeInt, Computed: true, }, + "vnet_id": { Type: pluginsdk.TypeString, Computed: true, }, + "whitelisted_ips": { Type: pluginsdk.TypeList, Computed: true, @@ -367,11 +382,13 @@ func (d AutonomousDatabaseRegularDataSource) Attributes() map[string]*pluginsdk. Type: pluginsdk.TypeInt, }, }, + + "tags": commonschema.TagsDataSource(), } } func (d AutonomousDatabaseRegularDataSource) ModelObject() interface{} { - return nil + return &AutonomousDatabaseRegularDataSourceModel{} } func (d AutonomousDatabaseRegularDataSource) ResourceType() string { @@ -389,9 +406,12 @@ func (d AutonomousDatabaseRegularDataSource) Read() sdk.ResourceFunc { client := metadata.Client.Oracle.OracleClient.AutonomousDatabases subscriptionId := metadata.Client.Account.SubscriptionId - id := autonomousdatabases.NewAutonomousDatabaseID(subscriptionId, - metadata.ResourceData.Get("resource_group_name").(string), - metadata.ResourceData.Get("name").(string)) + var state AutonomousDatabaseRegularDataSourceModel + if err := metadata.Decode(&state); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + id := autonomousdatabases.NewAutonomousDatabaseID(subscriptionId, state.ResourceGroupName, state.Name) resp, err := client.Get(ctx, id) if err != nil { @@ -402,88 +422,70 @@ func (d AutonomousDatabaseRegularDataSource) Read() sdk.ResourceFunc { } if model := resp.Model; model != nil { + state.Location = location.Normalize(model.Location) + state.Tags = pointer.From(model.Tags) + if props := model.Properties; props != nil { + adbsProps := props.AutonomousDatabaseBaseProperties() - err := metadata.ResourceData.Set("location", location.NormalizeNilable(&model.Location)) - if err != nil { - return err - } - - var output AutonomousDatabaseRegularDataSourceModel - prop := model.Properties - - output = AutonomousDatabaseRegularDataSourceModel{} - - if prop != nil { - switch adbsPropModel := prop.(type) { - case autonomousdatabases.AutonomousDatabaseProperties: - output = AutonomousDatabaseRegularDataSourceModel{ - ActualUsedDataStorageSizeInTbs: pointer.From(adbsPropModel.ActualUsedDataStorageSizeInTbs), - AllocatedStorageSizeInTbs: pointer.From(adbsPropModel.AllocatedStorageSizeInTbs), - AutonomousDatabaseId: pointer.From(adbsPropModel.AutonomousDatabaseId), - AvailableUpgradeVersions: pointer.From(adbsPropModel.AvailableUpgradeVersions), - BackupRetentionPeriodInDays: pointer.From(adbsPropModel.BackupRetentionPeriodInDays), - CharacterSet: pointer.From(adbsPropModel.CharacterSet), - ComputeCount: pointer.From(adbsPropModel.ComputeCount), - CpuCoreCount: pointer.From(adbsPropModel.CpuCoreCount), - DataStorageSizeInGbs: pointer.From(adbsPropModel.DataStorageSizeInGbs), - DataStorageSizeInTbs: pointer.From(adbsPropModel.DataStorageSizeInTbs), - DbVersion: pointer.From(adbsPropModel.DbVersion), - DisplayName: pointer.From(adbsPropModel.DisplayName), - FailedDataRecoveryInSeconds: pointer.From(adbsPropModel.FailedDataRecoveryInSeconds), - InMemoryAreaInGbs: pointer.From(adbsPropModel.InMemoryAreaInGbs), - IsAutoScalingEnabled: pointer.From(adbsPropModel.IsAutoScalingEnabled), - IsAutoScalingForStorageEnabled: pointer.From(adbsPropModel.IsAutoScalingForStorageEnabled), - IsLocalDataGuardEnabled: pointer.From(adbsPropModel.IsLocalDataGuardEnabled), - IsMtlsConnectionRequired: pointer.From(adbsPropModel.IsMtlsConnectionRequired), - IsPreview: pointer.From(adbsPropModel.IsPreview), - IsPreviewVersionWithServiceTermsAccepted: pointer.From(adbsPropModel.IsPreviewVersionWithServiceTermsAccepted), - IsRemoteDataGuardEnabled: pointer.From(adbsPropModel.IsRemoteDataGuardEnabled), - LifecycleDetails: pointer.From(adbsPropModel.LifecycleDetails), - LocalAdgAutoFailoverMaxDataLossLimit: pointer.From(adbsPropModel.LocalAdgAutoFailoverMaxDataLossLimit), - MemoryPerOracleComputeUnitInGbs: pointer.From(adbsPropModel.MemoryPerOracleComputeUnitInGbs), - NcharacterSet: pointer.From(adbsPropModel.NcharacterSet), - NextLongTermBackupTimeStamp: pointer.From(adbsPropModel.NextLongTermBackupTimeStamp), - OciUrl: pointer.From(adbsPropModel.OciURL), - Ocid: pointer.From(adbsPropModel.Ocid), - PeerDbId: pointer.From(adbsPropModel.PeerDbId), - PeerDbIds: pointer.From(adbsPropModel.PeerDbIds), - PrivateEndpoint: pointer.From(adbsPropModel.PrivateEndpoint), - PrivateEndpointIP: pointer.From(adbsPropModel.PrivateEndpointIP), - PrivateEndpointLabel: pointer.From(adbsPropModel.PrivateEndpointLabel), - ProvisionableCPUs: pointer.From(adbsPropModel.ProvisionableCPUs), - ServiceConsoleUrl: pointer.From(adbsPropModel.ServiceConsoleURL), - SqlWebDeveloperUrl: pointer.From(adbsPropModel.SqlWebDeveloperURL), - SubnetId: pointer.From(adbsPropModel.SubnetId), - SupportedRegionsToCloneTo: pointer.From(adbsPropModel.SupportedRegionsToCloneTo), - TimeCreated: pointer.From(adbsPropModel.TimeCreated), - TimeDataGuardRoleChanged: pointer.From(adbsPropModel.TimeDataGuardRoleChanged), - TimeDeletionOfFreeAutonomousDatabase: pointer.From(adbsPropModel.TimeDeletionOfFreeAutonomousDatabase), - TimeLocalDataGuardEnabled: pointer.From(adbsPropModel.TimeLocalDataGuardEnabled), - TimeMaintenanceBegin: pointer.From(adbsPropModel.TimeMaintenanceBegin), - TimeMaintenanceEnd: pointer.From(adbsPropModel.TimeMaintenanceEnd), - TimeOfLastFailover: pointer.From(adbsPropModel.TimeOfLastFailover), - TimeOfLastRefresh: pointer.From(adbsPropModel.TimeOfLastRefresh), - TimeOfLastRefreshPoint: pointer.From(adbsPropModel.TimeOfLastRefreshPoint), - TimeOfLastSwitchover: pointer.From(adbsPropModel.TimeOfLastSwitchover), - TimeReclamationOfFreeAutonomousDatabase: pointer.From(adbsPropModel.TimeReclamationOfFreeAutonomousDatabase), - UsedDataStorageSizeInGbs: pointer.From(adbsPropModel.UsedDataStorageSizeInGbs), - UsedDataStorageSizeInTbs: pointer.From(adbsPropModel.UsedDataStorageSizeInTbs), - VnetId: pointer.From(adbsPropModel.VnetId), - WhitelistedIPs: pointer.From(adbsPropModel.WhitelistedIPs), - } - default: - return fmt.Errorf("unexpected Autonomous Database type, must be of type Regular") - } + state.ActualUsedDataStorageSizeInTbs = pointer.From(adbsProps.ActualUsedDataStorageSizeInTbs) + state.AllocatedStorageSizeInTbs = pointer.From(adbsProps.AllocatedStorageSizeInTbs) + state.AutonomousDatabaseId = pointer.From(adbsProps.AutonomousDatabaseId) + state.AutoScalingEnabled = pointer.From(adbsProps.IsAutoScalingEnabled) + state.AutoScalingForStorageEnabled = pointer.From(adbsProps.IsAutoScalingForStorageEnabled) + state.AvailableUpgradeVersions = pointer.From(adbsProps.AvailableUpgradeVersions) + state.BackupRetentionPeriodInDays = pointer.From(adbsProps.BackupRetentionPeriodInDays) + state.CharacterSet = pointer.From(adbsProps.CharacterSet) + state.ComputeCount = pointer.From(adbsProps.ComputeCount) + state.CpuCoreCount = pointer.From(adbsProps.CpuCoreCount) + state.DataStorageSizeInGbs = pointer.From(adbsProps.DataStorageSizeInGbs) + state.DataStorageSizeInTbs = pointer.From(adbsProps.DataStorageSizeInTbs) + state.DbVersion = pointer.From(adbsProps.DbVersion) + state.DisplayName = pointer.From(adbsProps.DisplayName) + state.FailedDataRecoveryInSeconds = pointer.From(adbsProps.FailedDataRecoveryInSeconds) + state.LifecycleDetails = pointer.From(adbsProps.LifecycleDetails) + state.LocalAdgAutoFailoverMaxDataLossLimit = pointer.From(adbsProps.LocalAdgAutoFailoverMaxDataLossLimit) + state.LocalDataGuardEnabled = pointer.From(adbsProps.IsLocalDataGuardEnabled) + state.MemoryAreaInGbs = pointer.From(adbsProps.InMemoryAreaInGbs) + state.MemoryPerOracleComputeUnitInGbs = pointer.From(adbsProps.MemoryPerOracleComputeUnitInGbs) + state.MtlsConnectionRequired = pointer.From(adbsProps.IsMtlsConnectionRequired) + state.NcharacterSet = pointer.From(adbsProps.NcharacterSet) + state.NextLongTermBackupTimeStamp = pointer.From(adbsProps.NextLongTermBackupTimeStamp) + state.Ocid = pointer.From(adbsProps.Ocid) + state.OciUrl = pointer.From(adbsProps.OciURL) + state.PeerDbId = pointer.From(adbsProps.PeerDbId) + state.PeerDbIds = pointer.From(adbsProps.PeerDbIds) + state.Preview = pointer.From(adbsProps.IsPreview) + state.PreviewVersionWithServiceTermsAccepted = pointer.From(adbsProps.IsPreviewVersionWithServiceTermsAccepted) + state.PrivateEndpoint = pointer.From(adbsProps.PrivateEndpoint) + state.PrivateEndpointIP = pointer.From(adbsProps.PrivateEndpointIP) + state.PrivateEndpointLabel = pointer.From(adbsProps.PrivateEndpointLabel) + state.ProvisionableCPUs = pointer.From(adbsProps.ProvisionableCPUs) + state.RemoteDataGuardEnabled = pointer.From(adbsProps.IsRemoteDataGuardEnabled) + state.ServiceConsoleUrl = pointer.From(adbsProps.ServiceConsoleURL) + state.SqlWebDeveloperUrl = pointer.From(adbsProps.SqlWebDeveloperURL) + state.SubnetId = pointer.From(adbsProps.SubnetId) + state.SupportedRegionsToCloneTo = pointer.From(adbsProps.SupportedRegionsToCloneTo) + state.TimeCreated = pointer.From(adbsProps.TimeCreated) + state.TimeDataGuardRoleChanged = pointer.From(adbsProps.TimeDataGuardRoleChanged) + state.TimeDeletionOfFreeAutonomousDatabase = pointer.From(adbsProps.TimeDeletionOfFreeAutonomousDatabase) + state.TimeLocalDataGuardEnabled = pointer.From(adbsProps.TimeLocalDataGuardEnabled) + state.TimeMaintenanceBegin = pointer.From(adbsProps.TimeMaintenanceBegin) + state.TimeMaintenanceEnd = pointer.From(adbsProps.TimeMaintenanceEnd) + state.TimeOfLastFailover = pointer.From(adbsProps.TimeOfLastFailover) + state.TimeOfLastRefresh = pointer.From(adbsProps.TimeOfLastRefresh) + state.TimeOfLastRefreshPoint = pointer.From(adbsProps.TimeOfLastRefreshPoint) + state.TimeOfLastSwitchover = pointer.From(adbsProps.TimeOfLastSwitchover) + state.TimeReclamationOfFreeAutonomousDatabase = pointer.From(adbsProps.TimeReclamationOfFreeAutonomousDatabase) + state.UsedDataStorageSizeInGbs = pointer.From(adbsProps.UsedDataStorageSizeInGbs) + state.UsedDataStorageSizeInTbs = pointer.From(adbsProps.UsedDataStorageSizeInTbs) + state.VnetId = pointer.From(adbsProps.VnetId) + state.WhitelistedIPs = pointer.From(adbsProps.WhitelistedIPs) } + } - output.Name = id.AutonomousDatabaseName - output.Type = pointer.From(model.Type) - output.Tags = utils.FlattenPtrMapStringString(model.Tags) + metadata.SetID(id) - metadata.SetID(id) - return metadata.Encode(&output) - } - return nil + return metadata.Encode(&state) }, } } diff --git a/internal/services/oracle/autonomous_database_regular_data_source_test.go b/internal/services/oracle/autonomous_database_regular_data_source_test.go index 0725c113f4d9..d2cbed82ff52 100644 --- a/internal/services/oracle/autonomous_database_regular_data_source_test.go +++ b/internal/services/oracle/autonomous_database_regular_data_source_test.go @@ -37,7 +37,7 @@ func (d AutonomousDatabaseRegularDataSource) basic(data acceptance.TestData) str %s data "azurerm_oracle_autonomous_database" "test" { - name = azurerm_oracle_autonomous_database.test.name + name = azurerm_oracle_autonomous_database.test.name resource_group_name = azurerm_oracle_autonomous_database.test.resource_group_name } `, AdbsRegularResource{}.basic(data)) diff --git a/internal/services/oracle/autonomous_database_regular_resource.go b/internal/services/oracle/autonomous_database_regular_resource.go index 2c5dca2ea79f..a2ef920c7ce6 100644 --- a/internal/services/oracle/autonomous_database_regular_resource.go +++ b/internal/services/oracle/autonomous_database_regular_resource.go @@ -40,9 +40,9 @@ type AutonomousDatabaseRegularResourceModel struct { DbWorkload string `tfschema:"db_workload"` DisplayName string `tfschema:"display_name"` LicenseModel string `tfschema:"license_model"` - IsAutoScalingEnabled bool `tfschema:"is_auto_scaling_enabled"` - IsAutoScalingForStorageEnabled bool `tfschema:"is_auto_scaling_for_storage_enabled"` - IsMtlsConnectionRequired bool `tfschema:"is_mtls_connection_required"` + IsAutoScalingEnabled bool `tfschema:"auto_scaling_enabled"` + IsAutoScalingForStorageEnabled bool `tfschema:"auto_scaling_for_storage_enabled"` + IsMtlsConnectionRequired bool `tfschema:"mtls_connection_required"` NcharacterSet string `tfschema:"ncharacter_set"` SubnetId string `tfschema:"subnet_id"` VnetId string `tfschema:"vnet_id"` @@ -103,15 +103,15 @@ func (AutonomousDatabaseRegularResource) Arguments() map[string]*pluginsdk.Schem Type: pluginsdk.TypeString, Required: true, }, - "is_auto_scaling_enabled": { + "auto_scaling_enabled": { Type: pluginsdk.TypeBool, Required: true, }, - "is_auto_scaling_for_storage_enabled": { + "auto_scaling_for_storage_enabled": { Type: pluginsdk.TypeBool, Required: true, }, - "is_mtls_connection_required": { + "mtls_connection_required": { Type: pluginsdk.TypeBool, Required: true, }, diff --git a/internal/services/oracle/autonomous_database_regular_resource_test.go b/internal/services/oracle/autonomous_database_regular_resource_test.go index f785b572efe2..7a89fa187ba8 100644 --- a/internal/services/oracle/autonomous_database_regular_resource_test.go +++ b/internal/services/oracle/autonomous_database_regular_resource_test.go @@ -82,29 +82,30 @@ func TestAdbsRegularResource_requiresImport(t *testing.T) { func (a AdbsRegularResource) basic(data acceptance.TestData) string { return fmt.Sprintf(` + %s resource "azurerm_oracle_autonomous_database" "test" { name = "OFake%[2]d" - display_name = "OFake%[2]d" - resource_group_name = azurerm_resource_group.test.name - location = "%[3]s" - compute_model = "ECPU" - compute_count = "2" - license_model = "BringYourOwnLicense" - backup_retention_period_in_days = 12 - is_auto_scaling_enabled = false - is_auto_scaling_for_storage_enabled = false - is_mtls_connection_required = false - data_storage_size_in_gbs = "32" - db_workload = "OLTP" - admin_password = "TestPass#2024#" - db_version = "19c" - character_set = "AL32UTF8" - ncharacter_set = "AL16UTF16" - subnet_id = azurerm_subnet.virtual_network_subnet.id - vnet_id = azurerm_virtual_network.virtual_network.id + display_name = "OFake%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = "%[3]s" + compute_model = "ECPU" + compute_count = "2" + license_model = "BringYourOwnLicense" + backup_retention_period_in_days = 12 + auto_scaling_enabled = false + auto_scaling_for_storage_enabled = false + mtls_connection_required = false + data_storage_size_in_gbs = "32" + db_workload = "OLTP" + admin_password = "TestPass#2024#" + db_version = "19c" + character_set = "AL32UTF8" + ncharacter_set = "AL16UTF16" + subnet_id = azurerm_subnet.virtual_network_subnet.id + vnet_id = azurerm_virtual_network.virtual_network.id lifecycle { ignore_changes = [ admin_password @@ -117,28 +118,29 @@ resource "azurerm_oracle_autonomous_database" "test" { func (a AdbsRegularResource) update(data acceptance.TestData) string { return fmt.Sprintf(` + %s resource "azurerm_oracle_autonomous_database" "test" { - name = "OFake%[2]d" - display_name = "OFake%[2]d" - resource_group_name = azurerm_resource_group.test.name - location = "%[3]s" - compute_model = "ECPU" - compute_count = "2" - license_model = "BringYourOwnLicense" - backup_retention_period_in_days = 12 - is_auto_scaling_enabled = false - is_auto_scaling_for_storage_enabled = false - is_mtls_connection_required = false - data_storage_size_in_gbs = "32" - db_workload = "OLTP" - admin_password = "TestPass#2024#" - db_version = "19c" - character_set = "AL32UTF8" - ncharacter_set = "AL16UTF16" - subnet_id = azurerm_subnet.virtual_network_subnet.id - vnet_id = azurerm_virtual_network.virtual_network.id + name = "OFake%[2]d" + display_name = "OFake%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = "%[3]s" + compute_model = "ECPU" + compute_count = "2" + license_model = "BringYourOwnLicense" + backup_retention_period_in_days = 12 + auto_scaling_enabled = false + auto_scaling_for_storage_enabled = false + mtls_connection_required = false + data_storage_size_in_gbs = "32" + db_workload = "OLTP" + admin_password = "TestPass#2024#" + db_version = "19c" + character_set = "AL32UTF8" + ncharacter_set = "AL16UTF16" + subnet_id = azurerm_subnet.virtual_network_subnet.id + vnet_id = azurerm_virtual_network.virtual_network.id tags = { test = "test1" } @@ -156,25 +158,25 @@ func (a AdbsRegularResource) requiresImport(data acceptance.TestData) string { %s resource "azurerm_oracle_autonomous_database" "import" { - name = azurerm_oracle_autonomous_database.test.name - display_name = azurerm_oracle_autonomous_database.test.display_name - resource_group_name = azurerm_oracle_autonomous_database.test.resource_group_name - location = azurerm_oracle_autonomous_database.test.location - compute_model = azurerm_oracle_autonomous_database.test.compute_model - compute_count = azurerm_oracle_autonomous_database.test.compute_count - license_model = azurerm_oracle_autonomous_database.test.license_model - backup_retention_period_in_days = azurerm_oracle_autonomous_database.test.backup_retention_period_in_days - is_auto_scaling_enabled = azurerm_oracle_autonomous_database.test.is_auto_scaling_enabled - is_auto_scaling_for_storage_enabled = azurerm_oracle_autonomous_database.test.is_auto_scaling_for_storage_enabled - is_mtls_connection_required = azurerm_oracle_autonomous_database.test.is_mtls_connection_required - data_storage_size_in_gbs = azurerm_oracle_autonomous_database.test.data_storage_size_in_gbs - db_workload = azurerm_oracle_autonomous_database.test.db_workload - admin_password = azurerm_oracle_autonomous_database.test.admin_password - db_version = azurerm_oracle_autonomous_database.test.db_version - character_set = azurerm_oracle_autonomous_database.test.character_set - ncharacter_set = azurerm_oracle_autonomous_database.test.ncharacter_set - subnet_id = azurerm_oracle_autonomous_database.test.subnet_id - vnet_id = azurerm_oracle_autonomous_database.test.vnet_id + name = azurerm_oracle_autonomous_database.test.name + display_name = azurerm_oracle_autonomous_database.test.display_name + resource_group_name = azurerm_oracle_autonomous_database.test.resource_group_name + location = azurerm_oracle_autonomous_database.test.location + compute_model = azurerm_oracle_autonomous_database.test.compute_model + compute_count = azurerm_oracle_autonomous_database.test.compute_count + license_model = azurerm_oracle_autonomous_database.test.license_model + backup_retention_period_in_days = azurerm_oracle_autonomous_database.test.backup_retention_period_in_days + auto_scaling_enabled = azurerm_oracle_autonomous_database.test.auto_scaling_enabled + auto_scaling_for_storage_enabled = azurerm_oracle_autonomous_database.test.auto_scaling_for_storage_enabled + mtls_connection_required = azurerm_oracle_autonomous_database.test.mtls_connection_required + data_storage_size_in_gbs = azurerm_oracle_autonomous_database.test.data_storage_size_in_gbs + db_workload = azurerm_oracle_autonomous_database.test.db_workload + admin_password = azurerm_oracle_autonomous_database.test.admin_password + db_version = azurerm_oracle_autonomous_database.test.db_version + character_set = azurerm_oracle_autonomous_database.test.character_set + ncharacter_set = azurerm_oracle_autonomous_database.test.ncharacter_set + subnet_id = azurerm_oracle_autonomous_database.test.subnet_id + vnet_id = azurerm_oracle_autonomous_database.test.vnet_id lifecycle { ignore_changes = [ admin_password @@ -216,12 +218,13 @@ resource "azurerm_subnet" "virtual_network_subnet" { service_delegation { actions = [ "Microsoft.Network/networkinterfaces/*", - "Microsoft.Network/virtualNetworks/subnets/join/action", + "Microsoft.Network/virtualNetworks/subnets/join/action", ] name = "Oracle.Database/networkAttachments" } } } + `, data.RandomInteger, data.Locations.Primary, data.RandomString) } diff --git a/internal/services/oracle/validate/autonomous_database_regular.go b/internal/services/oracle/validate/autonomous_database_regular.go new file mode 100644 index 000000000000..457040f31734 --- /dev/null +++ b/internal/services/oracle/validate/autonomous_database_regular.go @@ -0,0 +1,35 @@ +package validate + +import ( + "fmt" + "unicode" + "unicode/utf8" +) + +func AutonomousDatabaseName(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) + return + } + + firstChar, _ := utf8.DecodeRuneInString(v) + if !unicode.IsLetter(firstChar) { + errors = append(errors, fmt.Errorf("%v must start with a letter", k)) + return + } + + for _, r := range v { + if !unicode.IsLetter(r) && !unicode.IsNumber(r) { + errors = append(errors, fmt.Errorf("%v must contain only letters and numbers", k)) + return + } + } + + if len(v) > 30 { + errors = append(errors, fmt.Errorf("%v must be 30 characers max", k)) + return + } + + return +} diff --git a/website/docs/d/oracle_autonomous_database_regular.html.markdown b/website/docs/d/oracle_autonomous_database_regular.html.markdown index f2e7c5104642..fc594035da56 100644 --- a/website/docs/d/oracle_autonomous_database_regular.html.markdown +++ b/website/docs/d/oracle_autonomous_database_regular.html.markdown @@ -14,7 +14,7 @@ Use this data source to access information about an existing Autonomous Database ```hcl data "azurerm_oracle_autonomous_database" "example" { - name = "existing" + name = "existing" resource_group_name = "existing" } @@ -68,19 +68,19 @@ In addition to the Arguments listed above - the following Attributes are exporte * `in_memory_area_in_gbs` - The area assigned to In-Memory tables in Autonomous Database. -* `is_auto_scaling_enabled` - Indicates if auto scaling is enabled for the Autonomous Database CPU core count. +* `auto_scaling_enabled` - Indicates if auto scaling is enabled for the Autonomous Database CPU core count. -* `is_auto_scaling_for_storage_enabled` - Indicates if auto scaling is enabled for the Autonomous Database storage. +* `auto_scaling_for_storage_enabled` - Indicates if auto scaling is enabled for the Autonomous Database storage. -* `is_local_data_guard_enabled` - Indicates whether the Autonomous Database has local (in-region) Data Guard enabled. Not applicable to cross-region Autonomous Data Guard associations, or to Autonomous Databases using dedicated Exadata infrastructure or Exadata Cloud@Customer infrastructure. +* `local_data_guard_enabled` - Indicates whether the Autonomous Database has local (in-region) Data Guard enabled. Not applicable to cross-region Autonomous Data Guard associations, or to Autonomous Databases using dedicated Exadata infrastructure or Exadata Cloud@Customer infrastructure. -* `is_mtls_connection_required` - Specifies if the Autonomous Database requires mTLS connections. +* `mtls_connection_required` - Specifies if the Autonomous Database requires mTLS connections. -* `is_preview` - Indicates if the Autonomous Database version is a preview version. +* `preview` - Indicates if the Autonomous Database version is a preview version. -* `is_preview_version_with_service_terms_accepted` - Indicates if the Autonomous Database version is a preview version with service terms accepted. +* `preview_version_with_service_terms_accepted` - Indicates if the Autonomous Database version is a preview version with service terms accepted. -* `is_remote_data_guard_enabled` - Indicates whether the Autonomous Database has Cross Region Data Guard enabled. Not applicable to Autonomous Databases using dedicated Exadata infrastructure or Exadata Cloud@Customer infrastructure. +* `remote_data_guard_enabled` - Indicates whether the Autonomous Database has Cross Region Data Guard enabled. Not applicable to Autonomous Databases using dedicated Exadata infrastructure or Exadata Cloud@Customer infrastructure. * `key_history_entry` - Key History Entry. @@ -154,4 +154,4 @@ In addition to the Arguments listed above - the following Attributes are exporte The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: -* `read` - (Defaults to 5 minutes) Used when retrieving the Autonomous Databases. \ No newline at end of file +* `read` - (Defaults to 5 minutes) Used when retrieving the Autonomous Databases. diff --git a/website/docs/r/oracle_autonomous_database_regular.html.markdown b/website/docs/r/oracle_autonomous_database_regular.html.markdown index cbb8aa01cf26..81e70f8309ab 100644 --- a/website/docs/r/oracle_autonomous_database_regular.html.markdown +++ b/website/docs/r/oracle_autonomous_database_regular.html.markdown @@ -14,25 +14,25 @@ Manages a Autonomous Databases. ```hcl resource "azurerm_oracle_autonomous_database" "example" { - name = "example" - resource_group_name = "example" - location = "West Europe" - subnet_id = "example" - display_name = "example" - db_workload = "example" - is_mtls_connection_required = false - backup_retention_period_in_days = 42 - compute_model = "example" - data_storage_size_in_gbs = 42 - is_auto_scaling_for_storage_enabled = false - vnet_id = "example" - admin_password = "example" - is_auto_scaling_enabled = "example" - character_set = "example" - compute_count = 1.23456 - ncharacter_set = "example" - license_model = false - db_version = "example" + name = "example" + resource_group_name = "example" + location = "West Europe" + subnet_id = "example" + display_name = "example" + db_workload = "example" + mtls_connection_required = false + backup_retention_period_in_days = 42 + compute_model = "example" + data_storage_size_in_gbs = 42 + auto_scaling_for_storage_enabled = false + vnet_id = "example" + admin_password = "example" + auto_scaling_enabled = "example" + character_set = "example" + compute_count = 1.23456 + ncharacter_set = "example" + license_model = false + db_version = "example" } ``` @@ -63,11 +63,11 @@ The following arguments are supported: * `display_name` - (Required) The user-friendly name for the Autonomous Database. The name does not have to be unique. -* `is_auto_scaling_enabled` - (Required) Indicates if auto scaling is enabled for the Autonomous Database CPU core count. The default value is `TRUE`. +* `auto_scaling_enabled` - (Required) Indicates if auto scaling is enabled for the Autonomous Database CPU core count. The default value is `TRUE`. -* `is_auto_scaling_for_storage_enabled` - (Required) Indicates if auto scaling is enabled for the Autonomous Database storage. The default value is `FALSE`. +* `auto_scaling_for_storage_enabled` - (Required) Indicates if auto scaling is enabled for the Autonomous Database storage. The default value is `FALSE`. -* `is_mtls_connection_required` - (Required) Specifies if the Autonomous Database requires mTLS connections. +* `mtls_connection_required` - (Required) Specifies if the Autonomous Database requires mTLS connections. * `license_model` - (Required) The Oracle license model that applies to the Oracle Autonomous Database. Bring your own license (BYOL) allows you to apply your current on-premises Oracle software licenses to equivalent, highly automated Oracle services in the cloud. License Included allows you to subscribe to new Oracle Database software licenses and the Oracle Database service. Note that when provisioning an [Autonomous Database on dedicated Exadata infrastructure](https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html), this attribute must be null. It is already set at the Autonomous Exadata Infrastructure level. When provisioning an [Autonomous Database Serverless] (https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html) database, if a value is not specified, the system defaults the value to `BRING_YOUR_OWN_LICENSE`. Bring your own license (BYOL) also allows you to select the DB edition using the optional parameter. @@ -110,4 +110,4 @@ Autonomous Databases can be imported using the `resource id`, e.g. ```shell terraform import azurerm_oracle_autonomous_database.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup/providers/Oracle.Database/autonomousDatabases/autonomousDatabases1 -``` \ No newline at end of file +``` From e19b41cccd6b9edb8979f2ae4befff0898d8b928 Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Thu, 17 Oct 2024 23:16:11 +0100 Subject: [PATCH 11/43] * Data source changes. --- .../oracle/autonomous_database_regular_data_source.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/services/oracle/autonomous_database_regular_data_source.go b/internal/services/oracle/autonomous_database_regular_data_source.go index adc54796cfc5..fe47494fa7ca 100644 --- a/internal/services/oracle/autonomous_database_regular_data_source.go +++ b/internal/services/oracle/autonomous_database_regular_data_source.go @@ -19,7 +19,7 @@ import ( type AutonomousDatabaseRegularDataSource struct{} -type AutonomousDatabaseRegularDataSourceModel struct { +type AutonomousDatabaseRegularDataModel struct { Location string `tfschema:"location"` Name string `tfschema:"name"` ResourceGroupName string `tfschema:"resource_group_name"` @@ -388,7 +388,7 @@ func (d AutonomousDatabaseRegularDataSource) Attributes() map[string]*pluginsdk. } func (d AutonomousDatabaseRegularDataSource) ModelObject() interface{} { - return &AutonomousDatabaseRegularDataSourceModel{} + return &AutonomousDatabaseRegularDataModel{} } func (d AutonomousDatabaseRegularDataSource) ResourceType() string { @@ -406,7 +406,7 @@ func (d AutonomousDatabaseRegularDataSource) Read() sdk.ResourceFunc { client := metadata.Client.Oracle.OracleClient.AutonomousDatabases subscriptionId := metadata.Client.Account.SubscriptionId - var state AutonomousDatabaseRegularDataSourceModel + var state AutonomousDatabaseRegularDataModel if err := metadata.Decode(&state); err != nil { return fmt.Errorf("decoding: %+v", err) } From 8f683f602c09140f48769655c94a3de53c86cdaa Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Thu, 17 Oct 2024 23:57:31 +0100 Subject: [PATCH 12/43] * Add validators. --- .../autonomous_database_regular_resource.go | 253 +++++++++++------- .../oracle/cloud_vm_cluster_resource.go | 17 -- .../validate/autonomous_database_regular.go | 110 ++++++++ ..._autonomous_database_regular.html.markdown | 6 +- 4 files changed, 267 insertions(+), 119 deletions(-) diff --git a/internal/services/oracle/autonomous_database_regular_resource.go b/internal/services/oracle/autonomous_database_regular_resource.go index a2ef920c7ce6..f6c19bfc1110 100644 --- a/internal/services/oracle/autonomous_database_regular_resource.go +++ b/internal/services/oracle/autonomous_database_regular_resource.go @@ -9,12 +9,10 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases" - "github.com/hashicorp/terraform-provider-azurerm/utils" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracle/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -23,29 +21,28 @@ var _ sdk.Resource = AutonomousDatabaseRegularResource{} type AutonomousDatabaseRegularResource struct{} type AutonomousDatabaseRegularResourceModel struct { - // Azure - Location string `tfschema:"location"` - Name string `tfschema:"name"` - ResourceGroupName string `tfschema:"resource_group_name"` - Tags map[string]interface{} `tfschema:"tags"` + Location string `tfschema:"location"` + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Tags map[string]string `tfschema:"tags"` // Required - AdminPassword string `tfschema:"admin_password"` - BackupRetentionPeriodInDays int64 `tfschema:"backup_retention_period_in_days"` - CharacterSet string `tfschema:"character_set"` - ComputeCount float64 `tfschema:"compute_count"` - ComputeModel string `tfschema:"compute_model"` - DataStorageSizeInGbs int64 `tfschema:"data_storage_size_in_gbs"` - DbVersion string `tfschema:"db_version"` - DbWorkload string `tfschema:"db_workload"` - DisplayName string `tfschema:"display_name"` - LicenseModel string `tfschema:"license_model"` - IsAutoScalingEnabled bool `tfschema:"auto_scaling_enabled"` - IsAutoScalingForStorageEnabled bool `tfschema:"auto_scaling_for_storage_enabled"` - IsMtlsConnectionRequired bool `tfschema:"mtls_connection_required"` - NcharacterSet string `tfschema:"ncharacter_set"` - SubnetId string `tfschema:"subnet_id"` - VnetId string `tfschema:"vnet_id"` + AdminPassword string `tfschema:"admin_password"` + BackupRetentionPeriodInDays int64 `tfschema:"backup_retention_period_in_days"` + CharacterSet string `tfschema:"character_set"` + ComputeCount float64 `tfschema:"compute_count"` + ComputeModel string `tfschema:"compute_model"` + DataStorageSizeInTbs int64 `tfschema:"data_storage_size_in_tbs"` + DbVersion string `tfschema:"db_version"` + DbWorkload string `tfschema:"db_workload"` + DisplayName string `tfschema:"display_name"` + LicenseModel string `tfschema:"license_model"` + AutoScalingEnabled bool `tfschema:"auto_scaling_enabled"` + AutoScalingForStorageEnabled bool `tfschema:"auto_scaling_for_storage_enabled"` + MtlsConnectionRequired bool `tfschema:"mtls_connection_required"` + NcharacterSet string `tfschema:"ncharacter_set"` + SubnetId string `tfschema:"subnet_id"` + VnetId string `tfschema:"vnet_id"` // Optional CustomerContacts []string `tfschema:"customer_contacts"` @@ -53,83 +50,112 @@ type AutonomousDatabaseRegularResourceModel struct { func (AutonomousDatabaseRegularResource) Arguments() map[string]*pluginsdk.Schema { return map[string]*pluginsdk.Schema{ - // Azure "location": commonschema.Location(), + "name": { - Type: pluginsdk.TypeString, - Required: true, + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validate.AutonomousDatabaseName, + ForceNew: true, }, - "resource_group_name": { - Type: pluginsdk.TypeString, - Required: true, - }, - "tags": commonschema.Tags(), + + "resource_group_name": commonschema.ResourceGroupName(), // Required "admin_password": { - Type: pluginsdk.TypeString, - Required: true, - Sensitive: true, + Type: pluginsdk.TypeString, + Required: true, + Sensitive: true, + ForceNew: true, + ValidateFunc: validate.AutonomousDatabasePassword, }, + "backup_retention_period_in_days": { Type: pluginsdk.TypeInt, Required: true, + ForceNew: true, }, + "character_set": { Type: pluginsdk.TypeString, Required: true, + ForceNew: true, }, + "compute_count": { Type: pluginsdk.TypeFloat, Required: true, }, + "compute_model": { Type: pluginsdk.TypeString, Required: true, + ForceNew: true, }, - "data_storage_size_in_gbs": { + + "data_storage_size_in_tbs": { Type: pluginsdk.TypeInt, Required: true, }, + "db_version": { Type: pluginsdk.TypeString, Required: true, + ForceNew: true, }, + "db_workload": { Type: pluginsdk.TypeString, Required: true, + ForceNew: true, }, + "display_name": { - Type: pluginsdk.TypeString, - Required: true, + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.AutonomousDatabaseName, }, + "auto_scaling_enabled": { Type: pluginsdk.TypeBool, Required: true, }, + "auto_scaling_for_storage_enabled": { Type: pluginsdk.TypeBool, Required: true, }, + "mtls_connection_required": { Type: pluginsdk.TypeBool, Required: true, + ForceNew: true, }, + "license_model": { - Type: pluginsdk.TypeString, - Required: true, + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.LicenseType, }, + "ncharacter_set": { Type: pluginsdk.TypeString, Required: true, + ForceNew: true, }, + "subnet_id": { Type: pluginsdk.TypeString, Required: true, + ForceNew: true, }, + "vnet_id": { Type: pluginsdk.TypeString, Required: true, + ForceNew: true, }, // Optional @@ -137,10 +163,14 @@ func (AutonomousDatabaseRegularResource) Arguments() map[string]*pluginsdk.Schem Type: pluginsdk.TypeList, Optional: true, Computed: true, + ForceNew: true, Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, + Type: pluginsdk.TypeString, + ValidateFunc: validate.CustomerContactEmail, }, }, + + "tags": commonschema.Tags(), } } @@ -156,31 +186,9 @@ func (AutonomousDatabaseRegularResource) ResourceType() string { return "azurerm_oracle_autonomous_database" } -func convertAdbsCustomerContactsToSDK(customerContactsList []string) []autonomousdatabases.CustomerContact { - var customerContacts []autonomousdatabases.CustomerContact - if customerContactsList != nil { - for _, customerContact := range customerContactsList { - customerContacts = append(customerContacts, autonomousdatabases.CustomerContact{ - Email: customerContact, - }) - } - } - return customerContacts -} - -func convertAdbsCustomerContactsToInternalModel(customerContactsList *[]autonomousdatabases.CustomerContact) []string { - var customerContacts []string - if customerContactsList != nil { - for _, customerContact := range *customerContactsList { - customerContacts = append(customerContacts, customerContact.Email) - } - } - return customerContacts -} - func (r AutonomousDatabaseRegularResource) Create() sdk.ResourceFunc { return sdk.ResourceFunc{ - Timeout: 60 * time.Minute, + Timeout: 120 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.Oracle.OracleClient.AutonomousDatabases subscriptionId := metadata.Client.Account.SubscriptionId @@ -205,21 +213,21 @@ func (r AutonomousDatabaseRegularResource) Create() sdk.ResourceFunc { param := autonomousdatabases.AutonomousDatabase{ Name: pointer.To(model.Name), Location: model.Location, - Tags: tags.Expand(model.Tags), + Tags: pointer.To(model.Tags), Properties: &autonomousdatabases.AutonomousDatabaseProperties{ AdminPassword: pointer.To(model.AdminPassword), BackupRetentionPeriodInDays: pointer.To(model.BackupRetentionPeriodInDays), CharacterSet: pointer.To(model.CharacterSet), ComputeCount: pointer.To(model.ComputeCount), ComputeModel: pointer.To(autonomousdatabases.ComputeModel(model.ComputeModel)), - CustomerContacts: pointer.To(convertAdbsCustomerContactsToSDK(model.CustomerContacts)), - DataStorageSizeInGbs: pointer.To(model.DataStorageSizeInGbs), + CustomerContacts: pointer.To(expandAdbsCustomerContacts(model.CustomerContacts)), + DataStorageSizeInGbs: pointer.To(model.DataStorageSizeInTbs), DbWorkload: pointer.To(autonomousdatabases.WorkloadType(model.DbWorkload)), DbVersion: pointer.To(model.DbVersion), DisplayName: pointer.To(model.DisplayName), - IsAutoScalingEnabled: pointer.To(model.IsAutoScalingEnabled), - IsAutoScalingForStorageEnabled: pointer.To(model.IsAutoScalingForStorageEnabled), - IsMtlsConnectionRequired: pointer.To(model.IsMtlsConnectionRequired), + IsAutoScalingEnabled: pointer.To(model.AutoScalingEnabled), + IsAutoScalingForStorageEnabled: pointer.To(model.AutoScalingForStorageEnabled), + IsMtlsConnectionRequired: pointer.To(model.MtlsConnectionRequired), LicenseModel: pointer.To(autonomousdatabases.LicenseModel(model.LicenseModel)), NcharacterSet: pointer.To(model.NcharacterSet), SubnetId: pointer.To(model.SubnetId), @@ -261,17 +269,42 @@ func (r AutonomousDatabaseRegularResource) Update() sdk.ResourceFunc { return fmt.Errorf("retrieving as nil when updating for %v", *id) } + hasUpdate := false + update := &autonomousdatabases.AutonomousDatabaseUpdate{} + properties := &autonomousdatabases.AutonomousDatabaseUpdateProperties{} + update.Properties = properties if metadata.ResourceData.HasChange("tags") { - update := &autonomousdatabases.AutonomousDatabaseUpdate{ - Tags: tags.Expand(model.Tags), - } + hasUpdate = true + update.Tags = pointer.To(model.Tags) + } + if metadata.ResourceData.HasChange("data_storage_size_in_tbs") { + hasUpdate = true + update.Properties.DataStorageSizeInTbs = pointer.To(model.DataStorageSizeInTbs) + } + if metadata.ResourceData.HasChange("compute_count") { + hasUpdate = true + update.Properties.ComputeCount = pointer.To(model.ComputeCount) + } + if metadata.ResourceData.HasChange("auto_scaling_enabled") { + hasUpdate = true + update.Properties.IsAutoScalingEnabled = pointer.To(model.AutoScalingEnabled) + } + if metadata.ResourceData.HasChange("auto_scaling_for_storage_enabled") { + hasUpdate = true + update.Properties.IsAutoScalingForStorageEnabled = pointer.To(model.AutoScalingForStorageEnabled) + } else if metadata.ResourceData.HasChangesExcept("auto_scaling_enabled", "auto_scaling_for_storage_enabled", + "compute_count", "data_storage_size_in_tbs", "tags") { + return fmt.Errorf("only `auto_scaling_enabled`, `auto_scaling_for_storage_enabled`, `compute_count`, " + + "`data_storage_size_in_tbs`, and `tags` currently support updates") + } + + if hasUpdate { err = client.UpdateThenPoll(ctx, *id, *update) if err != nil { return fmt.Errorf("updating %s: %v", id, err) } - } else if metadata.ResourceData.HasChangesExcept("tags") { - return fmt.Errorf("only `tags` currently support updates") } + return nil }, } @@ -301,29 +334,29 @@ func (AutonomousDatabaseRegularResource) Read() sdk.ResourceFunc { prop := result.Model.Properties switch adbsPropModel := prop.(type) { case autonomousdatabases.AutonomousDatabaseProperties: - var output AutonomousDatabaseRegularResourceModel - output.AdminPassword = pointer.From(adbsPropModel.AdminPassword) - output.BackupRetentionPeriodInDays = pointer.From(adbsPropModel.BackupRetentionPeriodInDays) - output.CharacterSet = pointer.From(adbsPropModel.CharacterSet) - output.ComputeCount = pointer.From(adbsPropModel.ComputeCount) - output.ComputeModel = string(pointer.From(adbsPropModel.ComputeModel)) - output.CustomerContacts = convertAdbsCustomerContactsToInternalModel(adbsPropModel.CustomerContacts) - output.DataStorageSizeInGbs = pointer.From(adbsPropModel.DataStorageSizeInGbs) - output.DbWorkload = string(pointer.From(adbsPropModel.DbWorkload)) - output.DbVersion = pointer.From(adbsPropModel.DbVersion) - output.DisplayName = pointer.From(adbsPropModel.DisplayName) - output.IsAutoScalingEnabled = pointer.From(adbsPropModel.IsAutoScalingEnabled) - output.IsAutoScalingForStorageEnabled = pointer.From(adbsPropModel.IsAutoScalingForStorageEnabled) - output.Location = result.Model.Location - output.Name = pointer.ToString(result.Model.Name) - output.LicenseModel = string(pointer.From(adbsPropModel.LicenseModel)) - output.NcharacterSet = pointer.From(adbsPropModel.NcharacterSet) - output.ResourceGroupName = id.ResourceGroupName - output.SubnetId = pointer.From(adbsPropModel.SubnetId) - output.Tags = utils.FlattenPtrMapStringString(result.Model.Tags) - output.VnetId = pointer.From(adbsPropModel.VnetId) - - return metadata.Encode(&output) + var state AutonomousDatabaseRegularResourceModel + state.AdminPassword = pointer.From(adbsPropModel.AdminPassword) + state.BackupRetentionPeriodInDays = pointer.From(adbsPropModel.BackupRetentionPeriodInDays) + state.CharacterSet = pointer.From(adbsPropModel.CharacterSet) + state.ComputeCount = pointer.From(adbsPropModel.ComputeCount) + state.ComputeModel = string(pointer.From(adbsPropModel.ComputeModel)) + state.CustomerContacts = flattenAdbsCustomerContacts(adbsPropModel.CustomerContacts) + state.DataStorageSizeInTbs = pointer.From(adbsPropModel.DataStorageSizeInGbs) + state.DbWorkload = string(pointer.From(adbsPropModel.DbWorkload)) + state.DbVersion = pointer.From(adbsPropModel.DbVersion) + state.DisplayName = pointer.From(adbsPropModel.DisplayName) + state.AutoScalingEnabled = pointer.From(adbsPropModel.IsAutoScalingEnabled) + state.AutoScalingForStorageEnabled = pointer.From(adbsPropModel.IsAutoScalingForStorageEnabled) + state.Location = result.Model.Location + state.Name = pointer.ToString(result.Model.Name) + state.LicenseModel = string(pointer.From(adbsPropModel.LicenseModel)) + state.NcharacterSet = pointer.From(adbsPropModel.NcharacterSet) + state.ResourceGroupName = id.ResourceGroupName + state.SubnetId = pointer.From(adbsPropModel.SubnetId) + state.Tags = pointer.From(result.Model.Tags) + state.VnetId = pointer.From(adbsPropModel.VnetId) + + return metadata.Encode(&state) default: return fmt.Errorf("unexpected Autonomous Database type, must be of type Regular") } @@ -354,3 +387,25 @@ func (AutonomousDatabaseRegularResource) Delete() sdk.ResourceFunc { func (AutonomousDatabaseRegularResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { return autonomousdatabases.ValidateAutonomousDatabaseID } + +func expandAdbsCustomerContacts(customerContactsList []string) []autonomousdatabases.CustomerContact { + var customerContacts []autonomousdatabases.CustomerContact + if customerContactsList != nil { + for _, customerContact := range customerContactsList { + customerContacts = append(customerContacts, autonomousdatabases.CustomerContact{ + Email: customerContact, + }) + } + } + return customerContacts +} + +func flattenAdbsCustomerContacts(customerContactsList *[]autonomousdatabases.CustomerContact) []string { + var customerContacts []string + if customerContactsList != nil { + for _, customerContact := range *customerContactsList { + customerContacts = append(customerContacts, customerContact.Email) + } + } + return customerContacts +} diff --git a/internal/services/oracle/cloud_vm_cluster_resource.go b/internal/services/oracle/cloud_vm_cluster_resource.go index bb99510db90f..15404572bf87 100644 --- a/internal/services/oracle/cloud_vm_cluster_resource.go +++ b/internal/services/oracle/cloud_vm_cluster_resource.go @@ -60,7 +60,6 @@ type CloudVmClusterResourceModel struct { func (CloudVmClusterResource) Arguments() map[string]*pluginsdk.Schema { return map[string]*pluginsdk.Schema{ - // Azure "location": commonschema.Location(), "name": { @@ -493,19 +492,3 @@ func removeHostnameSuffix(hostnameActual string) string { return hostnameActual } } - -// DbSystemHostnameDiffSuppress When submitting a request to DBaaS a suffix will be added to the Hostname, -// therefore when computing the diff if the new Hostname is a prefix of the old then we will ignore the diff. -// Example: Initial plan -> testHostname, final result after DBaaS -> testHostname-abc. -// Since testHostname is a prefix of testHostname-abc, then computed diff is zero. -func DbSystemHostnameDiffSuppress(_ string, old string, new string, _ *schema.ResourceData) bool { - return EqualSuppressDiff(old, new) || NewIsPrefixOfOldDiffSuppress(old, new) -} - -func NewIsPrefixOfOldDiffSuppress(old string, new string) bool { - return strings.HasPrefix(strings.ToLower(old), strings.ToLower(new)) -} - -func EqualSuppressDiff(old string, new string) bool { - return old == new -} diff --git a/internal/services/oracle/validate/autonomous_database_regular.go b/internal/services/oracle/validate/autonomous_database_regular.go index 457040f31734..686eca34825d 100644 --- a/internal/services/oracle/validate/autonomous_database_regular.go +++ b/internal/services/oracle/validate/autonomous_database_regular.go @@ -2,8 +2,13 @@ package validate import ( "fmt" + "regexp" + "strings" "unicode" "unicode/utf8" + + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases" + "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures" ) func AutonomousDatabaseName(i interface{}, k string) (warnings []string, errors []error) { @@ -33,3 +38,108 @@ func AutonomousDatabaseName(i interface{}, k string) (warnings []string, errors return } + +func AutonomousDatabasePassword(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) + return + } + + if len(v) < 12 || len(v) > 30 { + errors = append(errors, fmt.Errorf("%v must be 12 to 30 characters", k)) + return + } + + hasUpper := false + hasLower := false + hasNumber := false + hasDoubleQuote := false + for _, r := range v { + if r == '"' { + hasDoubleQuote = true + } else if unicode.IsUpper(r) { + hasUpper = true + } else if unicode.IsLower(r) { + hasLower = true + } else if unicode.IsNumber(r) { + hasNumber = true + } + } + if hasDoubleQuote { + errors = append(errors, fmt.Errorf("%v must not contain the double quote (\") character", k)) + return + } + if !hasUpper { + errors = append(errors, fmt.Errorf("%v must contain at least one uppercase letter", k)) + return + } + if !hasLower { + errors = append(errors, fmt.Errorf("%v must contain at least one lowercase letter", k)) + return + } + if !hasNumber { + errors = append(errors, fmt.Errorf("%v must contain at least one number", k)) + return + } + if strings.Contains(v, "admin") { + errors = append(errors, fmt.Errorf("%v must not contain the username \"admin\"", k)) + return + } + + return +} + +func LicenseType(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) + return + } + + if v != string(autonomousdatabases.LicenseModelLicenseIncluded) && v != string(autonomousdatabases.LicenseModelBringYourOwnLicense) { + errors = append(errors, fmt.Errorf("%v must be %v or %v", k, + string(cloudexadatainfrastructures.PatchingModeRolling), string(cloudexadatainfrastructures.PatchingModeNonRolling))) + return + } + + return +} + +func CustomerContactEmail(v interface{}, k string) (warnings []string, errors []error) { + value, ok := v.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) + return + } + + if len(value) == 0 { + errors = append(errors, fmt.Errorf("%q cannot be an empty string: %q", k, v)) + return warnings, errors + } + + vSegments := strings.Split(value, ".") + if len(vSegments) < 2 || len(vSegments) > 34 { + errors = append(errors, fmt.Errorf("%q must be between 2 and 34 segments", k)) + return warnings, errors + } + + for _, segment := range vSegments { + if segment == "" { + errors = append(errors, fmt.Errorf("%q cannot contain consecutive period", k)) + return warnings, errors + } + + if len(segment) > 63 { + errors = append(errors, fmt.Errorf("the each segment of the `email` must contain between 1 and 63 characters")) + return warnings, errors + } + } + + if !regexp.MustCompile(`^[a-zA-Z\d._-]+$`).MatchString(value) { + errors = append(errors, fmt.Errorf("%q only contains letters, numbers, underscores, dashes and periods", k)) + return warnings, errors + } + + return warnings, errors +} diff --git a/website/docs/r/oracle_autonomous_database_regular.html.markdown b/website/docs/r/oracle_autonomous_database_regular.html.markdown index 81e70f8309ab..83e48a65b0ba 100644 --- a/website/docs/r/oracle_autonomous_database_regular.html.markdown +++ b/website/docs/r/oracle_autonomous_database_regular.html.markdown @@ -45,13 +45,13 @@ The following arguments are supported: * `backup_retention_period_in_days` - (Optional) (Updatable) Retention period, in days, for backups. * `character_set` - (Required) The character set for the autonomous database. The default is AL32UTF8. Allowed values are: - AL32UTF8, AR8ADOS710, AR8ADOS720, AR8APTEC715, AR8ARABICMACS, AR8ASMO8X, AR8ISO8859P6, AR8MSWIN1256, AR8MUSSAD768, AR8NAFITHA711, AR8NAFITHA721, AR8SAKHR706, AR8SAKHR707, AZ8ISO8859P9E, BG8MSWIN, BG8PC437S, BLT8CP921, BLT8ISO8859P13, BLT8MSWIN1257, BLT8PC775, BN8BSCII, CDN8PC863, CEL8ISO8859P14, CL8ISO8859P5, CL8ISOIR111, CL8KOI8R, CL8KOI8U, CL8MACCYRILLICS, CL8MSWIN1251, EE8ISO8859P2, EE8MACCES, EE8MACCROATIANS, EE8MSWIN1250, EE8PC852, EL8DEC, EL8ISO8859P7, EL8MACGREEKS, EL8MSWIN1253, EL8PC437S, EL8PC851, EL8PC869, ET8MSWIN923, HU8ABMOD, HU8CWI2, IN8ISCII, IS8PC861, IW8ISO8859P8, IW8MACHEBREWS, IW8MSWIN1255, IW8PC1507, JA16EUC, JA16EUCTILDE, JA16SJIS, JA16SJISTILDE, JA16VMS, KO16KSC5601, KO16KSCCS, KO16MSWIN949, LA8ISO6937, LA8PASSPORT, LT8MSWIN921, LT8PC772, LT8PC774, LV8PC1117, LV8PC8LR, LV8RST104090, N8PC865, NE8ISO8859P10, NEE8ISO8859P4, RU8BESTA, RU8PC855, RU8PC866, SE8ISO8859P3, TH8MACTHAIS, TH8TISASCII, TR8DEC, TR8MACTURKISHS, TR8MSWIN1254, TR8PC857, US7ASCII, US8PC437, UTF8, VN8MSWIN1258, VN8VN3, WE8DEC, WE8DG, WE8ISO8859P1, WE8ISO8859P15, WE8ISO8859P9, WE8MACROMAN8S, WE8MSWIN1252, WE8NCR4970, WE8NEXTSTEP, WE8PC850, WE8PC858, WE8PC860, WE8ROMAN8, ZHS16CGB231280, ZHS16GBK, ZHT16BIG5, ZHT16CCDC, ZHT16DBT, ZHT16HKSCS, ZHT16MSWIN950, ZHT32EUC, ZHT32SOPS, ZHT32TRIS + `AL32UTF8`, `AR8ADOS710`, `AR8ADOS720`, `AR8APTEC715`, `AR8ARABICMACS`, `AR8ASMO8X`, `AR8ISO8859P6`, `AR8MSWIN1256`, `AR8MUSSAD768`, `AR8NAFITHA711`, `AR8NAFITHA721`, `AR8SAKHR706`, `AR8SAKHR707`, `AZ8ISO8859P9E`, `BG8MSWIN`, `BG8PC437S`, `BLT8CP921`, `BLT8ISO8859P13`, `BLT8MSWIN1257`, `BLT8PC775`, `BN8BSCII`, `CDN8PC863`, `CEL8ISO8859P14`, `CL8ISO8859P5`, `CL8ISOIR111`, `CL8KOI8R`, `CL8KOI8U`, `CL8MACCYRILLICS`, `CL8MSWIN1251`, `EE8ISO8859P2`, `EE8MACCES`, `EE8MACCROATIANS`, `EE8MSWIN1250`, `EE8PC852`, `EL8DEC`, `EL8ISO8859P7`, `EL8MACGREEKS`, `EL8MSWIN1253`, `EL8PC437S`, `EL8PC851`, `EL8PC869`, `ET8MSWIN923`, `HU8ABMOD`, `HU8CWI2`, `IN8ISCII`, `IS8PC861`, `IW8ISO8859P8`, `IW8MACHEBREWS`, `IW8MSWIN1255`, `IW8PC1507`, `JA16EUC`, `JA16EUCTILDE`, `JA16SJIS`, `JA16SJISTILDE`, `JA16VMS`, `KO16KSC5601`, `KO16KSCCS`, `KO16MSWIN949`, `LA8ISO6937`, `LA8PASSPORT`, `LT8MSWIN921`, `LT8PC772`, `LT8PC774`, `LV8PC1117`, `LV8PC8LR`, `LV8RST104090`, `N8PC865`, `NE8ISO8859P10`, `NEE8ISO8859P4`, `RU8BESTA`, `RU8PC855`, `RU8PC866`, `SE8ISO8859P3`, `TH8MACTHAIS`, `TH8TISASCII`, `TR8DEC`, `TR8MACTURKISHS`, `TR8MSWIN1254`, `TR8PC857`, `US7ASCII`, `US8PC437`, `UTF8`, `VN8MSWIN1258`, `VN8VN3`, `WE8DEC`, `WE8DG`, `WE8ISO8859P1`, `WE8ISO8859P15`, `WE8ISO8859P9`, `WE8MACROMAN8S`, `WE8MSWIN1252`, `WE8NCR4970`, `WE8NEXTSTEP`, `WE8PC850`, `WE8PC858`, `WE8PC860`, `WE8ROMAN8`, `ZHS16CGB231280`, `ZHS16GBK`, `ZHT16BIG5`, `ZHT16CCDC`, `ZHT16DBT`, `ZHT16HKSCS`, `ZHT16MSWIN950`, `ZHT32EUC`, `ZHT32SOPS`, `ZHT32TRIS` * `compute_count` - (Required) The compute amount (CPUs) available to the database. Minimum and maximum values depend on the compute model and whether the database is an Autonomous Database Serverless instance or an Autonomous Database on Dedicated Exadata Infrastructure. For an Autonomous Database Serverless instance, the 'ECPU' compute model requires a minimum value of one, for databases in the elastic resource pool and minimum value of two, otherwise. Required when using the `computeModel` parameter. When using `cpuCoreCount` parameter, it is an error to specify computeCount to a non-null value. Providing `computeModel` and `computeCount` is the preferred method for both OCPU and ECPU. * `compute_model` - (Required) The compute model of the Autonomous Database. This is required if using the `computeCount` parameter. If using `cpuCoreCount` then it is an error to specify `computeModel` to a non-null value. ECPU compute model is the recommended model and OCPU compute model is legacy. -* `data_storage_size_in_gbs` - (Required) The quantity of data in the database, in gigabytes. +* `data_storage_size_in_tbs` - (Required) The quantity of data in the database, in terabytes. * `db_version` - (Required) A valid Oracle Database version for Autonomous Database. @@ -99,7 +99,7 @@ In addition to the Arguments listed above - the following Attributes are exporte The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: -* `create` - (Defaults to 1 hour) Used when creating the Autonomous Databases. +* `create` - (Defaults to 2 hour) Used when creating the Autonomous Databases. * `read` - (Defaults to 5 minutes) Used when retrieving the Autonomous Databases. * `update` - (Defaults to 30 minutes) Used when updating the Autonomous Databases. * `delete` - (Defaults to 30 minutes) Used when deleting the Autonomous Databases. From cf491d4bcf1ea63f92b487ebdd4b7b6021f04cb7 Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Fri, 18 Oct 2024 00:01:10 +0100 Subject: [PATCH 13/43] * Update docs. --- .../docs/d/oracle_autonomous_database_regular.html.markdown | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/website/docs/d/oracle_autonomous_database_regular.html.markdown b/website/docs/d/oracle_autonomous_database_regular.html.markdown index fc594035da56..7247bc875e94 100644 --- a/website/docs/d/oracle_autonomous_database_regular.html.markdown +++ b/website/docs/d/oracle_autonomous_database_regular.html.markdown @@ -47,8 +47,7 @@ In addition to the Arguments listed above - the following Attributes are exporte * `backup_retention_period_in_days` - Retention period, in days, for backups. -* `character_set` - The character set for the autonomous database. The default is AL32UTF8. Allowed values are: - * AL32UTF8, AR8ADOS710, AR8ADOS720, AR8APTEC715, AR8ARABICMACS, AR8ASMO8X, AR8ISO8859P6, AR8MSWIN1256, AR8MUSSAD768, AR8NAFITHA711, AR8NAFITHA721, AR8SAKHR706, AR8SAKHR707, AZ8ISO8859P9E, BG8MSWIN, BG8PC437S, BLT8CP921, BLT8ISO8859P13, BLT8MSWIN1257, BLT8PC775, BN8BSCII, CDN8PC863, CEL8ISO8859P14, CL8ISO8859P5, CL8ISOIR111, CL8KOI8R, CL8KOI8U, CL8MACCYRILLICS, CL8MSWIN1251, EE8ISO8859P2, EE8MACCES, EE8MACCROATIANS, EE8MSWIN1250, EE8PC852, EL8DEC, EL8ISO8859P7, EL8MACGREEKS, EL8MSWIN1253, EL8PC437S, EL8PC851, EL8PC869, ET8MSWIN923, HU8ABMOD, HU8CWI2, IN8ISCII, IS8PC861, IW8ISO8859P8, IW8MACHEBREWS, IW8MSWIN1255, IW8PC1507, JA16EUC, JA16EUCTILDE, JA16SJIS, JA16SJISTILDE, JA16VMS, KO16KSC5601, KO16KSCCS, KO16MSWIN949, LA8ISO6937, LA8PASSPORT, LT8MSWIN921, LT8PC772, LT8PC774, LV8PC1117, LV8PC8LR, LV8RST104090, N8PC865, NE8ISO8859P10, NEE8ISO8859P4, RU8BESTA, RU8PC855, RU8PC866, SE8ISO8859P3, TH8MACTHAIS, TH8TISASCII, TR8DEC, TR8MACTURKISHS, TR8MSWIN1254, TR8PC857, US7ASCII, US8PC437, UTF8, VN8MSWIN1258, VN8VN3, WE8DEC, WE8DG, WE8ISO8859P1, WE8ISO8859P15, WE8ISO8859P9, WE8MACROMAN8S, WE8MSWIN1252, WE8NCR4970, WE8NEXTSTEP, WE8PC850, WE8PC858, WE8PC860, WE8ROMAN8, ZHS16CGB231280, ZHS16GBK, ZHT16BIG5, ZHT16CCDC, ZHT16DBT, ZHT16HKSCS, ZHT16MSWIN950, ZHT32EUC, ZHT32SOPS, ZHT32TRIS +* `character_set` - The character set for the autonomous database. * `compute_count` - The compute amount (CPUs) available to the database. Minimum and maximum values depend on the compute model and whether the database is an Autonomous Database Serverless instance or an Autonomous Database on Dedicated Exadata Infrastructure. For an Autonomous Database Serverless instance, the 'ECPU' compute model requires a minimum value of one, for databases in the elastic resource pool and minimum value of two, otherwise. Required when using the `computeModel` parameter. When using `cpuCoreCount` parameter, it is an error to specify computeCount to a non-null value. Providing `computeModel` and `computeCount` is the preferred method for both OCPU and ECPU. From e61bb90ffe7848b18986015632af0a6bd76d3ea4 Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Fri, 18 Oct 2024 00:16:55 +0100 Subject: [PATCH 14/43] * Add test. --- ...tonomous_database_regular_resource_test.go | 65 +++++++++++++++++-- 1 file changed, 61 insertions(+), 4 deletions(-) diff --git a/internal/services/oracle/autonomous_database_regular_resource_test.go b/internal/services/oracle/autonomous_database_regular_resource_test.go index 7a89fa187ba8..e12cdd62452a 100644 --- a/internal/services/oracle/autonomous_database_regular_resource_test.go +++ b/internal/services/oracle/autonomous_database_regular_resource_test.go @@ -44,6 +44,20 @@ func TestAdbsRegularResource_basic(t *testing.T) { }) } +func TestAdbsRegularResource_complete(t *testing.T) { + data := acceptance.BuildTestData(t, oracle.AutonomousDatabaseRegularResource{}.ResourceType(), "test") + r := AdbsRegularResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + func TestAdbsRegularResource_update(t *testing.T) { data := acceptance.BuildTestData(t, oracle.AutonomousDatabaseRegularResource{}.ResourceType(), "test") r := AdbsRegularResource{} @@ -82,9 +96,51 @@ func TestAdbsRegularResource_requiresImport(t *testing.T) { func (a AdbsRegularResource) basic(data acceptance.TestData) string { return fmt.Sprintf(` +%s + +provider "azurerm" { + features {} +} + +resource "azurerm_oracle_autonomous_database" "test" { + name = "OFake%[2]d" + + display_name = "OFake%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = "%[3]s" + compute_model = "ECPU" + compute_count = "2" + license_model = "BringYourOwnLicense" + backup_retention_period_in_days = 12 + auto_scaling_enabled = false + auto_scaling_for_storage_enabled = false + mtls_connection_required = false + data_storage_size_in_gbs = "32" + db_workload = "OLTP" + admin_password = "TestPass#2024#" + db_version = "19c" + character_set = "AL32UTF8" + ncharacter_set = "AL16UTF16" + subnet_id = azurerm_subnet.virtual_network_subnet.id + vnet_id = azurerm_virtual_network.virtual_network.id + lifecycle { + ignore_changes = [ + admin_password + ] + } +} +`, a.template(data), data.RandomInteger, data.Locations.Primary) +} + +func (a AdbsRegularResource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` %s +provider "azurerm" { + features {} +} + resource "azurerm_oracle_autonomous_database" "test" { name = "OFake%[2]d" @@ -106,6 +162,7 @@ resource "azurerm_oracle_autonomous_database" "test" { ncharacter_set = "AL16UTF16" subnet_id = azurerm_subnet.virtual_network_subnet.id vnet_id = azurerm_virtual_network.virtual_network.id + customer_contacts = ["test@test.com"] lifecycle { ignore_changes = [ admin_password @@ -118,9 +175,12 @@ resource "azurerm_oracle_autonomous_database" "test" { func (a AdbsRegularResource) update(data acceptance.TestData) string { return fmt.Sprintf(` - %s +provider "azurerm" { + features {} +} + resource "azurerm_oracle_autonomous_database" "test" { name = "OFake%[2]d" display_name = "OFake%[2]d" @@ -188,9 +248,6 @@ resource "azurerm_oracle_autonomous_database" "import" { func (a AdbsRegularResource) template(data acceptance.TestData) string { return fmt.Sprintf(` -provider "azurerm" { - features {} -} data "azurerm_client_config" "current" {} From ef61cbf152c8a5e088efa7410d7f5b8012b922c7 Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Fri, 18 Oct 2024 00:17:29 +0100 Subject: [PATCH 15/43] * Add test. --- .../oracle/autonomous_database_regular_resource_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/oracle/autonomous_database_regular_resource_test.go b/internal/services/oracle/autonomous_database_regular_resource_test.go index e12cdd62452a..ebab715c3a88 100644 --- a/internal/services/oracle/autonomous_database_regular_resource_test.go +++ b/internal/services/oracle/autonomous_database_regular_resource_test.go @@ -187,7 +187,7 @@ resource "azurerm_oracle_autonomous_database" "test" { resource_group_name = azurerm_resource_group.test.name location = "%[3]s" compute_model = "ECPU" - compute_count = "2" + compute_count = "3" license_model = "BringYourOwnLicense" backup_retention_period_in_days = 12 auto_scaling_enabled = false From 5b8d54f8d620ea09bf1901a64d0a71059f3c137e Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Fri, 18 Oct 2024 00:23:13 +0100 Subject: [PATCH 16/43] * Add test. --- .../oracle/autonomous_database_regular_resource_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/services/oracle/autonomous_database_regular_resource_test.go b/internal/services/oracle/autonomous_database_regular_resource_test.go index ebab715c3a88..76cca9f6fc88 100644 --- a/internal/services/oracle/autonomous_database_regular_resource_test.go +++ b/internal/services/oracle/autonomous_database_regular_resource_test.go @@ -115,7 +115,7 @@ resource "azurerm_oracle_autonomous_database" "test" { auto_scaling_enabled = false auto_scaling_for_storage_enabled = false mtls_connection_required = false - data_storage_size_in_gbs = "32" + data_storage_size_in_tbs = "2" db_workload = "OLTP" admin_password = "TestPass#2024#" db_version = "19c" @@ -154,7 +154,7 @@ resource "azurerm_oracle_autonomous_database" "test" { auto_scaling_enabled = false auto_scaling_for_storage_enabled = false mtls_connection_required = false - data_storage_size_in_gbs = "32" + data_storage_size_in_tbs = "2" db_workload = "OLTP" admin_password = "TestPass#2024#" db_version = "19c" @@ -193,7 +193,7 @@ resource "azurerm_oracle_autonomous_database" "test" { auto_scaling_enabled = false auto_scaling_for_storage_enabled = false mtls_connection_required = false - data_storage_size_in_gbs = "32" + data_storage_size_in_tbs = "2" db_workload = "OLTP" admin_password = "TestPass#2024#" db_version = "19c" @@ -229,7 +229,7 @@ resource "azurerm_oracle_autonomous_database" "import" { auto_scaling_enabled = azurerm_oracle_autonomous_database.test.auto_scaling_enabled auto_scaling_for_storage_enabled = azurerm_oracle_autonomous_database.test.auto_scaling_for_storage_enabled mtls_connection_required = azurerm_oracle_autonomous_database.test.mtls_connection_required - data_storage_size_in_gbs = azurerm_oracle_autonomous_database.test.data_storage_size_in_gbs + data_storage_size_in_tbs = azurerm_oracle_autonomous_database.test.data_storage_size_in_tbs db_workload = azurerm_oracle_autonomous_database.test.db_workload admin_password = azurerm_oracle_autonomous_database.test.admin_password db_version = azurerm_oracle_autonomous_database.test.db_version From f84395bce2c5a98c47cd0f75497e15721acf001a Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Fri, 18 Oct 2024 01:02:04 +0100 Subject: [PATCH 17/43] * Fix. --- .../services/oracle/autonomous_database_regular_resource.go | 3 ++- .../oracle/autonomous_database_regular_resource_test.go | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/services/oracle/autonomous_database_regular_resource.go b/internal/services/oracle/autonomous_database_regular_resource.go index f6c19bfc1110..263c016ab97a 100644 --- a/internal/services/oracle/autonomous_database_regular_resource.go +++ b/internal/services/oracle/autonomous_database_regular_resource.go @@ -221,7 +221,8 @@ func (r AutonomousDatabaseRegularResource) Create() sdk.ResourceFunc { ComputeCount: pointer.To(model.ComputeCount), ComputeModel: pointer.To(autonomousdatabases.ComputeModel(model.ComputeModel)), CustomerContacts: pointer.To(expandAdbsCustomerContacts(model.CustomerContacts)), - DataStorageSizeInGbs: pointer.To(model.DataStorageSizeInTbs), + DataBaseType: "Regular", + DataStorageSizeInTbs: pointer.To(model.DataStorageSizeInTbs), DbWorkload: pointer.To(autonomousdatabases.WorkloadType(model.DbWorkload)), DbVersion: pointer.To(model.DbVersion), DisplayName: pointer.To(model.DisplayName), diff --git a/internal/services/oracle/autonomous_database_regular_resource_test.go b/internal/services/oracle/autonomous_database_regular_resource_test.go index 76cca9f6fc88..7e36a71f8e43 100644 --- a/internal/services/oracle/autonomous_database_regular_resource_test.go +++ b/internal/services/oracle/autonomous_database_regular_resource_test.go @@ -115,7 +115,7 @@ resource "azurerm_oracle_autonomous_database" "test" { auto_scaling_enabled = false auto_scaling_for_storage_enabled = false mtls_connection_required = false - data_storage_size_in_tbs = "2" + data_storage_size_in_tbs = "1" db_workload = "OLTP" admin_password = "TestPass#2024#" db_version = "19c" @@ -154,7 +154,7 @@ resource "azurerm_oracle_autonomous_database" "test" { auto_scaling_enabled = false auto_scaling_for_storage_enabled = false mtls_connection_required = false - data_storage_size_in_tbs = "2" + data_storage_size_in_tbs = "1" db_workload = "OLTP" admin_password = "TestPass#2024#" db_version = "19c" @@ -193,7 +193,7 @@ resource "azurerm_oracle_autonomous_database" "test" { auto_scaling_enabled = false auto_scaling_for_storage_enabled = false mtls_connection_required = false - data_storage_size_in_tbs = "2" + data_storage_size_in_tbs = "1" db_workload = "OLTP" admin_password = "TestPass#2024#" db_version = "19c" From 88dd6de12b57497ba6bf79bb89d4319500f9db7a Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Fri, 18 Oct 2024 08:35:37 +0100 Subject: [PATCH 18/43] * Fix validator and tests. --- ...omous_database_regular_data_source_test.go | 2 +- .../autonomous_database_regular_resource.go | 2 +- .../validate/autonomous_database_regular.go | 36 ++++--------------- 3 files changed, 9 insertions(+), 31 deletions(-) diff --git a/internal/services/oracle/autonomous_database_regular_data_source_test.go b/internal/services/oracle/autonomous_database_regular_data_source_test.go index d2cbed82ff52..2a1b513c8bb8 100644 --- a/internal/services/oracle/autonomous_database_regular_data_source_test.go +++ b/internal/services/oracle/autonomous_database_regular_data_source_test.go @@ -24,7 +24,7 @@ func TestAdbsRegularDataSource_basic(t *testing.T) { check.That(data.ResourceName).Key("location").Exists(), check.That(data.ResourceName).Key("name").Exists(), check.That(data.ResourceName).Key("resource_group_name").Exists(), - check.That(data.ResourceName).Key("data_storage_size_in_gbs").Exists(), + check.That(data.ResourceName).Key("data_storage_size_in_tbs").Exists(), check.That(data.ResourceName).Key("display_name").Exists(), check.That(data.ResourceName).Key("license_model").Exists(), ), diff --git a/internal/services/oracle/autonomous_database_regular_resource.go b/internal/services/oracle/autonomous_database_regular_resource.go index 263c016ab97a..2414ac43cba1 100644 --- a/internal/services/oracle/autonomous_database_regular_resource.go +++ b/internal/services/oracle/autonomous_database_regular_resource.go @@ -342,7 +342,7 @@ func (AutonomousDatabaseRegularResource) Read() sdk.ResourceFunc { state.ComputeCount = pointer.From(adbsPropModel.ComputeCount) state.ComputeModel = string(pointer.From(adbsPropModel.ComputeModel)) state.CustomerContacts = flattenAdbsCustomerContacts(adbsPropModel.CustomerContacts) - state.DataStorageSizeInTbs = pointer.From(adbsPropModel.DataStorageSizeInGbs) + state.DataStorageSizeInTbs = pointer.From(adbsPropModel.DataStorageSizeInTbs) state.DbWorkload = string(pointer.From(adbsPropModel.DbWorkload)) state.DbVersion = pointer.From(adbsPropModel.DbVersion) state.DisplayName = pointer.From(adbsPropModel.DisplayName) diff --git a/internal/services/oracle/validate/autonomous_database_regular.go b/internal/services/oracle/validate/autonomous_database_regular.go index 686eca34825d..d729f4e61b8e 100644 --- a/internal/services/oracle/validate/autonomous_database_regular.go +++ b/internal/services/oracle/validate/autonomous_database_regular.go @@ -2,7 +2,7 @@ package validate import ( "fmt" - "regexp" + "net/mail" "strings" "unicode" "unicode/utf8" @@ -106,39 +106,17 @@ func LicenseType(i interface{}, k string) (warnings []string, errors []error) { return } -func CustomerContactEmail(v interface{}, k string) (warnings []string, errors []error) { - value, ok := v.(string) +func CustomerContactEmail(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) if !ok { errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) return } - if len(value) == 0 { - errors = append(errors, fmt.Errorf("%q cannot be an empty string: %q", k, v)) - return warnings, errors - } - - vSegments := strings.Split(value, ".") - if len(vSegments) < 2 || len(vSegments) > 34 { - errors = append(errors, fmt.Errorf("%q must be between 2 and 34 segments", k)) - return warnings, errors - } - - for _, segment := range vSegments { - if segment == "" { - errors = append(errors, fmt.Errorf("%q cannot contain consecutive period", k)) - return warnings, errors - } - - if len(segment) > 63 { - errors = append(errors, fmt.Errorf("the each segment of the `email` must contain between 1 and 63 characters")) - return warnings, errors - } - } - - if !regexp.MustCompile(`^[a-zA-Z\d._-]+$`).MatchString(value) { - errors = append(errors, fmt.Errorf("%q only contains letters, numbers, underscores, dashes and periods", k)) - return warnings, errors + _, err := mail.ParseAddress(v) + if err != nil { + errors = append(errors, fmt.Errorf("%v must be a valid email address", k)) + return } return warnings, errors From 9547adbd8a34bf3553c6569645b7fd5f023c83be Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Fri, 18 Oct 2024 08:56:06 +0100 Subject: [PATCH 19/43] * Linting errors. --- .../oracle/autonomous_database_regular_resource.go | 10 ++++------ .../oracle/validate/autonomous_database_regular.go | 9 ++++++--- .../d/oracle_autonomous_database_regular.html.markdown | 2 +- .../r/oracle_autonomous_database_regular.html.markdown | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/internal/services/oracle/autonomous_database_regular_resource.go b/internal/services/oracle/autonomous_database_regular_resource.go index 2414ac43cba1..6f42a4cbc339 100644 --- a/internal/services/oracle/autonomous_database_regular_resource.go +++ b/internal/services/oracle/autonomous_database_regular_resource.go @@ -391,12 +391,10 @@ func (AutonomousDatabaseRegularResource) IDValidationFunc() pluginsdk.SchemaVali func expandAdbsCustomerContacts(customerContactsList []string) []autonomousdatabases.CustomerContact { var customerContacts []autonomousdatabases.CustomerContact - if customerContactsList != nil { - for _, customerContact := range customerContactsList { - customerContacts = append(customerContacts, autonomousdatabases.CustomerContact{ - Email: customerContact, - }) - } + for _, customerContact := range customerContactsList { + customerContacts = append(customerContacts, autonomousdatabases.CustomerContact{ + Email: customerContact, + }) } return customerContacts } diff --git a/internal/services/oracle/validate/autonomous_database_regular.go b/internal/services/oracle/validate/autonomous_database_regular.go index d729f4e61b8e..2007fe31da51 100644 --- a/internal/services/oracle/validate/autonomous_database_regular.go +++ b/internal/services/oracle/validate/autonomous_database_regular.go @@ -58,11 +58,14 @@ func AutonomousDatabasePassword(i interface{}, k string) (warnings []string, err for _, r := range v { if r == '"' { hasDoubleQuote = true - } else if unicode.IsUpper(r) { + } + if unicode.IsUpper(r) { hasUpper = true - } else if unicode.IsLower(r) { + } + if unicode.IsLower(r) { hasLower = true - } else if unicode.IsNumber(r) { + } + if unicode.IsNumber(r) { hasNumber = true } } diff --git a/website/docs/d/oracle_autonomous_database_regular.html.markdown b/website/docs/d/oracle_autonomous_database_regular.html.markdown index 7247bc875e94..659c18abde9f 100644 --- a/website/docs/d/oracle_autonomous_database_regular.html.markdown +++ b/website/docs/d/oracle_autonomous_database_regular.html.markdown @@ -1,5 +1,5 @@ --- -subcategory: "App Service" +subcategory: "Oracle" layout: "azurerm" page_title: "Azure Resource Manager: Data Source: azurerm_oracle_autonomous_database" description: |- diff --git a/website/docs/r/oracle_autonomous_database_regular.html.markdown b/website/docs/r/oracle_autonomous_database_regular.html.markdown index 83e48a65b0ba..3fba2a7ff692 100644 --- a/website/docs/r/oracle_autonomous_database_regular.html.markdown +++ b/website/docs/r/oracle_autonomous_database_regular.html.markdown @@ -1,5 +1,5 @@ --- -subcategory: "App Service" +subcategory: "Oracle" layout: "azurerm" page_title: "Azure Resource Manager: azurerm_oracle_autonomous_database" description: |- From 53985ac8b6a1a9e7efb438467bcb89c48483ed0b Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Fri, 18 Oct 2024 09:11:02 +0100 Subject: [PATCH 20/43] * Reorder. --- .../services/oracle/autonomous_database_regular_resource.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/services/oracle/autonomous_database_regular_resource.go b/internal/services/oracle/autonomous_database_regular_resource.go index 6f42a4cbc339..d693af051ff0 100644 --- a/internal/services/oracle/autonomous_database_regular_resource.go +++ b/internal/services/oracle/autonomous_database_regular_resource.go @@ -337,7 +337,9 @@ func (AutonomousDatabaseRegularResource) Read() sdk.ResourceFunc { case autonomousdatabases.AutonomousDatabaseProperties: var state AutonomousDatabaseRegularResourceModel state.AdminPassword = pointer.From(adbsPropModel.AdminPassword) + state.AutoScalingEnabled = pointer.From(adbsPropModel.IsAutoScalingEnabled) state.BackupRetentionPeriodInDays = pointer.From(adbsPropModel.BackupRetentionPeriodInDays) + state.AutoScalingForStorageEnabled = pointer.From(adbsPropModel.IsAutoScalingForStorageEnabled) state.CharacterSet = pointer.From(adbsPropModel.CharacterSet) state.ComputeCount = pointer.From(adbsPropModel.ComputeCount) state.ComputeModel = string(pointer.From(adbsPropModel.ComputeModel)) @@ -346,11 +348,9 @@ func (AutonomousDatabaseRegularResource) Read() sdk.ResourceFunc { state.DbWorkload = string(pointer.From(adbsPropModel.DbWorkload)) state.DbVersion = pointer.From(adbsPropModel.DbVersion) state.DisplayName = pointer.From(adbsPropModel.DisplayName) - state.AutoScalingEnabled = pointer.From(adbsPropModel.IsAutoScalingEnabled) - state.AutoScalingForStorageEnabled = pointer.From(adbsPropModel.IsAutoScalingForStorageEnabled) + state.LicenseModel = string(pointer.From(adbsPropModel.LicenseModel)) state.Location = result.Model.Location state.Name = pointer.ToString(result.Model.Name) - state.LicenseModel = string(pointer.From(adbsPropModel.LicenseModel)) state.NcharacterSet = pointer.From(adbsPropModel.NcharacterSet) state.ResourceGroupName = id.ResourceGroupName state.SubnetId = pointer.From(adbsPropModel.SubnetId) From ad7b159e898656a1c42574fa9c12968068741ab4 Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Fri, 18 Oct 2024 09:18:20 +0100 Subject: [PATCH 21/43] * Update field. --- .../oracle/autonomous_database_regular_data_source.go | 4 ++-- .../docs/d/oracle_autonomous_database_regular.html.markdown | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/services/oracle/autonomous_database_regular_data_source.go b/internal/services/oracle/autonomous_database_regular_data_source.go index fe47494fa7ca..60b139b0b015 100644 --- a/internal/services/oracle/autonomous_database_regular_data_source.go +++ b/internal/services/oracle/autonomous_database_regular_data_source.go @@ -67,7 +67,7 @@ type AutonomousDatabaseRegularDataModel struct { TimeCreated string `tfschema:"time_created"` TimeDataGuardRoleChanged string `tfschema:"time_data_guard_role_changed"` TimeDeletionOfFreeAutonomousDatabase string `tfschema:"time_deletion_of_free_autonomous_database"` - TimeLocalDataGuardEnabled string `tfschema:"time_local_data_guard_enabled"` + TimeLocalDataGuardEnabled string `tfschema:"time_local_data_guard_enabled_on"` TimeMaintenanceBegin string `tfschema:"time_maintenance_begin"` TimeMaintenanceEnd string `tfschema:"time_maintenance_end"` TimeOfLastFailover string `tfschema:"time_of_last_failover"` @@ -320,7 +320,7 @@ func (d AutonomousDatabaseRegularDataSource) Attributes() map[string]*pluginsdk. Computed: true, }, - "time_local_data_guard_enabled": { + "time_local_data_guard_enabled_on": { Type: pluginsdk.TypeString, Computed: true, }, diff --git a/website/docs/d/oracle_autonomous_database_regular.html.markdown b/website/docs/d/oracle_autonomous_database_regular.html.markdown index 659c18abde9f..883b19e594fc 100644 --- a/website/docs/d/oracle_autonomous_database_regular.html.markdown +++ b/website/docs/d/oracle_autonomous_database_regular.html.markdown @@ -125,7 +125,7 @@ In addition to the Arguments listed above - the following Attributes are exporte * `time_deletion_of_free_autonomous_database` - The date and time the Always Free database will be automatically deleted because of inactivity. If the database is in the STOPPED state and without activity until this time, it will be deleted. -* `time_local_data_guard_enabled` - The date and time that Autonomous Data Guard was enabled for an Autonomous Database where the standby was provisioned in the same region as the primary database. +* `time_local_data_guard_enabled_on` - The date and time that Autonomous Data Guard was enabled for an Autonomous Database where the standby was provisioned in the same region as the primary database. * `time_maintenance_begin` - The date and time when maintenance will begin. From b74e28bd59bad806c727766f94346e18a268ec62 Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Fri, 18 Oct 2024 10:47:29 +0100 Subject: [PATCH 22/43] * Update tests. --- .../oracle/autonomous_database_regular_resource_test.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/internal/services/oracle/autonomous_database_regular_resource_test.go b/internal/services/oracle/autonomous_database_regular_resource_test.go index 7e36a71f8e43..0ab48b7ec110 100644 --- a/internal/services/oracle/autonomous_database_regular_resource_test.go +++ b/internal/services/oracle/autonomous_database_regular_resource_test.go @@ -201,9 +201,6 @@ resource "azurerm_oracle_autonomous_database" "test" { ncharacter_set = "AL16UTF16" subnet_id = azurerm_subnet.virtual_network_subnet.id vnet_id = azurerm_virtual_network.virtual_network.id - tags = { - test = "test1" - } lifecycle { ignore_changes = [ admin_password @@ -231,7 +228,7 @@ resource "azurerm_oracle_autonomous_database" "import" { mtls_connection_required = azurerm_oracle_autonomous_database.test.mtls_connection_required data_storage_size_in_tbs = azurerm_oracle_autonomous_database.test.data_storage_size_in_tbs db_workload = azurerm_oracle_autonomous_database.test.db_workload - admin_password = azurerm_oracle_autonomous_database.test.admin_password + admin_password = "TestPass#2024#" db_version = azurerm_oracle_autonomous_database.test.db_version character_set = azurerm_oracle_autonomous_database.test.character_set ncharacter_set = azurerm_oracle_autonomous_database.test.ncharacter_set From 309e141d247d7ef87fa8a8d3ed8d6525f52247b2 Mon Sep 17 00:00:00 2001 From: eelhomsi Date: Fri, 18 Oct 2024 12:40:26 +0100 Subject: [PATCH 23/43] Populate vnetId --- internal/services/oracle/cloud_vm_cluster_data_source.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/services/oracle/cloud_vm_cluster_data_source.go b/internal/services/oracle/cloud_vm_cluster_data_source.go index 798bbbba760b..e9512a40eec9 100644 --- a/internal/services/oracle/cloud_vm_cluster_data_source.go +++ b/internal/services/oracle/cloud_vm_cluster_data_source.go @@ -498,6 +498,7 @@ func (d CloudVmClusterDataSource) Read() sdk.ResourceFunc { state.SystemVersion = pointer.From(props.SystemVersion) state.TimeCreated = pointer.From(props.TimeCreated) state.TimeZone = pointer.From(props.TimeZone) + state.VnetId = props.VnetId state.ZoneId = pointer.From(props.ZoneId) } } From b0c0789533d6940a4d2f3009abfec75d0f2a00dc Mon Sep 17 00:00:00 2001 From: eelhomsi Date: Tue, 22 Oct 2024 19:10:38 +0100 Subject: [PATCH 24/43] Update website/docs/r/oracle_autonomous_database_regular.html.markdown Co-authored-by: kt --- .../docs/r/oracle_autonomous_database_regular.html.markdown | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/website/docs/r/oracle_autonomous_database_regular.html.markdown b/website/docs/r/oracle_autonomous_database_regular.html.markdown index 3fba2a7ff692..a8a8afa99d5c 100644 --- a/website/docs/r/oracle_autonomous_database_regular.html.markdown +++ b/website/docs/r/oracle_autonomous_database_regular.html.markdown @@ -44,8 +44,7 @@ The following arguments are supported: * `backup_retention_period_in_days` - (Optional) (Updatable) Retention period, in days, for backups. -* `character_set` - (Required) The character set for the autonomous database. The default is AL32UTF8. Allowed values are: - `AL32UTF8`, `AR8ADOS710`, `AR8ADOS720`, `AR8APTEC715`, `AR8ARABICMACS`, `AR8ASMO8X`, `AR8ISO8859P6`, `AR8MSWIN1256`, `AR8MUSSAD768`, `AR8NAFITHA711`, `AR8NAFITHA721`, `AR8SAKHR706`, `AR8SAKHR707`, `AZ8ISO8859P9E`, `BG8MSWIN`, `BG8PC437S`, `BLT8CP921`, `BLT8ISO8859P13`, `BLT8MSWIN1257`, `BLT8PC775`, `BN8BSCII`, `CDN8PC863`, `CEL8ISO8859P14`, `CL8ISO8859P5`, `CL8ISOIR111`, `CL8KOI8R`, `CL8KOI8U`, `CL8MACCYRILLICS`, `CL8MSWIN1251`, `EE8ISO8859P2`, `EE8MACCES`, `EE8MACCROATIANS`, `EE8MSWIN1250`, `EE8PC852`, `EL8DEC`, `EL8ISO8859P7`, `EL8MACGREEKS`, `EL8MSWIN1253`, `EL8PC437S`, `EL8PC851`, `EL8PC869`, `ET8MSWIN923`, `HU8ABMOD`, `HU8CWI2`, `IN8ISCII`, `IS8PC861`, `IW8ISO8859P8`, `IW8MACHEBREWS`, `IW8MSWIN1255`, `IW8PC1507`, `JA16EUC`, `JA16EUCTILDE`, `JA16SJIS`, `JA16SJISTILDE`, `JA16VMS`, `KO16KSC5601`, `KO16KSCCS`, `KO16MSWIN949`, `LA8ISO6937`, `LA8PASSPORT`, `LT8MSWIN921`, `LT8PC772`, `LT8PC774`, `LV8PC1117`, `LV8PC8LR`, `LV8RST104090`, `N8PC865`, `NE8ISO8859P10`, `NEE8ISO8859P4`, `RU8BESTA`, `RU8PC855`, `RU8PC866`, `SE8ISO8859P3`, `TH8MACTHAIS`, `TH8TISASCII`, `TR8DEC`, `TR8MACTURKISHS`, `TR8MSWIN1254`, `TR8PC857`, `US7ASCII`, `US8PC437`, `UTF8`, `VN8MSWIN1258`, `VN8VN3`, `WE8DEC`, `WE8DG`, `WE8ISO8859P1`, `WE8ISO8859P15`, `WE8ISO8859P9`, `WE8MACROMAN8S`, `WE8MSWIN1252`, `WE8NCR4970`, `WE8NEXTSTEP`, `WE8PC850`, `WE8PC858`, `WE8PC860`, `WE8ROMAN8`, `ZHS16CGB231280`, `ZHS16GBK`, `ZHT16BIG5`, `ZHT16CCDC`, `ZHT16DBT`, `ZHT16HKSCS`, `ZHT16MSWIN950`, `ZHT32EUC`, `ZHT32SOPS`, `ZHT32TRIS` +* `character_set` - (Required) The character set for the autonomous database. The default is `AL32UTF8`. Allowed values are: `AL32UTF8`, `AR8ADOS710`, `AR8ADOS720`, `AR8APTEC715`, `AR8ARABICMACS`, `AR8ASMO8X`, `AR8ISO8859P6`, `AR8MSWIN1256`, `AR8MUSSAD768`, `AR8NAFITHA711`, `AR8NAFITHA721`, `AR8SAKHR706`, `AR8SAKHR707`, `AZ8ISO8859P9E`, `BG8MSWIN`, `BG8PC437S`, `BLT8CP921`, `BLT8ISO8859P13`, `BLT8MSWIN1257`, `BLT8PC775`, `BN8BSCII`, `CDN8PC863`, `CEL8ISO8859P14`, `CL8ISO8859P5`, `CL8ISOIR111`, `CL8KOI8R`, `CL8KOI8U`, `CL8MACCYRILLICS`, `CL8MSWIN1251`, `EE8ISO8859P2`, `EE8MACCES`, `EE8MACCROATIANS`, `EE8MSWIN1250`, `EE8PC852`, `EL8DEC`, `EL8ISO8859P7`, `EL8MACGREEKS`, `EL8MSWIN1253`, `EL8PC437S`, `EL8PC851`, `EL8PC869`, `ET8MSWIN923`, `HU8ABMOD`, `HU8CWI2`, `IN8ISCII`, `IS8PC861`, `IW8ISO8859P8`, `IW8MACHEBREWS`, `IW8MSWIN1255`, `IW8PC1507`, `JA16EUC`, `JA16EUCTILDE`, `JA16SJIS`, `JA16SJISTILDE`, `JA16VMS`, `KO16KSC5601`, `KO16KSCCS`, `KO16MSWIN949`, `LA8ISO6937`, `LA8PASSPORT`, `LT8MSWIN921`, `LT8PC772`, `LT8PC774`, `LV8PC1117`, `LV8PC8LR`, `LV8RST104090`, `N8PC865`, `NE8ISO8859P10`, `NEE8ISO8859P4`, `RU8BESTA`, `RU8PC855`, `RU8PC866`, `SE8ISO8859P3`, `TH8MACTHAIS`, `TH8TISASCII`, `TR8DEC`, `TR8MACTURKISHS`, `TR8MSWIN1254`, `TR8PC857`, `US7ASCII`, `US8PC437`, `UTF8`, `VN8MSWIN1258`, `VN8VN3`, `WE8DEC`, `WE8DG`, `WE8ISO8859P1`, `WE8ISO8859P15`, `WE8ISO8859P9`, `WE8MACROMAN8S`, `WE8MSWIN1252`, `WE8NCR4970`, `WE8NEXTSTEP`, `WE8PC850`, `WE8PC858`, `WE8PC860`, `WE8ROMAN8`, `ZHS16CGB231280`, `ZHS16GBK`, `ZHT16BIG5`, `ZHT16CCDC`, `ZHT16DBT`, `ZHT16HKSCS`, `ZHT16MSWIN950`, `ZHT32EUC`, `ZHT32SOPS`, `ZHT32TRIS` * `compute_count` - (Required) The compute amount (CPUs) available to the database. Minimum and maximum values depend on the compute model and whether the database is an Autonomous Database Serverless instance or an Autonomous Database on Dedicated Exadata Infrastructure. For an Autonomous Database Serverless instance, the 'ECPU' compute model requires a minimum value of one, for databases in the elastic resource pool and minimum value of two, otherwise. Required when using the `computeModel` parameter. When using `cpuCoreCount` parameter, it is an error to specify computeCount to a non-null value. Providing `computeModel` and `computeCount` is the preferred method for both OCPU and ECPU. From 7d172ebf192d5b885d736e76572286c51686cc96 Mon Sep 17 00:00:00 2001 From: eelhomsi Date: Tue, 22 Oct 2024 19:10:57 +0100 Subject: [PATCH 25/43] Update website/docs/r/oracle_autonomous_database_regular.html.markdown Co-authored-by: kt --- website/docs/r/oracle_autonomous_database_regular.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/oracle_autonomous_database_regular.html.markdown b/website/docs/r/oracle_autonomous_database_regular.html.markdown index a8a8afa99d5c..6ae37adbfc6a 100644 --- a/website/docs/r/oracle_autonomous_database_regular.html.markdown +++ b/website/docs/r/oracle_autonomous_database_regular.html.markdown @@ -46,7 +46,7 @@ The following arguments are supported: * `character_set` - (Required) The character set for the autonomous database. The default is `AL32UTF8`. Allowed values are: `AL32UTF8`, `AR8ADOS710`, `AR8ADOS720`, `AR8APTEC715`, `AR8ARABICMACS`, `AR8ASMO8X`, `AR8ISO8859P6`, `AR8MSWIN1256`, `AR8MUSSAD768`, `AR8NAFITHA711`, `AR8NAFITHA721`, `AR8SAKHR706`, `AR8SAKHR707`, `AZ8ISO8859P9E`, `BG8MSWIN`, `BG8PC437S`, `BLT8CP921`, `BLT8ISO8859P13`, `BLT8MSWIN1257`, `BLT8PC775`, `BN8BSCII`, `CDN8PC863`, `CEL8ISO8859P14`, `CL8ISO8859P5`, `CL8ISOIR111`, `CL8KOI8R`, `CL8KOI8U`, `CL8MACCYRILLICS`, `CL8MSWIN1251`, `EE8ISO8859P2`, `EE8MACCES`, `EE8MACCROATIANS`, `EE8MSWIN1250`, `EE8PC852`, `EL8DEC`, `EL8ISO8859P7`, `EL8MACGREEKS`, `EL8MSWIN1253`, `EL8PC437S`, `EL8PC851`, `EL8PC869`, `ET8MSWIN923`, `HU8ABMOD`, `HU8CWI2`, `IN8ISCII`, `IS8PC861`, `IW8ISO8859P8`, `IW8MACHEBREWS`, `IW8MSWIN1255`, `IW8PC1507`, `JA16EUC`, `JA16EUCTILDE`, `JA16SJIS`, `JA16SJISTILDE`, `JA16VMS`, `KO16KSC5601`, `KO16KSCCS`, `KO16MSWIN949`, `LA8ISO6937`, `LA8PASSPORT`, `LT8MSWIN921`, `LT8PC772`, `LT8PC774`, `LV8PC1117`, `LV8PC8LR`, `LV8RST104090`, `N8PC865`, `NE8ISO8859P10`, `NEE8ISO8859P4`, `RU8BESTA`, `RU8PC855`, `RU8PC866`, `SE8ISO8859P3`, `TH8MACTHAIS`, `TH8TISASCII`, `TR8DEC`, `TR8MACTURKISHS`, `TR8MSWIN1254`, `TR8PC857`, `US7ASCII`, `US8PC437`, `UTF8`, `VN8MSWIN1258`, `VN8VN3`, `WE8DEC`, `WE8DG`, `WE8ISO8859P1`, `WE8ISO8859P15`, `WE8ISO8859P9`, `WE8MACROMAN8S`, `WE8MSWIN1252`, `WE8NCR4970`, `WE8NEXTSTEP`, `WE8PC850`, `WE8PC858`, `WE8PC860`, `WE8ROMAN8`, `ZHS16CGB231280`, `ZHS16GBK`, `ZHT16BIG5`, `ZHT16CCDC`, `ZHT16DBT`, `ZHT16HKSCS`, `ZHT16MSWIN950`, `ZHT32EUC`, `ZHT32SOPS`, `ZHT32TRIS` -* `compute_count` - (Required) The compute amount (CPUs) available to the database. Minimum and maximum values depend on the compute model and whether the database is an Autonomous Database Serverless instance or an Autonomous Database on Dedicated Exadata Infrastructure. For an Autonomous Database Serverless instance, the 'ECPU' compute model requires a minimum value of one, for databases in the elastic resource pool and minimum value of two, otherwise. Required when using the `computeModel` parameter. When using `cpuCoreCount` parameter, it is an error to specify computeCount to a non-null value. Providing `computeModel` and `computeCount` is the preferred method for both OCPU and ECPU. +* `compute_count` - (Required) The compute amount (CPUs) available to the database. Minimum and maximum values depend on the compute model and whether the database is an Autonomous Database Serverless instance or an Autonomous Database on Dedicated Exadata Infrastructure. For an Autonomous Database Serverless instance, the `ECPU` compute model requires a minimum value of one, for databases in the elastic resource pool and minimum value of two, otherwise. Required when using the `computeModel` parameter. When using `cpuCoreCount` parameter, it is an error to specify computeCount to a non-null value. Providing `computeModel` and `computeCount` is the preferred method for both OCPU and ECPU. * `compute_model` - (Required) The compute model of the Autonomous Database. This is required if using the `computeCount` parameter. If using `cpuCoreCount` then it is an error to specify `computeModel` to a non-null value. ECPU compute model is the recommended model and OCPU compute model is legacy. From 1f91896fa440e22dd09e4530d8cde2ea3a19ff58 Mon Sep 17 00:00:00 2001 From: eelhomsi Date: Tue, 22 Oct 2024 19:11:04 +0100 Subject: [PATCH 26/43] Update website/docs/r/oracle_autonomous_database_regular.html.markdown Co-authored-by: kt --- website/docs/r/oracle_autonomous_database_regular.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/oracle_autonomous_database_regular.html.markdown b/website/docs/r/oracle_autonomous_database_regular.html.markdown index 6ae37adbfc6a..89d5a55fa492 100644 --- a/website/docs/r/oracle_autonomous_database_regular.html.markdown +++ b/website/docs/r/oracle_autonomous_database_regular.html.markdown @@ -40,7 +40,7 @@ resource "azurerm_oracle_autonomous_database" "example" { The following arguments are supported: -* `admin_password` - (Required) The password must be between 12 and 30 characters long, and must contain at least 1 uppercase, 1 lowercase, and 1 numeric character. It cannot contain the double quote symbol (") or the username "admin", regardless of casing. +* `admin_password` - (Required) The password must be between `12` and `30 `characters long, and must contain at least 1 uppercase, 1 lowercase, and 1 numeric character. It cannot contain the double quote symbol (") or the username "admin", regardless of casing. * `backup_retention_period_in_days` - (Optional) (Updatable) Retention period, in days, for backups. From 1aa4e227db3e0414d09a5f01a03d2948f1b7a2ed Mon Sep 17 00:00:00 2001 From: eelhomsi Date: Tue, 22 Oct 2024 19:14:10 +0100 Subject: [PATCH 27/43] Update website/docs/r/oracle_autonomous_database_regular.html.markdown Co-authored-by: kt --- .../docs/r/oracle_autonomous_database_regular.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docs/r/oracle_autonomous_database_regular.html.markdown b/website/docs/r/oracle_autonomous_database_regular.html.markdown index 89d5a55fa492..ade81c6ef18d 100644 --- a/website/docs/r/oracle_autonomous_database_regular.html.markdown +++ b/website/docs/r/oracle_autonomous_database_regular.html.markdown @@ -62,9 +62,9 @@ The following arguments are supported: * `display_name` - (Required) The user-friendly name for the Autonomous Database. The name does not have to be unique. -* `auto_scaling_enabled` - (Required) Indicates if auto scaling is enabled for the Autonomous Database CPU core count. The default value is `TRUE`. +* `auto_scaling_enabled` - (Required) Indicates if auto scaling is enabled for the Autonomous Database CPU core count. The default value is `true`. -* `auto_scaling_for_storage_enabled` - (Required) Indicates if auto scaling is enabled for the Autonomous Database storage. The default value is `FALSE`. +* `auto_scaling_for_storage_enabled` - (Required) Indicates if auto scaling is enabled for the Autonomous Database storage. The default value is `false`. * `mtls_connection_required` - (Required) Specifies if the Autonomous Database requires mTLS connections. From 57e0dbc36375e2718e58458ec928ad2b5049b4e3 Mon Sep 17 00:00:00 2001 From: eelhomsi Date: Tue, 22 Oct 2024 19:14:20 +0100 Subject: [PATCH 28/43] Update website/docs/d/oracle_autonomous_database_regular.html.markdown Co-authored-by: kt --- website/docs/d/oracle_autonomous_database_regular.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/d/oracle_autonomous_database_regular.html.markdown b/website/docs/d/oracle_autonomous_database_regular.html.markdown index 883b19e594fc..6926c33727dc 100644 --- a/website/docs/d/oracle_autonomous_database_regular.html.markdown +++ b/website/docs/d/oracle_autonomous_database_regular.html.markdown @@ -91,7 +91,7 @@ In addition to the Arguments listed above - the following Attributes are exporte * `memory_per_oracle_compute_unit_in_gbs` - The amount of memory (in GBs) enabled per ECPU or OCPU. -* `ncharacter_set` - The national character set for the autonomous database. The default is AL16UTF16. Allowed values are: AL16UTF16 or UTF8. +* `ncharacter_set` - The national character set for the autonomous database. The default is `AL16UTF16`. Allowed values are: `AL16UTF16` or `UTF8`. * `next_long_term_backup_time_stamp` - The date and time when the next long-term backup would be created. From ec73e3f9d58551674518c372971919387480e4f3 Mon Sep 17 00:00:00 2001 From: eelhomsi Date: Tue, 22 Oct 2024 19:14:33 +0100 Subject: [PATCH 29/43] Update website/docs/d/oracle_autonomous_database_regular.html.markdown Co-authored-by: kt --- website/docs/d/oracle_autonomous_database_regular.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/d/oracle_autonomous_database_regular.html.markdown b/website/docs/d/oracle_autonomous_database_regular.html.markdown index 6926c33727dc..68571a3c8f35 100644 --- a/website/docs/d/oracle_autonomous_database_regular.html.markdown +++ b/website/docs/d/oracle_autonomous_database_regular.html.markdown @@ -147,7 +147,7 @@ In addition to the Arguments listed above - the following Attributes are exporte * `vnet_id` - The ID to an Azure Resource Manager vnet resource. -* `whitelisted_ips` - The client IP access control list (ACL). This feature is available for [Autonomous Database Serverless] (https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html) and on Exadata Cloud@Customer. Only clients connecting from an IP address included in the ACL may access the Autonomous Database instance. If `arePrimaryWhitelistedIpsUsed` is 'TRUE' then Autonomous Database uses this primary's IP access control list (ACL) for the disaster recovery peer called `standbywhitelistedips`. +* `allowed_ips` - The client IP access control list (ACL). This feature is available for [Autonomous Database Serverless] (https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html) and on Exadata Cloud@Customer. Only clients connecting from an IP address included in the ACL may access the Autonomous Database instance. If `arePrimaryWhitelistedIpsUsed` is 'TRUE' then Autonomous Database uses this primary's IP access control list (ACL) for the disaster recovery peer called `standbywhitelistedips`. ## Timeouts From e279d2cf31fa3bd43f13baa1219db2572bcdd5d1 Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Tue, 22 Oct 2024 19:24:40 +0100 Subject: [PATCH 30/43] * Update. --- .../oracle/autonomous_database_regular_data_source.go | 10 +++++----- .../oracle/autonomous_database_regular_resource.go | 4 ++-- .../autonomous_database_regular_resource_test.go | 8 ++++---- .../d/oracle_autonomous_database_regular.html.markdown | 8 ++++---- .../r/oracle_autonomous_database_regular.html.markdown | 6 +++--- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/internal/services/oracle/autonomous_database_regular_data_source.go b/internal/services/oracle/autonomous_database_regular_data_source.go index 60b139b0b015..bd9d93378d94 100644 --- a/internal/services/oracle/autonomous_database_regular_data_source.go +++ b/internal/services/oracle/autonomous_database_regular_data_source.go @@ -47,7 +47,7 @@ type AutonomousDatabaseRegularDataModel struct { MemoryAreaInGbs int64 `tfschema:"in_memory_area_in_gbs"` MemoryPerOracleComputeUnitInGbs int64 `tfschema:"memory_per_oracle_compute_unit_in_gbs"` MtlsConnectionRequired bool `tfschema:"mtls_connection_required"` - NcharacterSet string `tfschema:"ncharacter_set"` + NcharacterSet string `tfschema:"national_character_set"` NextLongTermBackupTimeStamp string `tfschema:"next_long_term_backup_time_stamp"` Ocid string `tfschema:"ocid"` OciUrl string `tfschema:"oci_url"` @@ -78,7 +78,7 @@ type AutonomousDatabaseRegularDataModel struct { UsedDataStorageSizeInGbs int64 `tfschema:"used_data_storage_size_in_gbs"` UsedDataStorageSizeInTbs int64 `tfschema:"used_data_storage_size_in_tbs"` VnetId string `tfschema:"vnet_id"` - WhitelistedIPs []string `tfschema:"whitelisted_ips"` + AllowedIps []string `tfschema:"allowed_ips"` } func (d AutonomousDatabaseRegularDataSource) Arguments() map[string]*pluginsdk.Schema { @@ -211,7 +211,7 @@ func (d AutonomousDatabaseRegularDataSource) Attributes() map[string]*pluginsdk. Computed: true, }, - "ncharacter_set": { + "national_character_set": { Type: pluginsdk.TypeString, Computed: true, }, @@ -375,7 +375,7 @@ func (d AutonomousDatabaseRegularDataSource) Attributes() map[string]*pluginsdk. Computed: true, }, - "whitelisted_ips": { + "allowed_ips": { Type: pluginsdk.TypeList, Computed: true, Elem: &pluginsdk.Schema{ @@ -479,7 +479,7 @@ func (d AutonomousDatabaseRegularDataSource) Read() sdk.ResourceFunc { state.UsedDataStorageSizeInGbs = pointer.From(adbsProps.UsedDataStorageSizeInGbs) state.UsedDataStorageSizeInTbs = pointer.From(adbsProps.UsedDataStorageSizeInTbs) state.VnetId = pointer.From(adbsProps.VnetId) - state.WhitelistedIPs = pointer.From(adbsProps.WhitelistedIPs) + state.AllowedIps = pointer.From(adbsProps.WhitelistedIPs) } } diff --git a/internal/services/oracle/autonomous_database_regular_resource.go b/internal/services/oracle/autonomous_database_regular_resource.go index d693af051ff0..5c2470cca195 100644 --- a/internal/services/oracle/autonomous_database_regular_resource.go +++ b/internal/services/oracle/autonomous_database_regular_resource.go @@ -40,7 +40,7 @@ type AutonomousDatabaseRegularResourceModel struct { AutoScalingEnabled bool `tfschema:"auto_scaling_enabled"` AutoScalingForStorageEnabled bool `tfschema:"auto_scaling_for_storage_enabled"` MtlsConnectionRequired bool `tfschema:"mtls_connection_required"` - NcharacterSet string `tfschema:"ncharacter_set"` + NcharacterSet string `tfschema:"national_character_set"` SubnetId string `tfschema:"subnet_id"` VnetId string `tfschema:"vnet_id"` @@ -140,7 +140,7 @@ func (AutonomousDatabaseRegularResource) Arguments() map[string]*pluginsdk.Schem ValidateFunc: validate.LicenseType, }, - "ncharacter_set": { + "national_character_set": { Type: pluginsdk.TypeString, Required: true, ForceNew: true, diff --git a/internal/services/oracle/autonomous_database_regular_resource_test.go b/internal/services/oracle/autonomous_database_regular_resource_test.go index 0ab48b7ec110..98bdfa108b00 100644 --- a/internal/services/oracle/autonomous_database_regular_resource_test.go +++ b/internal/services/oracle/autonomous_database_regular_resource_test.go @@ -120,7 +120,7 @@ resource "azurerm_oracle_autonomous_database" "test" { admin_password = "TestPass#2024#" db_version = "19c" character_set = "AL32UTF8" - ncharacter_set = "AL16UTF16" + national_character_set = "AL16UTF16" subnet_id = azurerm_subnet.virtual_network_subnet.id vnet_id = azurerm_virtual_network.virtual_network.id lifecycle { @@ -159,7 +159,7 @@ resource "azurerm_oracle_autonomous_database" "test" { admin_password = "TestPass#2024#" db_version = "19c" character_set = "AL32UTF8" - ncharacter_set = "AL16UTF16" + national_character_set = "AL16UTF16" subnet_id = azurerm_subnet.virtual_network_subnet.id vnet_id = azurerm_virtual_network.virtual_network.id customer_contacts = ["test@test.com"] @@ -198,7 +198,7 @@ resource "azurerm_oracle_autonomous_database" "test" { admin_password = "TestPass#2024#" db_version = "19c" character_set = "AL32UTF8" - ncharacter_set = "AL16UTF16" + national_character_set = "AL16UTF16" subnet_id = azurerm_subnet.virtual_network_subnet.id vnet_id = azurerm_virtual_network.virtual_network.id lifecycle { @@ -231,7 +231,7 @@ resource "azurerm_oracle_autonomous_database" "import" { admin_password = "TestPass#2024#" db_version = azurerm_oracle_autonomous_database.test.db_version character_set = azurerm_oracle_autonomous_database.test.character_set - ncharacter_set = azurerm_oracle_autonomous_database.test.ncharacter_set + national_character_set = azurerm_oracle_autonomous_database.test.national_character_set subnet_id = azurerm_oracle_autonomous_database.test.subnet_id vnet_id = azurerm_oracle_autonomous_database.test.vnet_id lifecycle { diff --git a/website/docs/d/oracle_autonomous_database_regular.html.markdown b/website/docs/d/oracle_autonomous_database_regular.html.markdown index 883b19e594fc..954cf3928f18 100644 --- a/website/docs/d/oracle_autonomous_database_regular.html.markdown +++ b/website/docs/d/oracle_autonomous_database_regular.html.markdown @@ -49,13 +49,13 @@ In addition to the Arguments listed above - the following Attributes are exporte * `character_set` - The character set for the autonomous database. -* `compute_count` - The compute amount (CPUs) available to the database. Minimum and maximum values depend on the compute model and whether the database is an Autonomous Database Serverless instance or an Autonomous Database on Dedicated Exadata Infrastructure. For an Autonomous Database Serverless instance, the 'ECPU' compute model requires a minimum value of one, for databases in the elastic resource pool and minimum value of two, otherwise. Required when using the `computeModel` parameter. When using `cpuCoreCount` parameter, it is an error to specify computeCount to a non-null value. Providing `computeModel` and `computeCount` is the preferred method for both OCPU and ECPU. +* `compute_count` - The compute amount (CPUs) available to the database. * `cpu_core_count` - The number of CPU cores to be made available to the database. When the ECPU is selected, the value for cpuCoreCount is 0. For Autonomous Database on Dedicated Exadata infrastructure, the maximum number of cores is determined by the infrastructure shape. See [Characteristics of Infrastructure Shapes](https://www.oracle.com/pls/topic/lookup?ctx=en/cloud/paas/autonomous-database&id=ATPFG-GUID-B0F033C1-CC5A-42F0-B2E7-3CECFEDA1FD1) for shape details. * `data_storage_size_in_gbs` - The quantity of data in the database, in gigabytes. -* `data_storage_size_in_tbs` - The quantity of data in the database, in terabytes. +* `data_storage_size_in_tbs` - The maximum storage that can be allocated for the database, in terabytes. * `db_node_storage_size_in_gbs` - The DB node storage size in, in gigabytes. @@ -91,7 +91,7 @@ In addition to the Arguments listed above - the following Attributes are exporte * `memory_per_oracle_compute_unit_in_gbs` - The amount of memory (in GBs) enabled per ECPU or OCPU. -* `ncharacter_set` - The national character set for the autonomous database. The default is AL16UTF16. Allowed values are: AL16UTF16 or UTF8. +* `national_character_set` - The national character set for the autonomous database. The default is AL16UTF16. Allowed values are: AL16UTF16 or UTF8. * `next_long_term_backup_time_stamp` - The date and time when the next long-term backup would be created. @@ -147,7 +147,7 @@ In addition to the Arguments listed above - the following Attributes are exporte * `vnet_id` - The ID to an Azure Resource Manager vnet resource. -* `whitelisted_ips` - The client IP access control list (ACL). This feature is available for [Autonomous Database Serverless] (https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html) and on Exadata Cloud@Customer. Only clients connecting from an IP address included in the ACL may access the Autonomous Database instance. If `arePrimaryWhitelistedIpsUsed` is 'TRUE' then Autonomous Database uses this primary's IP access control list (ACL) for the disaster recovery peer called `standbywhitelistedips`. +* `allowed_ips` - The client IP access control list (ACL). This feature is available for [Autonomous Database Serverless] (https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html) and on Exadata Cloud@Customer. Only clients connecting from an IP address included in the ACL may access the Autonomous Database instance. If `arePrimaryWhitelistedIpsUsed` is 'TRUE' then Autonomous Database uses this primary's IP access control list (ACL) for the disaster recovery peer called `standbywhitelistedips`. ## Timeouts diff --git a/website/docs/r/oracle_autonomous_database_regular.html.markdown b/website/docs/r/oracle_autonomous_database_regular.html.markdown index 3fba2a7ff692..fcfe3f98ccd5 100644 --- a/website/docs/r/oracle_autonomous_database_regular.html.markdown +++ b/website/docs/r/oracle_autonomous_database_regular.html.markdown @@ -30,7 +30,7 @@ resource "azurerm_oracle_autonomous_database" "example" { auto_scaling_enabled = "example" character_set = "example" compute_count = 1.23456 - ncharacter_set = "example" + national_character_set = "example" license_model = false db_version = "example" } @@ -51,7 +51,7 @@ The following arguments are supported: * `compute_model` - (Required) The compute model of the Autonomous Database. This is required if using the `computeCount` parameter. If using `cpuCoreCount` then it is an error to specify `computeModel` to a non-null value. ECPU compute model is the recommended model and OCPU compute model is legacy. -* `data_storage_size_in_tbs` - (Required) The quantity of data in the database, in terabytes. +* `data_storage_size_in_tbs` - (Required) The maximum storage that can be allocated for the database, in terabytes. * `db_version` - (Required) A valid Oracle Database version for Autonomous Database. @@ -75,7 +75,7 @@ The following arguments are supported: * `name` - (Required) The name which should be used for this Autonomous Databases. -* `ncharacter_set` - (Required) The national character set for the autonomous database. The default is AL16UTF16. Allowed values are: AL16UTF16 or UTF8. +* `national_character_set` - (Required) The national character set for the autonomous database. The default is AL16UTF16. Allowed values are: AL16UTF16 or UTF8. * `resource_group_name` - (Required) The name of the Resource Group where the Autonomous Databases should exist. From 9d8c6bb60c112cb1664b704d1c5cc96a9e506aa4 Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Tue, 22 Oct 2024 20:03:34 +0100 Subject: [PATCH 31/43] * Update to address comments. --- .../autonomous_database_regular_resource.go | 30 +++++---- ...tonomous_database_regular_resource_test.go | 11 ++-- .../validate/autonomous_database_regular.go | 61 +++++++++++++++++++ ..._autonomous_database_regular.html.markdown | 2 +- 4 files changed, 86 insertions(+), 18 deletions(-) diff --git a/internal/services/oracle/autonomous_database_regular_resource.go b/internal/services/oracle/autonomous_database_regular_resource.go index 5c2470cca195..218680f2d76b 100644 --- a/internal/services/oracle/autonomous_database_regular_resource.go +++ b/internal/services/oracle/autonomous_database_regular_resource.go @@ -40,7 +40,7 @@ type AutonomousDatabaseRegularResourceModel struct { AutoScalingEnabled bool `tfschema:"auto_scaling_enabled"` AutoScalingForStorageEnabled bool `tfschema:"auto_scaling_for_storage_enabled"` MtlsConnectionRequired bool `tfschema:"mtls_connection_required"` - NcharacterSet string `tfschema:"national_character_set"` + NationalCharacterSet string `tfschema:"national_character_set"` SubnetId string `tfschema:"subnet_id"` VnetId string `tfschema:"vnet_id"` @@ -71,9 +71,10 @@ func (AutonomousDatabaseRegularResource) Arguments() map[string]*pluginsdk.Schem }, "backup_retention_period_in_days": { - Type: pluginsdk.TypeInt, - Required: true, - ForceNew: true, + Type: pluginsdk.TypeInt, + Required: true, + ForceNew: true, + ValidateFunc: validate.BackupRetentionDays, }, "character_set": { @@ -83,8 +84,9 @@ func (AutonomousDatabaseRegularResource) Arguments() map[string]*pluginsdk.Schem }, "compute_count": { - Type: pluginsdk.TypeFloat, - Required: true, + Type: pluginsdk.TypeFloat, + Required: true, + ValidateFunc: validate.AdbsComputeCount, }, "compute_model": { @@ -94,8 +96,9 @@ func (AutonomousDatabaseRegularResource) Arguments() map[string]*pluginsdk.Schem }, "data_storage_size_in_tbs": { - Type: pluginsdk.TypeInt, - Required: true, + Type: pluginsdk.TypeInt, + Required: true, + ValidateFunc: validate.AdbsDataStorageSizeInTbs, }, "db_version": { @@ -105,9 +108,10 @@ func (AutonomousDatabaseRegularResource) Arguments() map[string]*pluginsdk.Schem }, "db_workload": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.DbWorkloadType, }, "display_name": { @@ -230,7 +234,7 @@ func (r AutonomousDatabaseRegularResource) Create() sdk.ResourceFunc { IsAutoScalingForStorageEnabled: pointer.To(model.AutoScalingForStorageEnabled), IsMtlsConnectionRequired: pointer.To(model.MtlsConnectionRequired), LicenseModel: pointer.To(autonomousdatabases.LicenseModel(model.LicenseModel)), - NcharacterSet: pointer.To(model.NcharacterSet), + NcharacterSet: pointer.To(model.NationalCharacterSet), SubnetId: pointer.To(model.SubnetId), VnetId: pointer.To(model.VnetId), }, @@ -351,7 +355,7 @@ func (AutonomousDatabaseRegularResource) Read() sdk.ResourceFunc { state.LicenseModel = string(pointer.From(adbsPropModel.LicenseModel)) state.Location = result.Model.Location state.Name = pointer.ToString(result.Model.Name) - state.NcharacterSet = pointer.From(adbsPropModel.NcharacterSet) + state.NationalCharacterSet = pointer.From(adbsPropModel.NcharacterSet) state.ResourceGroupName = id.ResourceGroupName state.SubnetId = pointer.From(adbsPropModel.SubnetId) state.Tags = pointer.From(result.Model.Tags) diff --git a/internal/services/oracle/autonomous_database_regular_resource_test.go b/internal/services/oracle/autonomous_database_regular_resource_test.go index 98bdfa108b00..c8be4ac16de2 100644 --- a/internal/services/oracle/autonomous_database_regular_resource_test.go +++ b/internal/services/oracle/autonomous_database_regular_resource_test.go @@ -96,6 +96,7 @@ func TestAdbsRegularResource_requiresImport(t *testing.T) { func (a AdbsRegularResource) basic(data acceptance.TestData) string { return fmt.Sprintf(` + %s provider "azurerm" { @@ -120,7 +121,7 @@ resource "azurerm_oracle_autonomous_database" "test" { admin_password = "TestPass#2024#" db_version = "19c" character_set = "AL32UTF8" - national_character_set = "AL16UTF16" + national_character_set = "AL16UTF16" subnet_id = azurerm_subnet.virtual_network_subnet.id vnet_id = azurerm_virtual_network.virtual_network.id lifecycle { @@ -135,6 +136,7 @@ resource "azurerm_oracle_autonomous_database" "test" { func (a AdbsRegularResource) complete(data acceptance.TestData) string { return fmt.Sprintf(` + %s provider "azurerm" { @@ -159,7 +161,7 @@ resource "azurerm_oracle_autonomous_database" "test" { admin_password = "TestPass#2024#" db_version = "19c" character_set = "AL32UTF8" - national_character_set = "AL16UTF16" + national_character_set = "AL16UTF16" subnet_id = azurerm_subnet.virtual_network_subnet.id vnet_id = azurerm_virtual_network.virtual_network.id customer_contacts = ["test@test.com"] @@ -175,6 +177,7 @@ resource "azurerm_oracle_autonomous_database" "test" { func (a AdbsRegularResource) update(data acceptance.TestData) string { return fmt.Sprintf(` + %s provider "azurerm" { @@ -198,7 +201,7 @@ resource "azurerm_oracle_autonomous_database" "test" { admin_password = "TestPass#2024#" db_version = "19c" character_set = "AL32UTF8" - national_character_set = "AL16UTF16" + national_character_set = "AL16UTF16" subnet_id = azurerm_subnet.virtual_network_subnet.id vnet_id = azurerm_virtual_network.virtual_network.id lifecycle { @@ -231,7 +234,7 @@ resource "azurerm_oracle_autonomous_database" "import" { admin_password = "TestPass#2024#" db_version = azurerm_oracle_autonomous_database.test.db_version character_set = azurerm_oracle_autonomous_database.test.character_set - national_character_set = azurerm_oracle_autonomous_database.test.national_character_set + national_character_set = azurerm_oracle_autonomous_database.test.national_character_set subnet_id = azurerm_oracle_autonomous_database.test.subnet_id vnet_id = azurerm_oracle_autonomous_database.test.vnet_id lifecycle { diff --git a/internal/services/oracle/validate/autonomous_database_regular.go b/internal/services/oracle/validate/autonomous_database_regular.go index 2007fe31da51..687ee5cc6761 100644 --- a/internal/services/oracle/validate/autonomous_database_regular.go +++ b/internal/services/oracle/validate/autonomous_database_regular.go @@ -124,3 +124,64 @@ func CustomerContactEmail(i interface{}, k string) (warnings []string, errors [] return warnings, errors } + +func BackupRetentionDays(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(int) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be int", k)) + return + } + + if v < 1 || v > 60 { + errors = append(errors, fmt.Errorf("%v must be between 1 and 60", k)) + return + } + + return warnings, errors +} + +func AdbsComputeCount(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(int) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be int", k)) + return + } + + if v < 2 || v > 512 { + errors = append(errors, fmt.Errorf("%v must be between 2 and 512", k)) + return + } + + return warnings, errors +} + +func AdbsDataStorageSizeInTbs(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(int) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be int", k)) + return + } + + if v < 1 || v > 384 { + errors = append(errors, fmt.Errorf("%v must be between 1 and 384", k)) + return + } + + return warnings, errors +} + +func DbWorkloadType(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) + return + } + + if v != string(autonomousdatabases.WorkloadTypeDW) && v != string(autonomousdatabases.WorkloadTypeOLTP) { + errors = append(errors, fmt.Errorf("%v must be %v or %v", k, + string(autonomousdatabases.WorkloadTypeDW), string(autonomousdatabases.WorkloadTypeOLTP))) + return + } + + return +} diff --git a/website/docs/r/oracle_autonomous_database_regular.html.markdown b/website/docs/r/oracle_autonomous_database_regular.html.markdown index 346d278e66ba..8d39652a67cb 100644 --- a/website/docs/r/oracle_autonomous_database_regular.html.markdown +++ b/website/docs/r/oracle_autonomous_database_regular.html.markdown @@ -30,7 +30,7 @@ resource "azurerm_oracle_autonomous_database" "example" { auto_scaling_enabled = "example" character_set = "example" compute_count = 1.23456 - national_character_set = "example" + national_character_set = "example" license_model = false db_version = "example" } From 4c38967f501bb74d45f16977551898ac4e45e098 Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Tue, 22 Oct 2024 20:15:26 +0100 Subject: [PATCH 32/43] * Update to address comments. --- .../autonomous_database_regular_resource_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/services/oracle/autonomous_database_regular_resource_test.go b/internal/services/oracle/autonomous_database_regular_resource_test.go index c8be4ac16de2..a24b783cebae 100644 --- a/internal/services/oracle/autonomous_database_regular_resource_test.go +++ b/internal/services/oracle/autonomous_database_regular_resource_test.go @@ -110,13 +110,13 @@ resource "azurerm_oracle_autonomous_database" "test" { resource_group_name = azurerm_resource_group.test.name location = "%[3]s" compute_model = "ECPU" - compute_count = "2" + compute_count = 2 license_model = "BringYourOwnLicense" backup_retention_period_in_days = 12 auto_scaling_enabled = false auto_scaling_for_storage_enabled = false mtls_connection_required = false - data_storage_size_in_tbs = "1" + data_storage_size_in_tbs = 1 db_workload = "OLTP" admin_password = "TestPass#2024#" db_version = "19c" @@ -150,13 +150,13 @@ resource "azurerm_oracle_autonomous_database" "test" { resource_group_name = azurerm_resource_group.test.name location = "%[3]s" compute_model = "ECPU" - compute_count = "2" + compute_count = 2 license_model = "BringYourOwnLicense" backup_retention_period_in_days = 12 auto_scaling_enabled = false auto_scaling_for_storage_enabled = false mtls_connection_required = false - data_storage_size_in_tbs = "1" + data_storage_size_in_tbs = 1 db_workload = "OLTP" admin_password = "TestPass#2024#" db_version = "19c" @@ -190,13 +190,13 @@ resource "azurerm_oracle_autonomous_database" "test" { resource_group_name = azurerm_resource_group.test.name location = "%[3]s" compute_model = "ECPU" - compute_count = "3" + compute_count = 3 license_model = "BringYourOwnLicense" backup_retention_period_in_days = 12 auto_scaling_enabled = false auto_scaling_for_storage_enabled = false mtls_connection_required = false - data_storage_size_in_tbs = "1" + data_storage_size_in_tbs = 1 db_workload = "OLTP" admin_password = "TestPass#2024#" db_version = "19c" From ebdb9d03732876d42056ccdcc5d80fcc0387d627 Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Tue, 22 Oct 2024 20:18:32 +0100 Subject: [PATCH 33/43] * Update to address comments. --- .../services/oracle/validate/autonomous_database_regular.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/services/oracle/validate/autonomous_database_regular.go b/internal/services/oracle/validate/autonomous_database_regular.go index 687ee5cc6761..edf4eb82aadb 100644 --- a/internal/services/oracle/validate/autonomous_database_regular.go +++ b/internal/services/oracle/validate/autonomous_database_regular.go @@ -141,9 +141,9 @@ func BackupRetentionDays(i interface{}, k string) (warnings []string, errors []e } func AdbsComputeCount(i interface{}, k string) (warnings []string, errors []error) { - v, ok := i.(int) + v, ok := i.(float64) if !ok { - errors = append(errors, fmt.Errorf("expected type of %s to be int", k)) + errors = append(errors, fmt.Errorf("expected type of %s to be float", k)) return } From 6ef8146f117a21d1cead8bfa656a45484371cccd Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Wed, 23 Oct 2024 11:08:10 +0100 Subject: [PATCH 34/43] * First batch of updates to address comments. --- ...autonomous_database_regular_data_source.go | 4 +- .../autonomous_database_regular_resource.go | 48 +++++++++++-------- ...tonomous_database_regular_resource_test.go | 8 ++-- .../validate/autonomous_database_regular.go | 16 +++++++ ..._autonomous_database_regular.html.markdown | 2 +- ..._autonomous_database_regular.html.markdown | 22 ++++----- 6 files changed, 62 insertions(+), 38 deletions(-) diff --git a/internal/services/oracle/autonomous_database_regular_data_source.go b/internal/services/oracle/autonomous_database_regular_data_source.go index bd9d93378d94..52cb61515c90 100644 --- a/internal/services/oracle/autonomous_database_regular_data_source.go +++ b/internal/services/oracle/autonomous_database_regular_data_source.go @@ -77,7 +77,7 @@ type AutonomousDatabaseRegularDataModel struct { TimeReclamationOfFreeAutonomousDatabase string `tfschema:"time_reclamation_of_free_autonomous_database"` UsedDataStorageSizeInGbs int64 `tfschema:"used_data_storage_size_in_gbs"` UsedDataStorageSizeInTbs int64 `tfschema:"used_data_storage_size_in_tbs"` - VnetId string `tfschema:"vnet_id"` + VnetId string `tfschema:"virtual_network_id"` AllowedIps []string `tfschema:"allowed_ips"` } @@ -370,7 +370,7 @@ func (d AutonomousDatabaseRegularDataSource) Attributes() map[string]*pluginsdk. Computed: true, }, - "vnet_id": { + "virtual_network_id": { Type: pluginsdk.TypeString, Computed: true, }, diff --git a/internal/services/oracle/autonomous_database_regular_resource.go b/internal/services/oracle/autonomous_database_regular_resource.go index 218680f2d76b..5b359bd7a407 100644 --- a/internal/services/oracle/autonomous_database_regular_resource.go +++ b/internal/services/oracle/autonomous_database_regular_resource.go @@ -9,11 +9,13 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracle/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" ) var _ sdk.Resource = AutonomousDatabaseRegularResource{} @@ -42,7 +44,7 @@ type AutonomousDatabaseRegularResourceModel struct { MtlsConnectionRequired bool `tfschema:"mtls_connection_required"` NationalCharacterSet string `tfschema:"national_character_set"` SubnetId string `tfschema:"subnet_id"` - VnetId string `tfschema:"vnet_id"` + VnetId string `tfschema:"virtual_network_id"` // Optional CustomerContacts []string `tfschema:"customer_contacts"` @@ -78,9 +80,10 @@ func (AutonomousDatabaseRegularResource) Arguments() map[string]*pluginsdk.Schem }, "character_set": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, }, "compute_count": { @@ -90,9 +93,10 @@ func (AutonomousDatabaseRegularResource) Arguments() map[string]*pluginsdk.Schem }, "compute_model": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.AdbsComputeModel, }, "data_storage_size_in_tbs": { @@ -102,9 +106,10 @@ func (AutonomousDatabaseRegularResource) Arguments() map[string]*pluginsdk.Schem }, "db_version": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, }, "db_workload": { @@ -145,21 +150,24 @@ func (AutonomousDatabaseRegularResource) Arguments() map[string]*pluginsdk.Schem }, "national_character_set": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, }, "subnet_id": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: commonids.ValidateSubnetID, }, - "vnet_id": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, + "virtual_network_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: commonids.ValidateVirtualNetworkID, }, // Optional diff --git a/internal/services/oracle/autonomous_database_regular_resource_test.go b/internal/services/oracle/autonomous_database_regular_resource_test.go index a24b783cebae..e4871915bcee 100644 --- a/internal/services/oracle/autonomous_database_regular_resource_test.go +++ b/internal/services/oracle/autonomous_database_regular_resource_test.go @@ -123,7 +123,7 @@ resource "azurerm_oracle_autonomous_database" "test" { character_set = "AL32UTF8" national_character_set = "AL16UTF16" subnet_id = azurerm_subnet.virtual_network_subnet.id - vnet_id = azurerm_virtual_network.virtual_network.id + virtual_network_id = azurerm_virtual_network.virtual_network.id lifecycle { ignore_changes = [ admin_password @@ -163,7 +163,7 @@ resource "azurerm_oracle_autonomous_database" "test" { character_set = "AL32UTF8" national_character_set = "AL16UTF16" subnet_id = azurerm_subnet.virtual_network_subnet.id - vnet_id = azurerm_virtual_network.virtual_network.id + virtual_network_id = azurerm_virtual_network.virtual_network.id customer_contacts = ["test@test.com"] lifecycle { ignore_changes = [ @@ -203,7 +203,7 @@ resource "azurerm_oracle_autonomous_database" "test" { character_set = "AL32UTF8" national_character_set = "AL16UTF16" subnet_id = azurerm_subnet.virtual_network_subnet.id - vnet_id = azurerm_virtual_network.virtual_network.id + virtual_network_id = azurerm_virtual_network.virtual_network.id lifecycle { ignore_changes = [ admin_password @@ -236,7 +236,7 @@ resource "azurerm_oracle_autonomous_database" "import" { character_set = azurerm_oracle_autonomous_database.test.character_set national_character_set = azurerm_oracle_autonomous_database.test.national_character_set subnet_id = azurerm_oracle_autonomous_database.test.subnet_id - vnet_id = azurerm_oracle_autonomous_database.test.vnet_id + virtual_network_id = azurerm_oracle_autonomous_database.test.virtual_network_id lifecycle { ignore_changes = [ admin_password diff --git a/internal/services/oracle/validate/autonomous_database_regular.go b/internal/services/oracle/validate/autonomous_database_regular.go index edf4eb82aadb..b467f7a95464 100644 --- a/internal/services/oracle/validate/autonomous_database_regular.go +++ b/internal/services/oracle/validate/autonomous_database_regular.go @@ -185,3 +185,19 @@ func DbWorkloadType(i interface{}, k string) (warnings []string, errors []error) return } + +func AdbsComputeModel(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) + return + } + + if v != string(autonomousdatabases.ComputeModelECPU) && v != string(autonomousdatabases.ComputeModelOCPU) { + errors = append(errors, fmt.Errorf("%v must be %v or %v", k, + string(autonomousdatabases.ComputeModelECPU), string(autonomousdatabases.ComputeModelOCPU))) + return + } + + return +} diff --git a/website/docs/d/oracle_autonomous_database_regular.html.markdown b/website/docs/d/oracle_autonomous_database_regular.html.markdown index 954cf3928f18..4fbb023ae03f 100644 --- a/website/docs/d/oracle_autonomous_database_regular.html.markdown +++ b/website/docs/d/oracle_autonomous_database_regular.html.markdown @@ -145,7 +145,7 @@ In addition to the Arguments listed above - the following Attributes are exporte * `used_data_storage_size_in_tbs` - The amount of storage that has been used, in terabytes. -* `vnet_id` - The ID to an Azure Resource Manager vnet resource. +* `virtual_network_id` - The ID to an Azure Resource Manager vnet resource. * `allowed_ips` - The client IP access control list (ACL). This feature is available for [Autonomous Database Serverless] (https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html) and on Exadata Cloud@Customer. Only clients connecting from an IP address included in the ACL may access the Autonomous Database instance. If `arePrimaryWhitelistedIpsUsed` is 'TRUE' then Autonomous Database uses this primary's IP access control list (ACL) for the disaster recovery peer called `standbywhitelistedips`. diff --git a/website/docs/r/oracle_autonomous_database_regular.html.markdown b/website/docs/r/oracle_autonomous_database_regular.html.markdown index 8d39652a67cb..bf7d9e7c3bec 100644 --- a/website/docs/r/oracle_autonomous_database_regular.html.markdown +++ b/website/docs/r/oracle_autonomous_database_regular.html.markdown @@ -25,7 +25,7 @@ resource "azurerm_oracle_autonomous_database" "example" { compute_model = "example" data_storage_size_in_gbs = 42 auto_scaling_for_storage_enabled = false - vnet_id = "example" + virtual_network_id = "example" admin_password = "example" auto_scaling_enabled = "example" character_set = "example" @@ -39,6 +39,12 @@ resource "azurerm_oracle_autonomous_database" "example" { ## Arguments Reference The following arguments are supported: + +* `name` - (Required) The name which should be used for this Autonomous Databases. + +* `resource_group_name` - (Required) The name of the Resource Group where the Autonomous Databases should exist. + +* `location` - (Required) The Azure Region where the Autonomous Databases should exist. Changing this forces a new Autonomous Databases to be created. * `admin_password` - (Required) The password must be between `12` and `30 `characters long, and must contain at least 1 uppercase, 1 lowercase, and 1 numeric character. It cannot contain the double quote symbol (") or the username "admin", regardless of casing. @@ -70,21 +76,15 @@ The following arguments are supported: * `license_model` - (Required) The Oracle license model that applies to the Oracle Autonomous Database. Bring your own license (BYOL) allows you to apply your current on-premises Oracle software licenses to equivalent, highly automated Oracle services in the cloud. License Included allows you to subscribe to new Oracle Database software licenses and the Oracle Database service. Note that when provisioning an [Autonomous Database on dedicated Exadata infrastructure](https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html), this attribute must be null. It is already set at the Autonomous Exadata Infrastructure level. When provisioning an [Autonomous Database Serverless] (https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html) database, if a value is not specified, the system defaults the value to `BRING_YOUR_OWN_LICENSE`. Bring your own license (BYOL) also allows you to select the DB edition using the optional parameter. -* `location` - (Required) The Azure Region where the Autonomous Databases should exist. Changing this forces a new Autonomous Databases to be created. - -* `name` - (Required) The name which should be used for this Autonomous Databases. - * `national_character_set` - (Required) The national character set for the autonomous database. The default is AL16UTF16. Allowed values are: AL16UTF16 or UTF8. -* `resource_group_name` - (Required) The name of the Resource Group where the Autonomous Databases should exist. - * `subnet_id` - (Required) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the subnet the resource is associated with. -* `vnet_id` - (Required) The ID of the vnet associated with the cloud VM cluster. +* `virtual_network_id` - (Required) The ID of the vnet associated with the cloud VM cluster. --- -* `customer_contacts` - (Optional) Specifies a list of TODO. +* `customer_contacts` - (Optional) Specifies a list of customer contacts as email addresses. * `tags` - (Optional) A mapping of tags which should be assigned to the Autonomous Databases. @@ -92,13 +92,13 @@ The following arguments are supported: In addition to the Arguments listed above - the following Attributes are exported: -* `id` - The ID of the Autonomous Databases. +* `id` - The ID of the Autonomous Database. ## Timeouts The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: -* `create` - (Defaults to 2 hour) Used when creating the Autonomous Databases. +* `create` - (Defaults to 2 hours) Used when creating the Autonomous Databases. * `read` - (Defaults to 5 minutes) Used when retrieving the Autonomous Databases. * `update` - (Defaults to 30 minutes) Used when updating the Autonomous Databases. * `delete` - (Defaults to 30 minutes) Used when deleting the Autonomous Databases. From fc3164dec009e5d11b5f296287d425c08170dc51 Mon Sep 17 00:00:00 2001 From: eelhomsi Date: Wed, 23 Oct 2024 11:09:22 +0100 Subject: [PATCH 35/43] Update internal/services/oracle/autonomous_database_regular_resource.go Co-authored-by: stephybun --- .../services/oracle/autonomous_database_regular_resource.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/oracle/autonomous_database_regular_resource.go b/internal/services/oracle/autonomous_database_regular_resource.go index 5b359bd7a407..224b4788853d 100644 --- a/internal/services/oracle/autonomous_database_regular_resource.go +++ b/internal/services/oracle/autonomous_database_regular_resource.go @@ -276,7 +276,7 @@ func (r AutonomousDatabaseRegularResource) Update() sdk.ResourceFunc { existing, err := client.Get(ctx, *id) if err != nil { - return fmt.Errorf("retrieving exists when updating: +%v", *id) + return fmt.Errorf("retrieving %s: %+v", *id) } if existing.Model == nil && existing.Model.Properties == nil { return fmt.Errorf("retrieving as nil when updating for %v", *id) From d8bda37742b7934b4827d02e0f76358c58887adb Mon Sep 17 00:00:00 2001 From: eelhomsi Date: Wed, 23 Oct 2024 11:10:12 +0100 Subject: [PATCH 36/43] Update internal/services/oracle/autonomous_database_regular_resource.go Co-authored-by: stephybun --- .../services/oracle/autonomous_database_regular_resource.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/internal/services/oracle/autonomous_database_regular_resource.go b/internal/services/oracle/autonomous_database_regular_resource.go index 224b4788853d..b1975ccec61d 100644 --- a/internal/services/oracle/autonomous_database_regular_resource.go +++ b/internal/services/oracle/autonomous_database_regular_resource.go @@ -278,9 +278,6 @@ func (r AutonomousDatabaseRegularResource) Update() sdk.ResourceFunc { if err != nil { return fmt.Errorf("retrieving %s: %+v", *id) } - if existing.Model == nil && existing.Model.Properties == nil { - return fmt.Errorf("retrieving as nil when updating for %v", *id) - } hasUpdate := false update := &autonomousdatabases.AutonomousDatabaseUpdate{} From 1036e32ff915d13d913114913854e26ed4699caa Mon Sep 17 00:00:00 2001 From: eelhomsi Date: Wed, 23 Oct 2024 11:10:57 +0100 Subject: [PATCH 37/43] Update internal/services/oracle/autonomous_database_regular_resource.go Co-authored-by: stephybun --- .../autonomous_database_regular_resource.go | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/internal/services/oracle/autonomous_database_regular_resource.go b/internal/services/oracle/autonomous_database_regular_resource.go index b1975ccec61d..aaebe3ee451a 100644 --- a/internal/services/oracle/autonomous_database_regular_resource.go +++ b/internal/services/oracle/autonomous_database_regular_resource.go @@ -279,40 +279,28 @@ func (r AutonomousDatabaseRegularResource) Update() sdk.ResourceFunc { return fmt.Errorf("retrieving %s: %+v", *id) } - hasUpdate := false - update := &autonomousdatabases.AutonomousDatabaseUpdate{} - properties := &autonomousdatabases.AutonomousDatabaseUpdateProperties{} - update.Properties = properties + update := &autonomousdatabases.AutonomousDatabaseUpdate{ + Properties: &autonomousdatabases.AutonomousDatabaseUpdateProperties{} + } if metadata.ResourceData.HasChange("tags") { - hasUpdate = true update.Tags = pointer.To(model.Tags) } if metadata.ResourceData.HasChange("data_storage_size_in_tbs") { - hasUpdate = true update.Properties.DataStorageSizeInTbs = pointer.To(model.DataStorageSizeInTbs) } if metadata.ResourceData.HasChange("compute_count") { - hasUpdate = true update.Properties.ComputeCount = pointer.To(model.ComputeCount) } if metadata.ResourceData.HasChange("auto_scaling_enabled") { - hasUpdate = true update.Properties.IsAutoScalingEnabled = pointer.To(model.AutoScalingEnabled) } if metadata.ResourceData.HasChange("auto_scaling_for_storage_enabled") { - hasUpdate = true update.Properties.IsAutoScalingForStorageEnabled = pointer.To(model.AutoScalingForStorageEnabled) - } else if metadata.ResourceData.HasChangesExcept("auto_scaling_enabled", "auto_scaling_for_storage_enabled", - "compute_count", "data_storage_size_in_tbs", "tags") { - return fmt.Errorf("only `auto_scaling_enabled`, `auto_scaling_for_storage_enabled`, `compute_count`, " + - "`data_storage_size_in_tbs`, and `tags` currently support updates") } - if hasUpdate { - err = client.UpdateThenPoll(ctx, *id, *update) - if err != nil { - return fmt.Errorf("updating %s: %v", id, err) - } + err = client.UpdateThenPoll(ctx, *id, *update) + if err != nil { + return fmt.Errorf("updating %s: %v", id, err) } return nil From 441c96899d88c7f1edee5f6e76b47073126f1b84 Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Wed, 23 Oct 2024 11:41:24 +0100 Subject: [PATCH 38/43] * Second batch of updates to address comments. --- .../autonomous_database_regular_resource.go | 92 ++++++++++--------- ...tonomous_database_regular_resource_test.go | 24 ++--- internal/services/oracle/registration.go | 4 +- .../validate/autonomous_database_regular.go | 78 ---------------- ..._autonomous_database_regular.html.markdown | 16 ++-- ..._autonomous_database_regular.html.markdown | 22 ++--- 6 files changed, 81 insertions(+), 155 deletions(-) diff --git a/internal/services/oracle/autonomous_database_regular_resource.go b/internal/services/oracle/autonomous_database_regular_resource.go index 5b359bd7a407..d7f82972aa51 100644 --- a/internal/services/oracle/autonomous_database_regular_resource.go +++ b/internal/services/oracle/autonomous_database_regular_resource.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracle/validate" @@ -76,7 +77,7 @@ func (AutonomousDatabaseRegularResource) Arguments() map[string]*pluginsdk.Schem Type: pluginsdk.TypeInt, Required: true, ForceNew: true, - ValidateFunc: validate.BackupRetentionDays, + ValidateFunc: validation.IntBetween(1, 60), }, "character_set": { @@ -89,7 +90,7 @@ func (AutonomousDatabaseRegularResource) Arguments() map[string]*pluginsdk.Schem "compute_count": { Type: pluginsdk.TypeFloat, Required: true, - ValidateFunc: validate.AdbsComputeCount, + ValidateFunc: validation.FloatBetween(2.0, 512.0), }, "compute_model": { @@ -102,7 +103,7 @@ func (AutonomousDatabaseRegularResource) Arguments() map[string]*pluginsdk.Schem "data_storage_size_in_tbs": { Type: pluginsdk.TypeInt, Required: true, - ValidateFunc: validate.AdbsDataStorageSizeInTbs, + ValidateFunc: validation.IntBetween(1, 384), }, "db_version": { @@ -113,10 +114,13 @@ func (AutonomousDatabaseRegularResource) Arguments() map[string]*pluginsdk.Schem }, "db_workload": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validate.DbWorkloadType, + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(autonomousdatabases.WorkloadTypeDW), + string(autonomousdatabases.WorkloadTypeOLTP), + }, false), }, "display_name": { @@ -143,10 +147,13 @@ func (AutonomousDatabaseRegularResource) Arguments() map[string]*pluginsdk.Schem }, "license_model": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validate.LicenseType, + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(autonomousdatabases.LicenseModelLicenseIncluded), + string(autonomousdatabases.LicenseModelBringYourOwnLicense), + }, false), }, "national_character_set": { @@ -224,7 +231,7 @@ func (r AutonomousDatabaseRegularResource) Create() sdk.ResourceFunc { param := autonomousdatabases.AutonomousDatabase{ Name: pointer.To(model.Name), - Location: model.Location, + Location: location.Normalize(model.Location), Tags: pointer.To(model.Tags), Properties: &autonomousdatabases.AutonomousDatabaseProperties{ AdminPassword: pointer.To(model.AdminPassword), @@ -266,7 +273,7 @@ func (r AutonomousDatabaseRegularResource) Update() sdk.ResourceFunc { client := metadata.Client.Oracle.OracleClient.AutonomousDatabases id, err := autonomousdatabases.ParseAutonomousDatabaseID(metadata.ResourceData.Id()) if err != nil { - return err + return fmt.Errorf("retrieving %s: %+v", id, err) } var model AutonomousDatabaseRegularResourceModel @@ -329,7 +336,7 @@ func (AutonomousDatabaseRegularResource) Read() sdk.ResourceFunc { Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { id, err := autonomousdatabases.ParseAutonomousDatabaseID(metadata.ResourceData.Id()) if err != nil { - return err + return fmt.Errorf("retrieving %s: %+v", id, err) } client := metadata.Client.Oracle.OracleClient.AutonomousDatabases @@ -338,41 +345,38 @@ func (AutonomousDatabaseRegularResource) Read() sdk.ResourceFunc { if response.WasNotFound(result.HttpResponse) { return metadata.MarkAsGone(id) } - return err + return fmt.Errorf("retrieving %s: %+v", id, err) } - if result.Model == nil { - return fmt.Errorf("retrieving %s got nil model", id) + state := AutonomousDatabaseRegularResourceModel{ + Name: id.AutonomousDatabaseName, + ResourceGroupName: id.ResourceGroupName, } - prop := result.Model.Properties - switch adbsPropModel := prop.(type) { - case autonomousdatabases.AutonomousDatabaseProperties: - var state AutonomousDatabaseRegularResourceModel - state.AdminPassword = pointer.From(adbsPropModel.AdminPassword) - state.AutoScalingEnabled = pointer.From(adbsPropModel.IsAutoScalingEnabled) - state.BackupRetentionPeriodInDays = pointer.From(adbsPropModel.BackupRetentionPeriodInDays) - state.AutoScalingForStorageEnabled = pointer.From(adbsPropModel.IsAutoScalingForStorageEnabled) - state.CharacterSet = pointer.From(adbsPropModel.CharacterSet) - state.ComputeCount = pointer.From(adbsPropModel.ComputeCount) - state.ComputeModel = string(pointer.From(adbsPropModel.ComputeModel)) - state.CustomerContacts = flattenAdbsCustomerContacts(adbsPropModel.CustomerContacts) - state.DataStorageSizeInTbs = pointer.From(adbsPropModel.DataStorageSizeInTbs) - state.DbWorkload = string(pointer.From(adbsPropModel.DbWorkload)) - state.DbVersion = pointer.From(adbsPropModel.DbVersion) - state.DisplayName = pointer.From(adbsPropModel.DisplayName) - state.LicenseModel = string(pointer.From(adbsPropModel.LicenseModel)) - state.Location = result.Model.Location + if model := result.Model; model != nil { + props, ok := model.Properties.(autonomousdatabases.AutonomousDatabaseProperties) + if !ok { + return fmt.Errorf("%s was not of type `Regular`", id) + } + state.AdminPassword = pointer.From(props.AdminPassword) + state.AutoScalingEnabled = pointer.From(props.IsAutoScalingEnabled) + state.BackupRetentionPeriodInDays = pointer.From(props.BackupRetentionPeriodInDays) + state.AutoScalingForStorageEnabled = pointer.From(props.IsAutoScalingForStorageEnabled) + state.CharacterSet = pointer.From(props.CharacterSet) + state.ComputeCount = pointer.From(props.ComputeCount) + state.ComputeModel = string(pointer.From(props.ComputeModel)) + state.CustomerContacts = flattenAdbsCustomerContacts(props.CustomerContacts) + state.DataStorageSizeInTbs = pointer.From(props.DataStorageSizeInTbs) + state.DbWorkload = string(pointer.From(props.DbWorkload)) + state.DbVersion = pointer.From(props.DbVersion) + state.DisplayName = pointer.From(props.DisplayName) + state.LicenseModel = string(pointer.From(props.LicenseModel)) state.Name = pointer.ToString(result.Model.Name) - state.NationalCharacterSet = pointer.From(adbsPropModel.NcharacterSet) - state.ResourceGroupName = id.ResourceGroupName - state.SubnetId = pointer.From(adbsPropModel.SubnetId) + state.NationalCharacterSet = pointer.From(props.NcharacterSet) + state.SubnetId = pointer.From(props.SubnetId) state.Tags = pointer.From(result.Model.Tags) - state.VnetId = pointer.From(adbsPropModel.VnetId) - - return metadata.Encode(&state) - default: - return fmt.Errorf("unexpected Autonomous Database type, must be of type Regular") + state.VnetId = pointer.From(props.VnetId) } + return metadata.Encode(&state) }, } } @@ -385,7 +389,7 @@ func (AutonomousDatabaseRegularResource) Delete() sdk.ResourceFunc { id, err := autonomousdatabases.ParseAutonomousDatabaseID(metadata.ResourceData.Id()) if err != nil { - return err + return fmt.Errorf("retrieving %s: %+v", id, err) } if err = client.DeleteThenPoll(ctx, *id); err != nil { diff --git a/internal/services/oracle/autonomous_database_regular_resource_test.go b/internal/services/oracle/autonomous_database_regular_resource_test.go index e4871915bcee..885d0d7bcdd8 100644 --- a/internal/services/oracle/autonomous_database_regular_resource_test.go +++ b/internal/services/oracle/autonomous_database_regular_resource_test.go @@ -122,8 +122,8 @@ resource "azurerm_oracle_autonomous_database" "test" { db_version = "19c" character_set = "AL32UTF8" national_character_set = "AL16UTF16" - subnet_id = azurerm_subnet.virtual_network_subnet.id - virtual_network_id = azurerm_virtual_network.virtual_network.id + subnet_id = azurerm_subnet.test.id + virtual_network_id = azurerm_virtual_network.test.id lifecycle { ignore_changes = [ admin_password @@ -162,8 +162,8 @@ resource "azurerm_oracle_autonomous_database" "test" { db_version = "19c" character_set = "AL32UTF8" national_character_set = "AL16UTF16" - subnet_id = azurerm_subnet.virtual_network_subnet.id - virtual_network_id = azurerm_virtual_network.virtual_network.id + subnet_id = azurerm_subnet.test.id + virtual_network_id = azurerm_virtual_network.test.id customer_contacts = ["test@test.com"] lifecycle { ignore_changes = [ @@ -202,8 +202,8 @@ resource "azurerm_oracle_autonomous_database" "test" { db_version = "19c" character_set = "AL32UTF8" national_character_set = "AL16UTF16" - subnet_id = azurerm_subnet.virtual_network_subnet.id - virtual_network_id = azurerm_virtual_network.virtual_network.id + subnet_id = azurerm_subnet.test.id + virtual_network_id = azurerm_virtual_network.test.id lifecycle { ignore_changes = [ admin_password @@ -236,7 +236,7 @@ resource "azurerm_oracle_autonomous_database" "import" { character_set = azurerm_oracle_autonomous_database.test.character_set national_character_set = azurerm_oracle_autonomous_database.test.national_character_set subnet_id = azurerm_oracle_autonomous_database.test.subnet_id - virtual_network_id = azurerm_oracle_autonomous_database.test.virtual_network_id + virtual_network_id = azurerm_oracle_autonomous_database.test.virtual_network_id lifecycle { ignore_changes = [ admin_password @@ -256,17 +256,17 @@ resource "azurerm_resource_group" "test" { location = "%[2]s" } -resource "azurerm_virtual_network" "virtual_network" { - name = "OFakeacctest%[1]d_vnet" +resource "azurerm_virtual_network" "test" { + name = "acctest%[1]d_vnet" address_space = ["10.0.0.0/16"] location = "%[2]s" resource_group_name = azurerm_resource_group.test.name } -resource "azurerm_subnet" "virtual_network_subnet" { - name = "OFakeacctest%[1]d" +resource "azurerm_subnet" "test" { + name = "eacctest%[1]d" resource_group_name = azurerm_resource_group.test.name - virtual_network_name = azurerm_virtual_network.virtual_network.name + virtual_network_name = azurerm_virtual_network.test.name address_prefixes = ["10.0.1.0/24"] delegation { diff --git a/internal/services/oracle/registration.go b/internal/services/oracle/registration.go index 9fe6c6af8a09..051e16f60890 100644 --- a/internal/services/oracle/registration.go +++ b/internal/services/oracle/registration.go @@ -14,18 +14,18 @@ var ( func (r Registration) DataSources() []sdk.DataSource { return []sdk.DataSource{ + AutonomousDatabaseRegularDataSource{}, CloudVmClusterDataSource{}, DBServersDataSource{}, ExadataInfraDataSource{}, - AutonomousDatabaseRegularDataSource{}, } } func (r Registration) Resources() []sdk.Resource { return []sdk.Resource{ + AutonomousDatabaseRegularResource{}, CloudVmClusterResource{}, ExadataInfraResource{}, - AutonomousDatabaseRegularResource{}, } } diff --git a/internal/services/oracle/validate/autonomous_database_regular.go b/internal/services/oracle/validate/autonomous_database_regular.go index b467f7a95464..16abe30266c0 100644 --- a/internal/services/oracle/validate/autonomous_database_regular.go +++ b/internal/services/oracle/validate/autonomous_database_regular.go @@ -8,7 +8,6 @@ import ( "unicode/utf8" "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/autonomousdatabases" - "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures" ) func AutonomousDatabaseName(i interface{}, k string) (warnings []string, errors []error) { @@ -93,22 +92,6 @@ func AutonomousDatabasePassword(i interface{}, k string) (warnings []string, err return } -func LicenseType(i interface{}, k string) (warnings []string, errors []error) { - v, ok := i.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) - return - } - - if v != string(autonomousdatabases.LicenseModelLicenseIncluded) && v != string(autonomousdatabases.LicenseModelBringYourOwnLicense) { - errors = append(errors, fmt.Errorf("%v must be %v or %v", k, - string(cloudexadatainfrastructures.PatchingModeRolling), string(cloudexadatainfrastructures.PatchingModeNonRolling))) - return - } - - return -} - func CustomerContactEmail(i interface{}, k string) (warnings []string, errors []error) { v, ok := i.(string) if !ok { @@ -125,67 +108,6 @@ func CustomerContactEmail(i interface{}, k string) (warnings []string, errors [] return warnings, errors } -func BackupRetentionDays(i interface{}, k string) (warnings []string, errors []error) { - v, ok := i.(int) - if !ok { - errors = append(errors, fmt.Errorf("expected type of %s to be int", k)) - return - } - - if v < 1 || v > 60 { - errors = append(errors, fmt.Errorf("%v must be between 1 and 60", k)) - return - } - - return warnings, errors -} - -func AdbsComputeCount(i interface{}, k string) (warnings []string, errors []error) { - v, ok := i.(float64) - if !ok { - errors = append(errors, fmt.Errorf("expected type of %s to be float", k)) - return - } - - if v < 2 || v > 512 { - errors = append(errors, fmt.Errorf("%v must be between 2 and 512", k)) - return - } - - return warnings, errors -} - -func AdbsDataStorageSizeInTbs(i interface{}, k string) (warnings []string, errors []error) { - v, ok := i.(int) - if !ok { - errors = append(errors, fmt.Errorf("expected type of %s to be int", k)) - return - } - - if v < 1 || v > 384 { - errors = append(errors, fmt.Errorf("%v must be between 1 and 384", k)) - return - } - - return warnings, errors -} - -func DbWorkloadType(i interface{}, k string) (warnings []string, errors []error) { - v, ok := i.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) - return - } - - if v != string(autonomousdatabases.WorkloadTypeDW) && v != string(autonomousdatabases.WorkloadTypeOLTP) { - errors = append(errors, fmt.Errorf("%v must be %v or %v", k, - string(autonomousdatabases.WorkloadTypeDW), string(autonomousdatabases.WorkloadTypeOLTP))) - return - } - - return -} - func AdbsComputeModel(i interface{}, k string) (warnings []string, errors []error) { v, ok := i.(string) if !ok { diff --git a/website/docs/d/oracle_autonomous_database_regular.html.markdown b/website/docs/d/oracle_autonomous_database_regular.html.markdown index 4fbb023ae03f..62f44fdafb67 100644 --- a/website/docs/d/oracle_autonomous_database_regular.html.markdown +++ b/website/docs/d/oracle_autonomous_database_regular.html.markdown @@ -3,12 +3,12 @@ subcategory: "Oracle" layout: "azurerm" page_title: "Azure Resource Manager: Data Source: azurerm_oracle_autonomous_database" description: |- - Gets information about an existing Autonomous Databases. + Gets information about an existing Autonomous Database. --- # Data Source: azurerm_oracle_autonomous_database -Use this data source to access information about an existing Autonomous Databases. +Use this data source to access information about an existing Autonomous Database. ## Example Usage @@ -27,15 +27,15 @@ output "id" { The following arguments are supported: -* `name` - (Required) The name of this Autonomous Databases. +* `name` - (Required) The name of this Autonomous Database. -* `resource_group_name` - (Required) The name of the Resource Group where the Autonomous Databases exists. +* `resource_group_name` - (Required) The name of the Resource Group where the Autonomous Database exists. ## Attributes Reference In addition to the Arguments listed above - the following Attributes are exported: -* `id` - The ID of the Autonomous Databases. +* `id` - The ID of the Autonomous Database. * `actual_used_data_storage_size_in_tbs` - The current amount of storage in use for user and system data, in terabytes (TB). @@ -87,7 +87,7 @@ In addition to the Arguments listed above - the following Attributes are exporte * `local_adg_auto_failover_max_data_loss_limit` - Parameter that allows users to select an acceptable maximum data loss limit in seconds, up to which Automatic Failover will be triggered when necessary for a Local Autonomous Data Guard -* `location` - The Azure Region where the Autonomous Databases exists. +* `location` - The Azure Region where the Autonomous Database exists. * `memory_per_oracle_compute_unit_in_gbs` - The amount of memory (in GBs) enabled per ECPU or OCPU. @@ -117,7 +117,7 @@ In addition to the Arguments listed above - the following Attributes are exporte * `supported_regions_to_clone_to` - The list of regions that support the creation of an Autonomous Database clone or an Autonomous Data Guard standby database. -* `tags` - A mapping of tags assigned to the Autonomous Databases. +* `tags` - A mapping of tags assigned to the Autonomous Database. * `time_created` - The date and time the Autonomous Database was created. @@ -153,4 +153,4 @@ In addition to the Arguments listed above - the following Attributes are exporte The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: -* `read` - (Defaults to 5 minutes) Used when retrieving the Autonomous Databases. +* `read` - (Defaults to 5 minutes) Used when retrieving the Autonomous Database. diff --git a/website/docs/r/oracle_autonomous_database_regular.html.markdown b/website/docs/r/oracle_autonomous_database_regular.html.markdown index bf7d9e7c3bec..8bcf81a5eee8 100644 --- a/website/docs/r/oracle_autonomous_database_regular.html.markdown +++ b/website/docs/r/oracle_autonomous_database_regular.html.markdown @@ -3,12 +3,12 @@ subcategory: "Oracle" layout: "azurerm" page_title: "Azure Resource Manager: azurerm_oracle_autonomous_database" description: |- - Manages a Autonomous Databases. + Manages an Autonomous Database. --- # azurerm_oracle_autonomous_database -Manages a Autonomous Databases. +Manages an Autonomous Database. ## Example Usage @@ -25,7 +25,7 @@ resource "azurerm_oracle_autonomous_database" "example" { compute_model = "example" data_storage_size_in_gbs = 42 auto_scaling_for_storage_enabled = false - virtual_network_id = "example" + virtual_network_id = "example" admin_password = "example" auto_scaling_enabled = "example" character_set = "example" @@ -40,11 +40,11 @@ resource "azurerm_oracle_autonomous_database" "example" { The following arguments are supported: -* `name` - (Required) The name which should be used for this Autonomous Databases. +* `name` - (Required) The name which should be used for this Autonomous Database. -* `resource_group_name` - (Required) The name of the Resource Group where the Autonomous Databases should exist. +* `resource_group_name` - (Required) The name of the Resource Group where the Autonomous Database should exist. -* `location` - (Required) The Azure Region where the Autonomous Databases should exist. Changing this forces a new Autonomous Databases to be created. +* `location` - (Required) The Azure Region where the Autonomous Database should exist. Changing this forces a new Autonomous Database to be created. * `admin_password` - (Required) The password must be between `12` and `30 `characters long, and must contain at least 1 uppercase, 1 lowercase, and 1 numeric character. It cannot contain the double quote symbol (") or the username "admin", regardless of casing. @@ -86,7 +86,7 @@ The following arguments are supported: * `customer_contacts` - (Optional) Specifies a list of customer contacts as email addresses. -* `tags` - (Optional) A mapping of tags which should be assigned to the Autonomous Databases. +* `tags` - (Optional) A mapping of tags which should be assigned to the Autonomous Database. ## Attributes Reference @@ -98,10 +98,10 @@ In addition to the Arguments listed above - the following Attributes are exporte The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: -* `create` - (Defaults to 2 hours) Used when creating the Autonomous Databases. -* `read` - (Defaults to 5 minutes) Used when retrieving the Autonomous Databases. -* `update` - (Defaults to 30 minutes) Used when updating the Autonomous Databases. -* `delete` - (Defaults to 30 minutes) Used when deleting the Autonomous Databases. +* `create` - (Defaults to 2 hours) Used when creating the Autonomous Database. +* `read` - (Defaults to 5 minutes) Used when retrieving the Autonomous Database. +* `update` - (Defaults to 30 minutes) Used when updating the Autonomous Database. +* `delete` - (Defaults to 30 minutes) Used when deleting the Autonomous Database. ## Import From 5a321532d992c70d15f732013f27b7a41345937d Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Wed, 23 Oct 2024 11:47:46 +0100 Subject: [PATCH 39/43] * Second batch of updates to address comments. --- .../services/oracle/autonomous_database_regular_resource.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/services/oracle/autonomous_database_regular_resource.go b/internal/services/oracle/autonomous_database_regular_resource.go index 72ca654bfb7c..26b9fcf5f61b 100644 --- a/internal/services/oracle/autonomous_database_regular_resource.go +++ b/internal/services/oracle/autonomous_database_regular_resource.go @@ -285,9 +285,12 @@ func (r AutonomousDatabaseRegularResource) Update() sdk.ResourceFunc { if err != nil { return fmt.Errorf("retrieving %s: %+v", *id) } + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } update := &autonomousdatabases.AutonomousDatabaseUpdate{ - Properties: &autonomousdatabases.AutonomousDatabaseUpdateProperties{} + Properties: &autonomousdatabases.AutonomousDatabaseUpdateProperties{}, } if metadata.ResourceData.HasChange("tags") { update.Tags = pointer.To(model.Tags) From 522d1be98abfe93d2d358656efa824cf31b3f65d Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Wed, 23 Oct 2024 11:54:42 +0100 Subject: [PATCH 40/43] * Update. --- .../services/oracle/autonomous_database_regular_resource.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/oracle/autonomous_database_regular_resource.go b/internal/services/oracle/autonomous_database_regular_resource.go index 26b9fcf5f61b..33e3c8107ac5 100644 --- a/internal/services/oracle/autonomous_database_regular_resource.go +++ b/internal/services/oracle/autonomous_database_regular_resource.go @@ -283,7 +283,7 @@ func (r AutonomousDatabaseRegularResource) Update() sdk.ResourceFunc { existing, err := client.Get(ctx, *id) if err != nil { - return fmt.Errorf("retrieving %s: %+v", *id) + return fmt.Errorf("retrieving %+v", *id) } if !response.WasNotFound(existing.HttpResponse) { return metadata.ResourceRequiresImport(r.ResourceType(), id) From a9601487e06ded71746ae3f697381c65ff03717e Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Wed, 23 Oct 2024 14:19:03 +0100 Subject: [PATCH 41/43] * Update to address comments. --- .../autonomous_database_regular_resource.go | 2 +- ...tonomous_database_regular_resource_test.go | 34 +++---------------- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/internal/services/oracle/autonomous_database_regular_resource.go b/internal/services/oracle/autonomous_database_regular_resource.go index 33e3c8107ac5..f48c335c7990 100644 --- a/internal/services/oracle/autonomous_database_regular_resource.go +++ b/internal/services/oracle/autonomous_database_regular_resource.go @@ -345,7 +345,7 @@ func (AutonomousDatabaseRegularResource) Read() sdk.ResourceFunc { if !ok { return fmt.Errorf("%s was not of type `Regular`", id) } - state.AdminPassword = pointer.From(props.AdminPassword) + state.AdminPassword = metadata.ResourceData.Get("admin_password").(string) state.AutoScalingEnabled = pointer.From(props.IsAutoScalingEnabled) state.BackupRetentionPeriodInDays = pointer.From(props.BackupRetentionPeriodInDays) state.AutoScalingForStorageEnabled = pointer.From(props.IsAutoScalingForStorageEnabled) diff --git a/internal/services/oracle/autonomous_database_regular_resource_test.go b/internal/services/oracle/autonomous_database_regular_resource_test.go index 885d0d7bcdd8..3484c97f3916 100644 --- a/internal/services/oracle/autonomous_database_regular_resource_test.go +++ b/internal/services/oracle/autonomous_database_regular_resource_test.go @@ -40,7 +40,7 @@ func TestAdbsRegularResource_basic(t *testing.T) { check.That(data.ResourceName).ExistsInAzure(r), ), }, - data.ImportStep(), + data.ImportStep("admin_password"), }) } @@ -54,7 +54,7 @@ func TestAdbsRegularResource_complete(t *testing.T) { check.That(data.ResourceName).ExistsInAzure(r), ), }, - data.ImportStep(), + data.ImportStep("admin_password"), }) } @@ -68,14 +68,14 @@ func TestAdbsRegularResource_update(t *testing.T) { check.That(data.ResourceName).ExistsInAzure(r), ), }, - data.ImportStep(), + data.ImportStep("admin_password"), { Config: r.update(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, - data.ImportStep(), + data.ImportStep("admin_password"), }) } @@ -96,7 +96,6 @@ func TestAdbsRegularResource_requiresImport(t *testing.T) { func (a AdbsRegularResource) basic(data acceptance.TestData) string { return fmt.Sprintf(` - %s provider "azurerm" { @@ -124,11 +123,6 @@ resource "azurerm_oracle_autonomous_database" "test" { national_character_set = "AL16UTF16" subnet_id = azurerm_subnet.test.id virtual_network_id = azurerm_virtual_network.test.id - lifecycle { - ignore_changes = [ - admin_password - ] - } } `, a.template(data), data.RandomInteger, data.Locations.Primary) } @@ -136,7 +130,6 @@ resource "azurerm_oracle_autonomous_database" "test" { func (a AdbsRegularResource) complete(data acceptance.TestData) string { return fmt.Sprintf(` - %s provider "azurerm" { @@ -165,11 +158,6 @@ resource "azurerm_oracle_autonomous_database" "test" { subnet_id = azurerm_subnet.test.id virtual_network_id = azurerm_virtual_network.test.id customer_contacts = ["test@test.com"] - lifecycle { - ignore_changes = [ - admin_password - ] - } } `, a.template(data), data.RandomInteger, data.Locations.Primary) } @@ -177,7 +165,6 @@ resource "azurerm_oracle_autonomous_database" "test" { func (a AdbsRegularResource) update(data acceptance.TestData) string { return fmt.Sprintf(` - %s provider "azurerm" { @@ -204,11 +191,6 @@ resource "azurerm_oracle_autonomous_database" "test" { national_character_set = "AL16UTF16" subnet_id = azurerm_subnet.test.id virtual_network_id = azurerm_virtual_network.test.id - lifecycle { - ignore_changes = [ - admin_password - ] - } } `, a.template(data), data.RandomInteger, data.Locations.Primary) } @@ -231,17 +213,12 @@ resource "azurerm_oracle_autonomous_database" "import" { mtls_connection_required = azurerm_oracle_autonomous_database.test.mtls_connection_required data_storage_size_in_tbs = azurerm_oracle_autonomous_database.test.data_storage_size_in_tbs db_workload = azurerm_oracle_autonomous_database.test.db_workload - admin_password = "TestPass#2024#" + admin_password = azurerm_oracle_autonomous_database.test.admin_password db_version = azurerm_oracle_autonomous_database.test.db_version character_set = azurerm_oracle_autonomous_database.test.character_set national_character_set = azurerm_oracle_autonomous_database.test.national_character_set subnet_id = azurerm_oracle_autonomous_database.test.subnet_id virtual_network_id = azurerm_oracle_autonomous_database.test.virtual_network_id - lifecycle { - ignore_changes = [ - admin_password - ] - } } `, a.basic(data)) } @@ -282,6 +259,5 @@ resource "azurerm_subnet" "test" { } } - `, data.RandomInteger, data.Locations.Primary, data.RandomString) } From 155b8667431c03bb8b1f0042bd5b781dca2945d2 Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Wed, 23 Oct 2024 15:14:25 +0100 Subject: [PATCH 42/43] * Add missing location. --- internal/services/oracle/autonomous_database_regular_resource.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/services/oracle/autonomous_database_regular_resource.go b/internal/services/oracle/autonomous_database_regular_resource.go index f48c335c7990..16c9289cf8c3 100644 --- a/internal/services/oracle/autonomous_database_regular_resource.go +++ b/internal/services/oracle/autonomous_database_regular_resource.go @@ -358,6 +358,7 @@ func (AutonomousDatabaseRegularResource) Read() sdk.ResourceFunc { state.DbVersion = pointer.From(props.DbVersion) state.DisplayName = pointer.From(props.DisplayName) state.LicenseModel = string(pointer.From(props.LicenseModel)) + state.Location = result.Model.Location state.Name = pointer.ToString(result.Model.Name) state.NationalCharacterSet = pointer.From(props.NcharacterSet) state.SubnetId = pointer.From(props.SubnetId) From 7ec144326aa0c2c23add0254e736f8edc1b7275c Mon Sep 17 00:00:00 2001 From: Eamon El-Homsi Date: Wed, 23 Oct 2024 16:11:26 +0100 Subject: [PATCH 43/43] * Fix. --- .../oracle/autonomous_database_regular_resource.go | 7 ++----- .../oracle/autonomous_database_regular_resource_test.go | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/internal/services/oracle/autonomous_database_regular_resource.go b/internal/services/oracle/autonomous_database_regular_resource.go index 16c9289cf8c3..13f96d515fb3 100644 --- a/internal/services/oracle/autonomous_database_regular_resource.go +++ b/internal/services/oracle/autonomous_database_regular_resource.go @@ -281,12 +281,9 @@ func (r AutonomousDatabaseRegularResource) Update() sdk.ResourceFunc { return fmt.Errorf("decoding err: %+v", err) } - existing, err := client.Get(ctx, *id) + _, err = client.Get(ctx, *id) if err != nil { - return fmt.Errorf("retrieving %+v", *id) - } - if !response.WasNotFound(existing.HttpResponse) { - return metadata.ResourceRequiresImport(r.ResourceType(), id) + return fmt.Errorf("retrieving %s: %+v", *id, err) } update := &autonomousdatabases.AutonomousDatabaseUpdate{ diff --git a/internal/services/oracle/autonomous_database_regular_resource_test.go b/internal/services/oracle/autonomous_database_regular_resource_test.go index 3484c97f3916..1457cd6fb5b7 100644 --- a/internal/services/oracle/autonomous_database_regular_resource_test.go +++ b/internal/services/oracle/autonomous_database_regular_resource_test.go @@ -96,6 +96,7 @@ func TestAdbsRegularResource_requiresImport(t *testing.T) { func (a AdbsRegularResource) basic(data acceptance.TestData) string { return fmt.Sprintf(` + %s provider "azurerm" { @@ -103,8 +104,7 @@ provider "azurerm" { } resource "azurerm_oracle_autonomous_database" "test" { - name = "OFake%[2]d" - + name = "OFake%[2]d" display_name = "OFake%[2]d" resource_group_name = azurerm_resource_group.test.name location = "%[3]s"