From 74509c2efa003f2f5328beb000e923804f9a394c Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Thu, 30 May 2024 01:16:02 -0700 Subject: [PATCH] [AutoRelease] t2-oracledatabase-2024-05-23-80615(can only be merged by SDK owner) (#35744) * code and test * Update CHANGELOG.md * update-testcase * Update assets.json --------- Co-authored-by: azure-sdk Co-authored-by: ChenxiJiang333 <119990644+ChenxiJiang333@users.noreply.github.com> Co-authored-by: ChenxiJiang333 --- .../azure-mgmt-oracledatabase/CHANGELOG.md | 5 + sdk/Oracle/azure-mgmt-oracledatabase/LICENSE | 21 + .../azure-mgmt-oracledatabase/MANIFEST.in | 8 + .../azure-mgmt-oracledatabase/README.md | 61 + .../azure-mgmt-oracledatabase/_meta.json | 11 + .../azure-mgmt-oracledatabase/assets.json | 6 + .../azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure/mgmt/oracledatabase/__init__.py | 26 + .../mgmt/oracledatabase/_configuration.py | 65 + .../_oracle_database_mgmt_client.py | 204 + .../azure/mgmt/oracledatabase/_patch.py | 20 + .../mgmt/oracledatabase/_serialization.py | 1998 +++++ .../azure/mgmt/oracledatabase/_vendor.py | 16 + .../azure/mgmt/oracledatabase/_version.py | 9 + .../azure/mgmt/oracledatabase/aio/__init__.py | 23 + .../mgmt/oracledatabase/aio/_configuration.py | 65 + .../aio/_oracle_database_mgmt_client.py | 206 + .../azure/mgmt/oracledatabase/aio/_patch.py | 20 + .../oracledatabase/aio/operations/__init__.py | 49 + ..._autonomous_database_backups_operations.py | 751 ++ ...mous_database_character_sets_operations.py | 200 + ...base_national_character_sets_operations.py | 204 + ...autonomous_database_versions_operations.py | 196 + .../_autonomous_databases_operations.py | 1331 ++++ ...loud_exadata_infrastructures_operations.py | 915 +++ .../_cloud_vm_clusters_operations.py | 1316 +++ .../aio/operations/_db_nodes_operations.py | 423 + .../aio/operations/_db_servers_operations.py | 207 + .../_db_system_shapes_operations.py | 196 + .../_dns_private_views_operations.py | 196 + .../_dns_private_zones_operations.py | 196 + .../aio/operations/_gi_versions_operations.py | 195 + .../aio/operations/_operations.py | 134 + .../_oracle_subscriptions_operations.py | 907 +++ .../oracledatabase/aio/operations/_patch.py | 20 + .../_virtual_network_addresses_operations.py | 538 ++ .../mgmt/oracledatabase/models/__init__.py | 329 + .../mgmt/oracledatabase/models/_models_py3.py | 7046 +++++++++++++++++ .../_oracle_database_mgmt_client_enums.py | 704 ++ .../mgmt/oracledatabase/models/_patch.py | 20 + .../oracledatabase/operations/__init__.py | 49 + ..._autonomous_database_backups_operations.py | 931 +++ ...mous_database_character_sets_operations.py | 256 + ...base_national_character_sets_operations.py | 260 + ...autonomous_database_versions_operations.py | 254 + .../_autonomous_databases_operations.py | 1616 ++++ ...loud_exadata_infrastructures_operations.py | 1145 +++ .../_cloud_vm_clusters_operations.py | 1601 ++++ .../operations/_db_nodes_operations.py | 520 ++ .../operations/_db_servers_operations.py | 284 + .../_db_system_shapes_operations.py | 253 + .../_dns_private_views_operations.py | 255 + .../_dns_private_zones_operations.py | 253 + .../operations/_gi_versions_operations.py | 253 + .../oracledatabase/operations/_operations.py | 156 + .../_oracle_subscriptions_operations.py | 1106 +++ .../mgmt/oracledatabase/operations/_patch.py | 20 + .../_virtual_network_addresses_operations.py | 686 ++ .../azure/mgmt/oracledatabase/py.typed | 1 + .../dev_requirements.txt | 3 + .../autonomous_database_backup_create.py | 52 + .../autonomous_database_backup_delete.py | 42 + .../autonomous_database_backup_get.py | 43 + ...tonomous_database_backup_list_by_parent.py | 43 + .../autonomous_database_character_set_get.py | 42 + ...database_character_set_list_by_location.py | 42 + .../autonomous_database_clone_create.py | 62 + .../autonomous_database_create.py | 61 + .../autonomous_database_delete.py | 41 + .../autonomous_database_failover.py | 45 + .../autonomous_database_generate_wallet.py | 45 + .../autonomous_database_get.py | 42 + ...onomous_database_list_by_resource_group.py | 42 + ...utonomous_database_list_by_subscription.py | 40 + ...ous_database_national_character_set_get.py | 42 + ...national_character_set_list_by_location.py | 42 + .../autonomous_database_switchover.py | 45 + .../autonomous_database_version_get.py | 42 + ...omous_database_version_list_by_location.py | 42 + .../generated_samples/db_nodes_action.py | 46 + .../generated_samples/db_nodes_get.py | 43 + .../db_nodes_list_by_parent.py | 43 + .../generated_samples/db_servers_get.py | 43 + .../db_servers_list_by_parent.py | 43 + .../generated_samples/db_system_shapes_get.py | 42 + .../db_system_shapes_list_by_location.py | 42 + .../dns_private_views_get.py | 42 + .../dns_private_views_list_by_location.py | 42 + .../dns_private_zones_get.py | 42 + .../dns_private_zones_list_by_location.py | 42 + .../exa_infra_add_storage_capacity.py | 42 + .../generated_samples/exa_infra_create.py | 50 + .../generated_samples/exa_infra_delete.py | 41 + .../generated_samples/exa_infra_get.py | 42 + .../exa_infra_list_by_resource_group.py | 42 + .../exa_infra_list_by_subscription.py | 40 + .../generated_samples/gi_versions_get.py | 42 + .../gi_versions_list_by_location.py | 42 + .../generated_samples/operations_list.py | 40 + .../oracle_subscriptions_create.py | 52 + .../oracle_subscriptions_delete.py | 38 + .../oracle_subscriptions_get.py | 39 + ...cle_subscriptions_list_activation_links.py | 39 + ...acle_subscriptions_list_by_subscription.py | 40 + ...ubscriptions_list_cloud_account_details.py | 39 + ...riptions_list_saas_subscription_details.py | 39 + .../virtual_network_addresses_create.py | 46 + .../virtual_network_addresses_delete.py | 42 + .../virtual_network_addresses_get.py | 43 + ...irtual_network_addresses_list_by_parent.py | 43 + .../generated_samples/vm_clusters_add_vms.py | 45 + .../generated_samples/vm_clusters_create.py | 82 + .../generated_samples/vm_clusters_delete.py | 41 + .../generated_samples/vm_clusters_get.py | 42 + .../vm_clusters_list_by_resource_group.py | 42 + .../vm_clusters_list_by_subscription.py | 40 + .../vm_clusters_list_private_ip_addresses.py | 45 + .../vm_clusters_remove_vms.py | 45 + .../sdk_packaging.toml | 12 + sdk/Oracle/azure-mgmt-oracledatabase/setup.py | 82 + .../tests/conftest.py | 50 + .../tests/test_cli_mgmt_oracledatabase.py | 43 + sdk/Oracle/ci.yml | 34 + 124 files changed, 31510 insertions(+) create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/CHANGELOG.md create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/LICENSE create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/MANIFEST.in create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/README.md create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/_meta.json create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/assets.json create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/__init__.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/__init__.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/__init__.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_configuration.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_oracle_database_mgmt_client.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_patch.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_serialization.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_vendor.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_version.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/__init__.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/_configuration.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/_oracle_database_mgmt_client.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/_patch.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/__init__.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_autonomous_database_backups_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_autonomous_database_character_sets_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_autonomous_database_national_character_sets_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_autonomous_database_versions_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_autonomous_databases_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_cloud_exadata_infrastructures_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_cloud_vm_clusters_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_db_nodes_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_db_servers_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_db_system_shapes_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_dns_private_views_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_dns_private_zones_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_gi_versions_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_oracle_subscriptions_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_patch.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_virtual_network_addresses_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/models/__init__.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/models/_models_py3.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/models/_oracle_database_mgmt_client_enums.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/models/_patch.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/__init__.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_autonomous_database_backups_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_autonomous_database_character_sets_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_autonomous_database_national_character_sets_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_autonomous_database_versions_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_autonomous_databases_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_cloud_exadata_infrastructures_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_cloud_vm_clusters_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_db_nodes_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_db_servers_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_db_system_shapes_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_dns_private_views_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_dns_private_zones_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_gi_versions_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_oracle_subscriptions_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_patch.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_virtual_network_addresses_operations.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/py.typed create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/dev_requirements.txt create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_backup_create.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_backup_delete.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_backup_get.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_backup_list_by_parent.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_character_set_get.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_character_set_list_by_location.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_clone_create.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_create.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_delete.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_failover.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_generate_wallet.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_get.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_list_by_resource_group.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_list_by_subscription.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_national_character_set_get.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_national_character_set_list_by_location.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_switchover.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_version_get.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_version_list_by_location.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_nodes_action.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_nodes_get.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_nodes_list_by_parent.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_servers_get.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_servers_list_by_parent.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_system_shapes_get.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_system_shapes_list_by_location.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/dns_private_views_get.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/dns_private_views_list_by_location.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/dns_private_zones_get.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/dns_private_zones_list_by_location.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_add_storage_capacity.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_create.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_delete.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_get.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_list_by_resource_group.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_list_by_subscription.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/gi_versions_get.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/gi_versions_list_by_location.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/operations_list.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_create.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_delete.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_get.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_list_activation_links.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_list_by_subscription.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_list_cloud_account_details.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_list_saas_subscription_details.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/virtual_network_addresses_create.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/virtual_network_addresses_delete.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/virtual_network_addresses_get.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/virtual_network_addresses_list_by_parent.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_add_vms.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_create.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_delete.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_get.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_list_by_resource_group.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_list_by_subscription.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_list_private_ip_addresses.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_remove_vms.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/sdk_packaging.toml create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/setup.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/tests/conftest.py create mode 100644 sdk/Oracle/azure-mgmt-oracledatabase/tests/test_cli_mgmt_oracledatabase.py create mode 100644 sdk/Oracle/ci.yml diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/CHANGELOG.md b/sdk/Oracle/azure-mgmt-oracledatabase/CHANGELOG.md new file mode 100644 index 000000000000..ca2d9af3f429 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0b1 (2024-05-27) + +* Initial Release diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/LICENSE b/sdk/Oracle/azure-mgmt-oracledatabase/LICENSE new file mode 100644 index 000000000000..b2f52a2bad4e --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/MANIFEST.in b/sdk/Oracle/azure-mgmt-oracledatabase/MANIFEST.in new file mode 100644 index 000000000000..22faeb8d9ebc --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/MANIFEST.in @@ -0,0 +1,8 @@ +include _meta.json +recursive-include tests *.py *.json +recursive-include samples *.py *.md +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE +include azure/mgmt/oracledatabase/py.typed diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/README.md b/sdk/Oracle/azure-mgmt-oracledatabase/README.md new file mode 100644 index 000000000000..d8be03bef386 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/README.md @@ -0,0 +1,61 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure Oracledatabase Management Client Library. +This package has been tested with Python 3.8+. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + +## _Disclaimer_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + +## Getting started + +### Prerequisites + +- Python 3.8+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) + +### Install the package + +```bash +pip install azure-mgmt-oracledatabase +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = OracleDatabaseMgmtClient(credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + +Code samples for this package can be found at: +- [Search Oracledatabase Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com +- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/_meta.json b/sdk/Oracle/azure-mgmt-oracledatabase/_meta.json new file mode 100644 index 000000000000..5afa8044ccb7 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "65da315d93751e6e06ffd42f44a77f5b1dac27bc", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.10.2", + "use": [ + "@autorest/python@6.13.16", + "@autorest/modelerfour@4.27.0" + ], + "autorest_command": "autorest specification/oracle/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.13.16 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "readme": "specification/oracle/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/assets.json b/sdk/Oracle/azure-mgmt-oracledatabase/assets.json new file mode 100644 index 000000000000..aaf6b632e43a --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "python", + "TagPrefix": "python/oracledatabase/azure-mgmt-oracledatabase", + "Tag": "python/oracledatabase/azure-mgmt-oracledatabase_2ff889d418" +} diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/__init__.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/__init__.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/__init__.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/__init__.py new file mode 100644 index 000000000000..d771d453e326 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/__init__.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._oracle_database_mgmt_client import OracleDatabaseMgmtClient +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "OracleDatabaseMgmtClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_configuration.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_configuration.py new file mode 100644 index 000000000000..92c8177dcb9e --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_configuration.py @@ -0,0 +1,65 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class OracleDatabaseMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for OracleDatabaseMgmtClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-09-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2023-09-01-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-oracledatabase/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_oracle_database_mgmt_client.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_oracle_database_mgmt_client.py new file mode 100644 index 000000000000..58436a224880 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_oracle_database_mgmt_client.py @@ -0,0 +1,204 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy + +from . import models as _models +from ._configuration import OracleDatabaseMgmtClientConfiguration +from ._serialization import Deserializer, Serializer +from .operations import ( + AutonomousDatabaseBackupsOperations, + AutonomousDatabaseCharacterSetsOperations, + AutonomousDatabaseNationalCharacterSetsOperations, + AutonomousDatabaseVersionsOperations, + AutonomousDatabasesOperations, + CloudExadataInfrastructuresOperations, + CloudVmClustersOperations, + DbNodesOperations, + DbServersOperations, + DbSystemShapesOperations, + DnsPrivateViewsOperations, + DnsPrivateZonesOperations, + GiVersionsOperations, + Operations, + OracleSubscriptionsOperations, + VirtualNetworkAddressesOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class OracleDatabaseMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """OracleDatabaseMgmtClient. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.oracledatabase.operations.Operations + :ivar autonomous_databases: AutonomousDatabasesOperations operations + :vartype autonomous_databases: + azure.mgmt.oracledatabase.operations.AutonomousDatabasesOperations + :ivar cloud_exadata_infrastructures: CloudExadataInfrastructuresOperations operations + :vartype cloud_exadata_infrastructures: + azure.mgmt.oracledatabase.operations.CloudExadataInfrastructuresOperations + :ivar cloud_vm_clusters: CloudVmClustersOperations operations + :vartype cloud_vm_clusters: azure.mgmt.oracledatabase.operations.CloudVmClustersOperations + :ivar autonomous_database_character_sets: AutonomousDatabaseCharacterSetsOperations operations + :vartype autonomous_database_character_sets: + azure.mgmt.oracledatabase.operations.AutonomousDatabaseCharacterSetsOperations + :ivar autonomous_database_national_character_sets: + AutonomousDatabaseNationalCharacterSetsOperations operations + :vartype autonomous_database_national_character_sets: + azure.mgmt.oracledatabase.operations.AutonomousDatabaseNationalCharacterSetsOperations + :ivar autonomous_database_versions: AutonomousDatabaseVersionsOperations operations + :vartype autonomous_database_versions: + azure.mgmt.oracledatabase.operations.AutonomousDatabaseVersionsOperations + :ivar db_system_shapes: DbSystemShapesOperations operations + :vartype db_system_shapes: azure.mgmt.oracledatabase.operations.DbSystemShapesOperations + :ivar dns_private_views: DnsPrivateViewsOperations operations + :vartype dns_private_views: azure.mgmt.oracledatabase.operations.DnsPrivateViewsOperations + :ivar dns_private_zones: DnsPrivateZonesOperations operations + :vartype dns_private_zones: azure.mgmt.oracledatabase.operations.DnsPrivateZonesOperations + :ivar gi_versions: GiVersionsOperations operations + :vartype gi_versions: azure.mgmt.oracledatabase.operations.GiVersionsOperations + :ivar oracle_subscriptions: OracleSubscriptionsOperations operations + :vartype oracle_subscriptions: + azure.mgmt.oracledatabase.operations.OracleSubscriptionsOperations + :ivar autonomous_database_backups: AutonomousDatabaseBackupsOperations operations + :vartype autonomous_database_backups: + azure.mgmt.oracledatabase.operations.AutonomousDatabaseBackupsOperations + :ivar db_servers: DbServersOperations operations + :vartype db_servers: azure.mgmt.oracledatabase.operations.DbServersOperations + :ivar db_nodes: DbNodesOperations operations + :vartype db_nodes: azure.mgmt.oracledatabase.operations.DbNodesOperations + :ivar virtual_network_addresses: VirtualNetworkAddressesOperations operations + :vartype virtual_network_addresses: + azure.mgmt.oracledatabase.operations.VirtualNetworkAddressesOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2023-09-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = OracleDatabaseMgmtClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.autonomous_databases = AutonomousDatabasesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.cloud_exadata_infrastructures = CloudExadataInfrastructuresOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.cloud_vm_clusters = CloudVmClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.autonomous_database_character_sets = AutonomousDatabaseCharacterSetsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.autonomous_database_national_character_sets = AutonomousDatabaseNationalCharacterSetsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.autonomous_database_versions = AutonomousDatabaseVersionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.db_system_shapes = DbSystemShapesOperations(self._client, self._config, self._serialize, self._deserialize) + self.dns_private_views = DnsPrivateViewsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.dns_private_zones = DnsPrivateZonesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.gi_versions = GiVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.oracle_subscriptions = OracleSubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.autonomous_database_backups = AutonomousDatabaseBackupsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.db_servers = DbServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.db_nodes = DbNodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_network_addresses = VirtualNetworkAddressesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "OracleDatabaseMgmtClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_patch.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_serialization.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_serialization.py new file mode 100644 index 000000000000..2f781d740827 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_serialization.py @@ -0,0 +1,1998 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore + +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError as err: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise DeserializationError("XML is invalid") from err + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone as _FixedOffset # type: ignore +except ImportError: # Python 2.7 + + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds() / 3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + + +try: + from datetime import timezone + + TZ_UTC = timezone.utc +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[Dict[str, Any]] = {} + for k in kwargs: + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node.""" + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result.update(objects[valuetype]._flatten_subtype(key, objects)) + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + Remove the polymorphic key from the initial data. + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + """ + return key.replace("\\.", ".") + + +class Serializer(object): + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, type]] = None): + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError as err: + if isinstance(err, SerializationError): + raise + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise SerializationError(msg) from err + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise SerializationError("Unable to build a model: " + str(err)) from err + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. + :rtype: str, list + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is CoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise SerializationError(msg.format(data, data_type)) from err + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + not be None or empty. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. + :rtype: list, str + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized.append(None) + + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise SerializationError(msg) from err + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise TypeError(msg) from err + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, type]] = None): + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, str): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map # type: ignore + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise DeserializationError(msg) from err + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + """ + if target is None: + return None, None + + if isinstance(target, str): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) # type: ignore + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise DeserializationError(msg) from err + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, str): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, str): + if attr.lower() in ["true", "1"]: + return True + elif attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + try: + return list(enum_obj.__members__.values())[data] + except IndexError: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(str(attr)) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise DeserializationError(msg) from err + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise DeserializationError(msg) from err + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise DeserializationError(msg) from err + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + attr = int(attr) + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise DeserializationError(msg) from err + else: + return date_obj diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_vendor.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_vendor.py new file mode 100644 index 000000000000..0dafe0e287ff --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_vendor.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_version.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/__init__.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/__init__.py new file mode 100644 index 000000000000..6439ec348295 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._oracle_database_mgmt_client import OracleDatabaseMgmtClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "OracleDatabaseMgmtClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/_configuration.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/_configuration.py new file mode 100644 index 000000000000..749c3e872e7b --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/_configuration.py @@ -0,0 +1,65 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class OracleDatabaseMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for OracleDatabaseMgmtClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-09-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2023-09-01-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-oracledatabase/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/_oracle_database_mgmt_client.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/_oracle_database_mgmt_client.py new file mode 100644 index 000000000000..3b684329b5e3 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/_oracle_database_mgmt_client.py @@ -0,0 +1,206 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy + +from .. import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import OracleDatabaseMgmtClientConfiguration +from .operations import ( + AutonomousDatabaseBackupsOperations, + AutonomousDatabaseCharacterSetsOperations, + AutonomousDatabaseNationalCharacterSetsOperations, + AutonomousDatabaseVersionsOperations, + AutonomousDatabasesOperations, + CloudExadataInfrastructuresOperations, + CloudVmClustersOperations, + DbNodesOperations, + DbServersOperations, + DbSystemShapesOperations, + DnsPrivateViewsOperations, + DnsPrivateZonesOperations, + GiVersionsOperations, + Operations, + OracleSubscriptionsOperations, + VirtualNetworkAddressesOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class OracleDatabaseMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """OracleDatabaseMgmtClient. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.oracledatabase.aio.operations.Operations + :ivar autonomous_databases: AutonomousDatabasesOperations operations + :vartype autonomous_databases: + azure.mgmt.oracledatabase.aio.operations.AutonomousDatabasesOperations + :ivar cloud_exadata_infrastructures: CloudExadataInfrastructuresOperations operations + :vartype cloud_exadata_infrastructures: + azure.mgmt.oracledatabase.aio.operations.CloudExadataInfrastructuresOperations + :ivar cloud_vm_clusters: CloudVmClustersOperations operations + :vartype cloud_vm_clusters: azure.mgmt.oracledatabase.aio.operations.CloudVmClustersOperations + :ivar autonomous_database_character_sets: AutonomousDatabaseCharacterSetsOperations operations + :vartype autonomous_database_character_sets: + azure.mgmt.oracledatabase.aio.operations.AutonomousDatabaseCharacterSetsOperations + :ivar autonomous_database_national_character_sets: + AutonomousDatabaseNationalCharacterSetsOperations operations + :vartype autonomous_database_national_character_sets: + azure.mgmt.oracledatabase.aio.operations.AutonomousDatabaseNationalCharacterSetsOperations + :ivar autonomous_database_versions: AutonomousDatabaseVersionsOperations operations + :vartype autonomous_database_versions: + azure.mgmt.oracledatabase.aio.operations.AutonomousDatabaseVersionsOperations + :ivar db_system_shapes: DbSystemShapesOperations operations + :vartype db_system_shapes: azure.mgmt.oracledatabase.aio.operations.DbSystemShapesOperations + :ivar dns_private_views: DnsPrivateViewsOperations operations + :vartype dns_private_views: azure.mgmt.oracledatabase.aio.operations.DnsPrivateViewsOperations + :ivar dns_private_zones: DnsPrivateZonesOperations operations + :vartype dns_private_zones: azure.mgmt.oracledatabase.aio.operations.DnsPrivateZonesOperations + :ivar gi_versions: GiVersionsOperations operations + :vartype gi_versions: azure.mgmt.oracledatabase.aio.operations.GiVersionsOperations + :ivar oracle_subscriptions: OracleSubscriptionsOperations operations + :vartype oracle_subscriptions: + azure.mgmt.oracledatabase.aio.operations.OracleSubscriptionsOperations + :ivar autonomous_database_backups: AutonomousDatabaseBackupsOperations operations + :vartype autonomous_database_backups: + azure.mgmt.oracledatabase.aio.operations.AutonomousDatabaseBackupsOperations + :ivar db_servers: DbServersOperations operations + :vartype db_servers: azure.mgmt.oracledatabase.aio.operations.DbServersOperations + :ivar db_nodes: DbNodesOperations operations + :vartype db_nodes: azure.mgmt.oracledatabase.aio.operations.DbNodesOperations + :ivar virtual_network_addresses: VirtualNetworkAddressesOperations operations + :vartype virtual_network_addresses: + azure.mgmt.oracledatabase.aio.operations.VirtualNetworkAddressesOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2023-09-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = OracleDatabaseMgmtClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.autonomous_databases = AutonomousDatabasesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.cloud_exadata_infrastructures = CloudExadataInfrastructuresOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.cloud_vm_clusters = CloudVmClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.autonomous_database_character_sets = AutonomousDatabaseCharacterSetsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.autonomous_database_national_character_sets = AutonomousDatabaseNationalCharacterSetsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.autonomous_database_versions = AutonomousDatabaseVersionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.db_system_shapes = DbSystemShapesOperations(self._client, self._config, self._serialize, self._deserialize) + self.dns_private_views = DnsPrivateViewsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.dns_private_zones = DnsPrivateZonesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.gi_versions = GiVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.oracle_subscriptions = OracleSubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.autonomous_database_backups = AutonomousDatabaseBackupsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.db_servers = DbServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.db_nodes = DbNodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_network_addresses = VirtualNetworkAddressesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "OracleDatabaseMgmtClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/_patch.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/__init__.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/__init__.py new file mode 100644 index 000000000000..31a80b7db934 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/__init__.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._autonomous_databases_operations import AutonomousDatabasesOperations +from ._cloud_exadata_infrastructures_operations import CloudExadataInfrastructuresOperations +from ._cloud_vm_clusters_operations import CloudVmClustersOperations +from ._autonomous_database_character_sets_operations import AutonomousDatabaseCharacterSetsOperations +from ._autonomous_database_national_character_sets_operations import AutonomousDatabaseNationalCharacterSetsOperations +from ._autonomous_database_versions_operations import AutonomousDatabaseVersionsOperations +from ._db_system_shapes_operations import DbSystemShapesOperations +from ._dns_private_views_operations import DnsPrivateViewsOperations +from ._dns_private_zones_operations import DnsPrivateZonesOperations +from ._gi_versions_operations import GiVersionsOperations +from ._oracle_subscriptions_operations import OracleSubscriptionsOperations +from ._autonomous_database_backups_operations import AutonomousDatabaseBackupsOperations +from ._db_servers_operations import DbServersOperations +from ._db_nodes_operations import DbNodesOperations +from ._virtual_network_addresses_operations import VirtualNetworkAddressesOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "Operations", + "AutonomousDatabasesOperations", + "CloudExadataInfrastructuresOperations", + "CloudVmClustersOperations", + "AutonomousDatabaseCharacterSetsOperations", + "AutonomousDatabaseNationalCharacterSetsOperations", + "AutonomousDatabaseVersionsOperations", + "DbSystemShapesOperations", + "DnsPrivateViewsOperations", + "DnsPrivateZonesOperations", + "GiVersionsOperations", + "OracleSubscriptionsOperations", + "AutonomousDatabaseBackupsOperations", + "DbServersOperations", + "DbNodesOperations", + "VirtualNetworkAddressesOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_autonomous_database_backups_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_autonomous_database_backups_operations.py new file mode 100644 index 000000000000..a73b5132e839 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_autonomous_database_backups_operations.py @@ -0,0 +1,751 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._autonomous_database_backups_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_autonomous_database_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AutonomousDatabaseBackupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`autonomous_database_backups` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_autonomous_database( + self, resource_group_name: str, autonomousdatabasename: str, **kwargs: Any + ) -> AsyncIterable["_models.AutonomousDatabaseBackup"]: + """List AutonomousDatabaseBackup resources by AutonomousDatabase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :return: An iterator like instance of either AutonomousDatabaseBackup or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AutonomousDatabaseBackupListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_autonomous_database_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AutonomousDatabaseBackupListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, autonomousdatabasename: str, adbbackupid: str, **kwargs: Any + ) -> _models.AutonomousDatabaseBackup: + """Get a AutonomousDatabaseBackup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param adbbackupid: AutonomousDatabaseBackup id. Required. + :type adbbackupid: str + :return: AutonomousDatabaseBackup or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AutonomousDatabaseBackup] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AutonomousDatabaseBackup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + adbbackupid: str, + resource: Union[_models.AutonomousDatabaseBackup, IO[bytes]], + **kwargs: Any + ) -> _models.AutonomousDatabaseBackup: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutonomousDatabaseBackup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "AutonomousDatabaseBackup") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("AutonomousDatabaseBackup", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("AutonomousDatabaseBackup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + adbbackupid: str, + resource: _models.AutonomousDatabaseBackup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabaseBackup]: + """Create a AutonomousDatabaseBackup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param adbbackupid: AutonomousDatabaseBackup id. Required. + :type adbbackupid: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AutonomousDatabaseBackup or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + adbbackupid: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabaseBackup]: + """Create a AutonomousDatabaseBackup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param adbbackupid: AutonomousDatabaseBackup id. Required. + :type adbbackupid: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AutonomousDatabaseBackup or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + adbbackupid: str, + resource: Union[_models.AutonomousDatabaseBackup, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabaseBackup]: + """Create a AutonomousDatabaseBackup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param adbbackupid: AutonomousDatabaseBackup id. Required. + :type adbbackupid: str + :param resource: Resource create parameters. Is either a AutonomousDatabaseBackup type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup or IO[bytes] + :return: An instance of AsyncLROPoller that returns either AutonomousDatabaseBackup or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutonomousDatabaseBackup] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AutonomousDatabaseBackup", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.AutonomousDatabaseBackup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AutonomousDatabaseBackup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + adbbackupid: str, + properties: Union[_models.AutonomousDatabaseBackupUpdate, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.AutonomousDatabaseBackup]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.AutonomousDatabaseBackup]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "AutonomousDatabaseBackupUpdate") + + _request = build_update_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("AutonomousDatabaseBackup", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + adbbackupid: str, + properties: _models.AutonomousDatabaseBackupUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabaseBackup]: + """Update a AutonomousDatabaseBackup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param adbbackupid: AutonomousDatabaseBackup id. Required. + :type adbbackupid: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackupUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AutonomousDatabaseBackup or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + adbbackupid: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabaseBackup]: + """Update a AutonomousDatabaseBackup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param adbbackupid: AutonomousDatabaseBackup id. Required. + :type adbbackupid: str + :param properties: The resource properties to be updated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AutonomousDatabaseBackup or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + adbbackupid: str, + properties: Union[_models.AutonomousDatabaseBackupUpdate, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabaseBackup]: + """Update a AutonomousDatabaseBackup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param adbbackupid: AutonomousDatabaseBackup id. Required. + :type adbbackupid: str + :param properties: The resource properties to be updated. Is either a + AutonomousDatabaseBackupUpdate type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackupUpdate or IO[bytes] + :return: An instance of AsyncLROPoller that returns either AutonomousDatabaseBackup or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutonomousDatabaseBackup] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AutonomousDatabaseBackup", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.AutonomousDatabaseBackup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AutonomousDatabaseBackup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, autonomousdatabasename: str, adbbackupid: str, **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, autonomousdatabasename: str, adbbackupid: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a AutonomousDatabaseBackup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param adbbackupid: AutonomousDatabaseBackup id. Required. + :type adbbackupid: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_autonomous_database_character_sets_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_autonomous_database_character_sets_operations.py new file mode 100644 index 000000000000..fbef63286512 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_autonomous_database_character_sets_operations.py @@ -0,0 +1,200 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._autonomous_database_character_sets_operations import ( + build_get_request, + build_list_by_location_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AutonomousDatabaseCharacterSetsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`autonomous_database_character_sets` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_models.AutonomousDatabaseCharacterSet"]: + """List AutonomousDatabaseCharacterSet resources by Location. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of either AutonomousDatabaseCharacterSet or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDatabaseCharacterSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AutonomousDatabaseCharacterSetListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AutonomousDatabaseCharacterSetListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, location: str, adbscharsetname: str, **kwargs: Any) -> _models.AutonomousDatabaseCharacterSet: + """Get a AutonomousDatabaseCharacterSet. + + :param location: The name of the Azure region. Required. + :type location: str + :param adbscharsetname: AutonomousDatabaseCharacterSet name. Required. + :type adbscharsetname: str + :return: AutonomousDatabaseCharacterSet or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseCharacterSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AutonomousDatabaseCharacterSet] = kwargs.pop("cls", None) + + _request = build_get_request( + location=location, + adbscharsetname=adbscharsetname, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AutonomousDatabaseCharacterSet", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_autonomous_database_national_character_sets_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_autonomous_database_national_character_sets_operations.py new file mode 100644 index 000000000000..2d8c1fc08ab2 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_autonomous_database_national_character_sets_operations.py @@ -0,0 +1,204 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._autonomous_database_national_character_sets_operations import ( + build_get_request, + build_list_by_location_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AutonomousDatabaseNationalCharacterSetsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`autonomous_database_national_character_sets` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_location( + self, location: str, **kwargs: Any + ) -> AsyncIterable["_models.AutonomousDatabaseNationalCharacterSet"]: + """List AutonomousDatabaseNationalCharacterSet resources by Location. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of either AutonomousDatabaseNationalCharacterSet or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDatabaseNationalCharacterSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AutonomousDatabaseNationalCharacterSetListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AutonomousDatabaseNationalCharacterSetListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, location: str, adbsncharsetname: str, **kwargs: Any + ) -> _models.AutonomousDatabaseNationalCharacterSet: + """Get a AutonomousDatabaseNationalCharacterSet. + + :param location: The name of the Azure region. Required. + :type location: str + :param adbsncharsetname: AutonomousDatabaseNationalCharacterSets name. Required. + :type adbsncharsetname: str + :return: AutonomousDatabaseNationalCharacterSet or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseNationalCharacterSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AutonomousDatabaseNationalCharacterSet] = kwargs.pop("cls", None) + + _request = build_get_request( + location=location, + adbsncharsetname=adbsncharsetname, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AutonomousDatabaseNationalCharacterSet", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_autonomous_database_versions_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_autonomous_database_versions_operations.py new file mode 100644 index 000000000000..675b6181b104 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_autonomous_database_versions_operations.py @@ -0,0 +1,196 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._autonomous_database_versions_operations import build_get_request, build_list_by_location_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AutonomousDatabaseVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`autonomous_database_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_models.AutonomousDbVersion"]: + """List AutonomousDbVersion resources by Location. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of either AutonomousDbVersion or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDbVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AutonomousDbVersionListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AutonomousDbVersionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, location: str, autonomousdbversionsname: str, **kwargs: Any) -> _models.AutonomousDbVersion: + """Get a AutonomousDbVersion. + + :param location: The name of the Azure region. Required. + :type location: str + :param autonomousdbversionsname: AutonomousDbVersion name. Required. + :type autonomousdbversionsname: str + :return: AutonomousDbVersion or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDbVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AutonomousDbVersion] = kwargs.pop("cls", None) + + _request = build_get_request( + location=location, + autonomousdbversionsname=autonomousdbversionsname, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AutonomousDbVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_autonomous_databases_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_autonomous_databases_operations.py new file mode 100644 index 000000000000..015661c56809 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_autonomous_databases_operations.py @@ -0,0 +1,1331 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._autonomous_databases_operations import ( + build_create_or_update_request, + build_delete_request, + build_failover_request, + build_generate_wallet_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_switchover_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AutonomousDatabasesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`autonomous_databases` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.AutonomousDatabase"]: + """List AutonomousDatabase resources by subscription ID. + + :return: An iterator like instance of either AutonomousDatabase or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AutonomousDatabaseListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AutonomousDatabaseListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AutonomousDatabase"]: + """List AutonomousDatabase resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either AutonomousDatabase or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AutonomousDatabaseListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AutonomousDatabaseListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, autonomousdatabasename: str, **kwargs: Any + ) -> _models.AutonomousDatabase: + """Get a AutonomousDatabase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :return: AutonomousDatabase or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabase + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AutonomousDatabase] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AutonomousDatabase", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + resource: Union[_models.AutonomousDatabase, IO[bytes]], + **kwargs: Any + ) -> _models.AutonomousDatabase: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutonomousDatabase] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "AutonomousDatabase") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("AutonomousDatabase", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("AutonomousDatabase", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + resource: _models.AutonomousDatabase, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabase]: + """Create a AutonomousDatabase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.oracledatabase.models.AutonomousDatabase + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabase]: + """Create a AutonomousDatabase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + resource: Union[_models.AutonomousDatabase, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabase]: + """Create a AutonomousDatabase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param resource: Resource create parameters. Is either a AutonomousDatabase type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.oracledatabase.models.AutonomousDatabase or IO[bytes] + :return: An instance of AsyncLROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutonomousDatabase] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AutonomousDatabase", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.AutonomousDatabase].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AutonomousDatabase]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + properties: Union[_models.AutonomousDatabaseUpdate, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.AutonomousDatabase]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.AutonomousDatabase]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "AutonomousDatabaseUpdate") + + _request = build_update_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("AutonomousDatabase", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + properties: _models.AutonomousDatabaseUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabase]: + """Update a AutonomousDatabase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabase]: + """Update a AutonomousDatabase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param properties: The resource properties to be updated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + properties: Union[_models.AutonomousDatabaseUpdate, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabase]: + """Update a AutonomousDatabase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param properties: The resource properties to be updated. Is either a AutonomousDatabaseUpdate + type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseUpdate or IO[bytes] + :return: An instance of AsyncLROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutonomousDatabase] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AutonomousDatabase", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.AutonomousDatabase].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AutonomousDatabase]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, autonomousdatabasename: str, **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, autonomousdatabasename: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a AutonomousDatabase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _failover_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: Union[_models.PeerDbDetails, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.AutonomousDatabase]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.AutonomousDatabase]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "PeerDbDetails") + + _request = build_failover_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("AutonomousDatabase", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_failover( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: _models.PeerDbDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabase]: + """Perform failover action on Autonomous Database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.oracledatabase.models.PeerDbDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_failover( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabase]: + """Perform failover action on Autonomous Database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_failover( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: Union[_models.PeerDbDetails, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabase]: + """Perform failover action on Autonomous Database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param body: The content of the action request. Is either a PeerDbDetails type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.oracledatabase.models.PeerDbDetails or IO[bytes] + :return: An instance of AsyncLROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutonomousDatabase] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._failover_initial( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AutonomousDatabase", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.AutonomousDatabase].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AutonomousDatabase]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def generate_wallet( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: _models.GenerateAutonomousDatabaseWalletDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AutonomousDatabaseWalletFile: + """Generate wallet action on Autonomous Database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.oracledatabase.models.GenerateAutonomousDatabaseWalletDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AutonomousDatabaseWalletFile or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseWalletFile + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def generate_wallet( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AutonomousDatabaseWalletFile: + """Generate wallet action on Autonomous Database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AutonomousDatabaseWalletFile or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseWalletFile + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def generate_wallet( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: Union[_models.GenerateAutonomousDatabaseWalletDetails, IO[bytes]], + **kwargs: Any + ) -> _models.AutonomousDatabaseWalletFile: + """Generate wallet action on Autonomous Database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param body: The content of the action request. Is either a + GenerateAutonomousDatabaseWalletDetails type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.oracledatabase.models.GenerateAutonomousDatabaseWalletDetails or + IO[bytes] + :return: AutonomousDatabaseWalletFile or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseWalletFile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutonomousDatabaseWalletFile] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "GenerateAutonomousDatabaseWalletDetails") + + _request = build_generate_wallet_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AutonomousDatabaseWalletFile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _switchover_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: Union[_models.PeerDbDetails, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.AutonomousDatabase]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.AutonomousDatabase]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "PeerDbDetails") + + _request = build_switchover_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("AutonomousDatabase", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_switchover( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: _models.PeerDbDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabase]: + """Perform switchover action on Autonomous Database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.oracledatabase.models.PeerDbDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_switchover( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabase]: + """Perform switchover action on Autonomous Database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_switchover( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: Union[_models.PeerDbDetails, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.AutonomousDatabase]: + """Perform switchover action on Autonomous Database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param body: The content of the action request. Is either a PeerDbDetails type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.oracledatabase.models.PeerDbDetails or IO[bytes] + :return: An instance of AsyncLROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutonomousDatabase] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._switchover_initial( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AutonomousDatabase", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.AutonomousDatabase].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AutonomousDatabase]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_cloud_exadata_infrastructures_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_cloud_exadata_infrastructures_operations.py new file mode 100644 index 000000000000..1e1f74b743bd --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_cloud_exadata_infrastructures_operations.py @@ -0,0 +1,915 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._cloud_exadata_infrastructures_operations import ( + build_add_storage_capacity_request, + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class CloudExadataInfrastructuresOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`cloud_exadata_infrastructures` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.CloudExadataInfrastructure"]: + """List CloudExadataInfrastructure resources by subscription ID. + + :return: An iterator like instance of either CloudExadataInfrastructure or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CloudExadataInfrastructureListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CloudExadataInfrastructureListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.CloudExadataInfrastructure"]: + """List CloudExadataInfrastructure resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either CloudExadataInfrastructure or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CloudExadataInfrastructureListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CloudExadataInfrastructureListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, cloudexadatainfrastructurename: str, **kwargs: Any + ) -> _models.CloudExadataInfrastructure: + """Get a CloudExadataInfrastructure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudexadatainfrastructurename: CloudExadataInfrastructure name. Required. + :type cloudexadatainfrastructurename: str + :return: CloudExadataInfrastructure or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CloudExadataInfrastructure] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CloudExadataInfrastructure", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + cloudexadatainfrastructurename: str, + resource: Union[_models.CloudExadataInfrastructure, IO[bytes]], + **kwargs: Any + ) -> _models.CloudExadataInfrastructure: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CloudExadataInfrastructure] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "CloudExadataInfrastructure") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CloudExadataInfrastructure", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("CloudExadataInfrastructure", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cloudexadatainfrastructurename: str, + resource: _models.CloudExadataInfrastructure, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudExadataInfrastructure]: + """Create a CloudExadataInfrastructure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudexadatainfrastructurename: CloudExadataInfrastructure name. Required. + :type cloudexadatainfrastructurename: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CloudExadataInfrastructure or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cloudexadatainfrastructurename: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudExadataInfrastructure]: + """Create a CloudExadataInfrastructure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudexadatainfrastructurename: CloudExadataInfrastructure name. Required. + :type cloudexadatainfrastructurename: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CloudExadataInfrastructure or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + cloudexadatainfrastructurename: str, + resource: Union[_models.CloudExadataInfrastructure, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudExadataInfrastructure]: + """Create a CloudExadataInfrastructure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudexadatainfrastructurename: CloudExadataInfrastructure name. Required. + :type cloudexadatainfrastructurename: str + :param resource: Resource create parameters. Is either a CloudExadataInfrastructure type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure or IO[bytes] + :return: An instance of AsyncLROPoller that returns either CloudExadataInfrastructure or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CloudExadataInfrastructure] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CloudExadataInfrastructure", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CloudExadataInfrastructure].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CloudExadataInfrastructure]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + cloudexadatainfrastructurename: str, + properties: Union[_models.CloudExadataInfrastructureUpdate, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.CloudExadataInfrastructure]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.CloudExadataInfrastructure]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "CloudExadataInfrastructureUpdate") + + _request = build_update_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CloudExadataInfrastructure", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + cloudexadatainfrastructurename: str, + properties: _models.CloudExadataInfrastructureUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudExadataInfrastructure]: + """Update a CloudExadataInfrastructure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudexadatainfrastructurename: CloudExadataInfrastructure name. Required. + :type cloudexadatainfrastructurename: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.oracledatabase.models.CloudExadataInfrastructureUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CloudExadataInfrastructure or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + cloudexadatainfrastructurename: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudExadataInfrastructure]: + """Update a CloudExadataInfrastructure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudexadatainfrastructurename: CloudExadataInfrastructure name. Required. + :type cloudexadatainfrastructurename: str + :param properties: The resource properties to be updated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CloudExadataInfrastructure or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + cloudexadatainfrastructurename: str, + properties: Union[_models.CloudExadataInfrastructureUpdate, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudExadataInfrastructure]: + """Update a CloudExadataInfrastructure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudexadatainfrastructurename: CloudExadataInfrastructure name. Required. + :type cloudexadatainfrastructurename: str + :param properties: The resource properties to be updated. Is either a + CloudExadataInfrastructureUpdate type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.oracledatabase.models.CloudExadataInfrastructureUpdate or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either CloudExadataInfrastructure or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CloudExadataInfrastructure] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CloudExadataInfrastructure", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CloudExadataInfrastructure].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CloudExadataInfrastructure]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cloudexadatainfrastructurename: str, **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, cloudexadatainfrastructurename: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a CloudExadataInfrastructure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudexadatainfrastructurename: CloudExadataInfrastructure name. Required. + :type cloudexadatainfrastructurename: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _add_storage_capacity_initial( + self, resource_group_name: str, cloudexadatainfrastructurename: str, **kwargs: Any + ) -> Optional[_models.CloudExadataInfrastructure]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.CloudExadataInfrastructure]] = kwargs.pop("cls", None) + + _request = build_add_storage_capacity_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CloudExadataInfrastructure", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_add_storage_capacity( + self, resource_group_name: str, cloudexadatainfrastructurename: str, **kwargs: Any + ) -> AsyncLROPoller[_models.CloudExadataInfrastructure]: + """Perform add storage capacity on exadata infra. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudexadatainfrastructurename: CloudExadataInfrastructure name. Required. + :type cloudexadatainfrastructurename: str + :return: An instance of AsyncLROPoller that returns either CloudExadataInfrastructure or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CloudExadataInfrastructure] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._add_storage_capacity_initial( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CloudExadataInfrastructure", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CloudExadataInfrastructure].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CloudExadataInfrastructure]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_cloud_vm_clusters_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_cloud_vm_clusters_operations.py new file mode 100644 index 000000000000..4747153cd3b5 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_cloud_vm_clusters_operations.py @@ -0,0 +1,1316 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._cloud_vm_clusters_operations import ( + build_add_vms_request, + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_list_private_ip_addresses_request, + build_remove_vms_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class CloudVmClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`cloud_vm_clusters` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.CloudVmCluster"]: + """List CloudVmCluster resources by subscription ID. + + :return: An iterator like instance of either CloudVmCluster or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CloudVmClusterListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CloudVmClusterListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.CloudVmCluster"]: + """List CloudVmCluster resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either CloudVmCluster or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CloudVmClusterListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CloudVmClusterListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, resource_group_name: str, cloudvmclustername: str, **kwargs: Any) -> _models.CloudVmCluster: + """Get a CloudVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :return: CloudVmCluster or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.CloudVmCluster + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CloudVmCluster] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CloudVmCluster", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + resource: Union[_models.CloudVmCluster, IO[bytes]], + **kwargs: Any + ) -> _models.CloudVmCluster: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CloudVmCluster] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "CloudVmCluster") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CloudVmCluster", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("CloudVmCluster", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cloudvmclustername: str, + resource: _models.CloudVmCluster, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudVmCluster]: + """Create a CloudVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.oracledatabase.models.CloudVmCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cloudvmclustername: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudVmCluster]: + """Create a CloudVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + cloudvmclustername: str, + resource: Union[_models.CloudVmCluster, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudVmCluster]: + """Create a CloudVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param resource: Resource create parameters. Is either a CloudVmCluster type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.oracledatabase.models.CloudVmCluster or IO[bytes] + :return: An instance of AsyncLROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CloudVmCluster] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CloudVmCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CloudVmCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CloudVmCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + properties: Union[_models.CloudVmClusterUpdate, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.CloudVmCluster]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.CloudVmCluster]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "CloudVmClusterUpdate") + + _request = build_update_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CloudVmCluster", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + cloudvmclustername: str, + properties: _models.CloudVmClusterUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudVmCluster]: + """Update a CloudVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.oracledatabase.models.CloudVmClusterUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + cloudvmclustername: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudVmCluster]: + """Update a CloudVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param properties: The resource properties to be updated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + cloudvmclustername: str, + properties: Union[_models.CloudVmClusterUpdate, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudVmCluster]: + """Update a CloudVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param properties: The resource properties to be updated. Is either a CloudVmClusterUpdate type + or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.oracledatabase.models.CloudVmClusterUpdate or IO[bytes] + :return: An instance of AsyncLROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CloudVmCluster] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CloudVmCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CloudVmCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CloudVmCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cloudvmclustername: str, **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, cloudvmclustername: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a CloudVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _add_vms_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + body: Union[_models.AddRemoveDbNode, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.CloudVmCluster]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.CloudVmCluster]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "AddRemoveDbNode") + + _request = build_add_vms_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CloudVmCluster", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_add_vms( + self, + resource_group_name: str, + cloudvmclustername: str, + body: _models.AddRemoveDbNode, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudVmCluster]: + """Add VMs to the VM Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.oracledatabase.models.AddRemoveDbNode + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_add_vms( + self, + resource_group_name: str, + cloudvmclustername: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudVmCluster]: + """Add VMs to the VM Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_add_vms( + self, + resource_group_name: str, + cloudvmclustername: str, + body: Union[_models.AddRemoveDbNode, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudVmCluster]: + """Add VMs to the VM Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param body: The content of the action request. Is either a AddRemoveDbNode type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.oracledatabase.models.AddRemoveDbNode or IO[bytes] + :return: An instance of AsyncLROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CloudVmCluster] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._add_vms_initial( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CloudVmCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CloudVmCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CloudVmCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def list_private_ip_addresses( + self, + resource_group_name: str, + cloudvmclustername: str, + body: _models.PrivateIpAddressesFilter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> List[_models.PrivateIpAddressProperties]: + """List Private IP Addresses by the provided filter. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.oracledatabase.models.PrivateIpAddressesFilter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: list of PrivateIpAddressProperties or the result of cls(response) + :rtype: list[~azure.mgmt.oracledatabase.models.PrivateIpAddressProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def list_private_ip_addresses( + self, + resource_group_name: str, + cloudvmclustername: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> List[_models.PrivateIpAddressProperties]: + """List Private IP Addresses by the provided filter. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: list of PrivateIpAddressProperties or the result of cls(response) + :rtype: list[~azure.mgmt.oracledatabase.models.PrivateIpAddressProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def list_private_ip_addresses( + self, + resource_group_name: str, + cloudvmclustername: str, + body: Union[_models.PrivateIpAddressesFilter, IO[bytes]], + **kwargs: Any + ) -> List[_models.PrivateIpAddressProperties]: + """List Private IP Addresses by the provided filter. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param body: The content of the action request. Is either a PrivateIpAddressesFilter type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.oracledatabase.models.PrivateIpAddressesFilter or IO[bytes] + :return: list of PrivateIpAddressProperties or the result of cls(response) + :rtype: list[~azure.mgmt.oracledatabase.models.PrivateIpAddressProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[List[_models.PrivateIpAddressProperties]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "PrivateIpAddressesFilter") + + _request = build_list_private_ip_addresses_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("[PrivateIpAddressProperties]", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _remove_vms_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + body: Union[_models.AddRemoveDbNode, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.CloudVmCluster]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.CloudVmCluster]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "AddRemoveDbNode") + + _request = build_remove_vms_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CloudVmCluster", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_remove_vms( + self, + resource_group_name: str, + cloudvmclustername: str, + body: _models.AddRemoveDbNode, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudVmCluster]: + """Remove VMs from the VM Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.oracledatabase.models.AddRemoveDbNode + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_remove_vms( + self, + resource_group_name: str, + cloudvmclustername: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudVmCluster]: + """Remove VMs from the VM Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_remove_vms( + self, + resource_group_name: str, + cloudvmclustername: str, + body: Union[_models.AddRemoveDbNode, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CloudVmCluster]: + """Remove VMs from the VM Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param body: The content of the action request. Is either a AddRemoveDbNode type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.oracledatabase.models.AddRemoveDbNode or IO[bytes] + :return: An instance of AsyncLROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CloudVmCluster] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._remove_vms_initial( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CloudVmCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CloudVmCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CloudVmCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_db_nodes_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_db_nodes_operations.py new file mode 100644 index 000000000000..001447e2fce3 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_db_nodes_operations.py @@ -0,0 +1,423 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._db_nodes_operations import ( + build_action_request, + build_get_request, + build_list_by_cloud_vm_cluster_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DbNodesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`db_nodes` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_cloud_vm_cluster( + self, resource_group_name: str, cloudvmclustername: str, **kwargs: Any + ) -> AsyncIterable["_models.DbNode"]: + """List DbNode resources by CloudVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :return: An iterator like instance of either DbNode or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.DbNode] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DbNodeListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_cloud_vm_cluster_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DbNodeListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, cloudvmclustername: str, dbnodeocid: str, **kwargs: Any + ) -> _models.DbNode: + """Get a DbNode. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param dbnodeocid: DbNode OCID. Required. + :type dbnodeocid: str + :return: DbNode or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.DbNode + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DbNode] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + dbnodeocid=dbnodeocid, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DbNode", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _action_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + dbnodeocid: str, + body: Union[_models.DbNodeAction, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.DbNode]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.DbNode]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "DbNodeAction") + + _request = build_action_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + dbnodeocid=dbnodeocid, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("DbNode", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_action( + self, + resource_group_name: str, + cloudvmclustername: str, + dbnodeocid: str, + body: _models.DbNodeAction, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DbNode]: + """VM actions on DbNode of VM Cluster by the provided filter. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param dbnodeocid: DbNode OCID. Required. + :type dbnodeocid: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.oracledatabase.models.DbNodeAction + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DbNode or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.DbNode] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_action( + self, + resource_group_name: str, + cloudvmclustername: str, + dbnodeocid: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DbNode]: + """VM actions on DbNode of VM Cluster by the provided filter. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param dbnodeocid: DbNode OCID. Required. + :type dbnodeocid: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DbNode or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.DbNode] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_action( + self, + resource_group_name: str, + cloudvmclustername: str, + dbnodeocid: str, + body: Union[_models.DbNodeAction, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.DbNode]: + """VM actions on DbNode of VM Cluster by the provided filter. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param dbnodeocid: DbNode OCID. Required. + :type dbnodeocid: str + :param body: The content of the action request. Is either a DbNodeAction type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.oracledatabase.models.DbNodeAction or IO[bytes] + :return: An instance of AsyncLROPoller that returns either DbNode or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.DbNode] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DbNode] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._action_initial( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + dbnodeocid=dbnodeocid, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DbNode", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DbNode].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DbNode]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_db_servers_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_db_servers_operations.py new file mode 100644 index 000000000000..7486cba97bfd --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_db_servers_operations.py @@ -0,0 +1,207 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._db_servers_operations import build_get_request, build_list_by_cloud_exadata_infrastructure_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DbServersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`db_servers` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_cloud_exadata_infrastructure( + self, resource_group_name: str, cloudexadatainfrastructurename: str, **kwargs: Any + ) -> AsyncIterable["_models.DbServer"]: + """List DbServer resources by CloudExadataInfrastructure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudexadatainfrastructurename: CloudExadataInfrastructure name. Required. + :type cloudexadatainfrastructurename: str + :return: An iterator like instance of either DbServer or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.DbServer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DbServerListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_cloud_exadata_infrastructure_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DbServerListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, cloudexadatainfrastructurename: str, dbserverocid: str, **kwargs: Any + ) -> _models.DbServer: + """Get a DbServer. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudexadatainfrastructurename: CloudExadataInfrastructure name. Required. + :type cloudexadatainfrastructurename: str + :param dbserverocid: DbServer OCID. Required. + :type dbserverocid: str + :return: DbServer or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.DbServer + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DbServer] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + dbserverocid=dbserverocid, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DbServer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_db_system_shapes_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_db_system_shapes_operations.py new file mode 100644 index 000000000000..d3886d5f0334 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_db_system_shapes_operations.py @@ -0,0 +1,196 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._db_system_shapes_operations import build_get_request, build_list_by_location_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DbSystemShapesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`db_system_shapes` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_models.DbSystemShape"]: + """List DbSystemShape resources by Location. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of either DbSystemShape or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.DbSystemShape] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DbSystemShapeListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DbSystemShapeListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, location: str, dbsystemshapename: str, **kwargs: Any) -> _models.DbSystemShape: + """Get a DbSystemShape. + + :param location: The name of the Azure region. Required. + :type location: str + :param dbsystemshapename: DbSystemShape name. Required. + :type dbsystemshapename: str + :return: DbSystemShape or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.DbSystemShape + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DbSystemShape] = kwargs.pop("cls", None) + + _request = build_get_request( + location=location, + dbsystemshapename=dbsystemshapename, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DbSystemShape", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_dns_private_views_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_dns_private_views_operations.py new file mode 100644 index 000000000000..3e3eca3bdf66 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_dns_private_views_operations.py @@ -0,0 +1,196 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._dns_private_views_operations import build_get_request, build_list_by_location_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DnsPrivateViewsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`dns_private_views` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_models.DnsPrivateView"]: + """List DnsPrivateView resources by Location. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of either DnsPrivateView or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.DnsPrivateView] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DnsPrivateViewListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DnsPrivateViewListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, location: str, dnsprivateviewocid: str, **kwargs: Any) -> _models.DnsPrivateView: + """Get a DnsPrivateView. + + :param location: The name of the Azure region. Required. + :type location: str + :param dnsprivateviewocid: DnsPrivateView OCID. Required. + :type dnsprivateviewocid: str + :return: DnsPrivateView or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.DnsPrivateView + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DnsPrivateView] = kwargs.pop("cls", None) + + _request = build_get_request( + location=location, + dnsprivateviewocid=dnsprivateviewocid, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DnsPrivateView", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_dns_private_zones_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_dns_private_zones_operations.py new file mode 100644 index 000000000000..68ed09996dab --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_dns_private_zones_operations.py @@ -0,0 +1,196 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._dns_private_zones_operations import build_get_request, build_list_by_location_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DnsPrivateZonesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`dns_private_zones` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_models.DnsPrivateZone"]: + """List DnsPrivateZone resources by Location. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of either DnsPrivateZone or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.DnsPrivateZone] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DnsPrivateZoneListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DnsPrivateZoneListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, location: str, dnsprivatezonename: str, **kwargs: Any) -> _models.DnsPrivateZone: + """Get a DnsPrivateZone. + + :param location: The name of the Azure region. Required. + :type location: str + :param dnsprivatezonename: DnsPrivateZone name. Required. + :type dnsprivatezonename: str + :return: DnsPrivateZone or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.DnsPrivateZone + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DnsPrivateZone] = kwargs.pop("cls", None) + + _request = build_get_request( + location=location, + dnsprivatezonename=dnsprivatezonename, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DnsPrivateZone", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_gi_versions_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_gi_versions_operations.py new file mode 100644 index 000000000000..02def620d5f9 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_gi_versions_operations.py @@ -0,0 +1,195 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._gi_versions_operations import build_get_request, build_list_by_location_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class GiVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`gi_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_models.GiVersion"]: + """List GiVersion resources by Location. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of either GiVersion or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.GiVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GiVersionListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("GiVersionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, location: str, giversionname: str, **kwargs: Any) -> _models.GiVersion: + """Get a GiVersion. + + :param location: The name of the Azure region. Required. + :type location: str + :param giversionname: GiVersion name. Required. + :type giversionname: str + :return: GiVersion or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.GiVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GiVersion] = kwargs.pop("cls", None) + + _request = build_get_request( + location=location, + giversionname=giversionname, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("GiVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_operations.py new file mode 100644 index 000000000000..7be3a96a0294 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_operations.py @@ -0,0 +1,134 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """List the operations for the provider. + + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_oracle_subscriptions_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_oracle_subscriptions_operations.py new file mode 100644 index 000000000000..2515213381eb --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_oracle_subscriptions_operations.py @@ -0,0 +1,907 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._oracle_subscriptions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_activation_links_request, + build_list_by_subscription_request, + build_list_cloud_account_details_request, + build_list_saas_subscription_details_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class OracleSubscriptionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`oracle_subscriptions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.OracleSubscription"]: + """List OracleSubscription resources by subscription ID. + + :return: An iterator like instance of either OracleSubscription or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OracleSubscriptionListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OracleSubscriptionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, **kwargs: Any) -> _models.OracleSubscription: + """Get a OracleSubscription. + + :return: OracleSubscription or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.OracleSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OracleSubscription] = kwargs.pop("cls", None) + + _request = build_get_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OracleSubscription", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, resource: Union[_models.OracleSubscription, IO[bytes]], **kwargs: Any + ) -> _models.OracleSubscription: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OracleSubscription] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "OracleSubscription") + + _request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OracleSubscription", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("OracleSubscription", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, resource: _models.OracleSubscription, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.OracleSubscription]: + """Create a OracleSubscription. + + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.oracledatabase.models.OracleSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either OracleSubscription or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.OracleSubscription]: + """Create a OracleSubscription. + + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either OracleSubscription or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource: Union[_models.OracleSubscription, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.OracleSubscription]: + """Create a OracleSubscription. + + :param resource: Resource create parameters. Is either a OracleSubscription type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.oracledatabase.models.OracleSubscription or IO[bytes] + :return: An instance of AsyncLROPoller that returns either OracleSubscription or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OracleSubscription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OracleSubscription", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OracleSubscription].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OracleSubscription]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, properties: Union[_models.OracleSubscriptionUpdate, IO[bytes]], **kwargs: Any + ) -> Optional[_models.OracleSubscription]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.OracleSubscription]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "OracleSubscriptionUpdate") + + _request = build_update_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OracleSubscription", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, properties: _models.OracleSubscriptionUpdate, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.OracleSubscription]: + """Update a OracleSubscription. + + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.oracledatabase.models.OracleSubscriptionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either OracleSubscription or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.OracleSubscription]: + """Update a OracleSubscription. + + :param properties: The resource properties to be updated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either OracleSubscription or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, properties: Union[_models.OracleSubscriptionUpdate, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.OracleSubscription]: + """Update a OracleSubscription. + + :param properties: The resource properties to be updated. Is either a OracleSubscriptionUpdate + type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.oracledatabase.models.OracleSubscriptionUpdate or IO[bytes] + :return: An instance of AsyncLROPoller that returns either OracleSubscription or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OracleSubscription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OracleSubscription", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OracleSubscription].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OracleSubscription]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace_async + async def begin_delete(self, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete a OracleSubscription. + + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + api_version=api_version, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _list_activation_links_initial(self, **kwargs: Any) -> Optional[_models.ActivationLinks]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.ActivationLinks]] = kwargs.pop("cls", None) + + _request = build_list_activation_links_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ActivationLinks", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_list_activation_links(self, **kwargs: Any) -> AsyncLROPoller[_models.ActivationLinks]: + """List Activation Links. + + :return: An instance of AsyncLROPoller that returns either ActivationLinks or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.ActivationLinks] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ActivationLinks] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._list_activation_links_initial( + api_version=api_version, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ActivationLinks", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ActivationLinks].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ActivationLinks]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _list_cloud_account_details_initial(self, **kwargs: Any) -> Optional[_models.CloudAccountDetails]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.CloudAccountDetails]] = kwargs.pop("cls", None) + + _request = build_list_cloud_account_details_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CloudAccountDetails", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_list_cloud_account_details(self, **kwargs: Any) -> AsyncLROPoller[_models.CloudAccountDetails]: + """List Cloud Account Details. + + :return: An instance of AsyncLROPoller that returns either CloudAccountDetails or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.CloudAccountDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CloudAccountDetails] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._list_cloud_account_details_initial( + api_version=api_version, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CloudAccountDetails", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CloudAccountDetails].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CloudAccountDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _list_saas_subscription_details_initial(self, **kwargs: Any) -> Optional[_models.SaasSubscriptionDetails]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.SaasSubscriptionDetails]] = kwargs.pop("cls", None) + + _request = build_list_saas_subscription_details_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("SaasSubscriptionDetails", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_list_saas_subscription_details( + self, **kwargs: Any + ) -> AsyncLROPoller[_models.SaasSubscriptionDetails]: + """List Saas Subscription Details. + + :return: An instance of AsyncLROPoller that returns either SaasSubscriptionDetails or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.SaasSubscriptionDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SaasSubscriptionDetails] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._list_saas_subscription_details_initial( + api_version=api_version, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SaasSubscriptionDetails", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.SaasSubscriptionDetails].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.SaasSubscriptionDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_patch.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_virtual_network_addresses_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_virtual_network_addresses_operations.py new file mode 100644 index 000000000000..f875b6064f92 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/aio/operations/_virtual_network_addresses_operations.py @@ -0,0 +1,538 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._virtual_network_addresses_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_cloud_vm_cluster_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class VirtualNetworkAddressesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.aio.OracleDatabaseMgmtClient`'s + :attr:`virtual_network_addresses` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_cloud_vm_cluster( + self, resource_group_name: str, cloudvmclustername: str, **kwargs: Any + ) -> AsyncIterable["_models.VirtualNetworkAddress"]: + """List VirtualNetworkAddress resources by CloudVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :return: An iterator like instance of either VirtualNetworkAddress or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.oracledatabase.models.VirtualNetworkAddress] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualNetworkAddressListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_cloud_vm_cluster_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualNetworkAddressListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, cloudvmclustername: str, virtualnetworkaddressname: str, **kwargs: Any + ) -> _models.VirtualNetworkAddress: + """Get a VirtualNetworkAddress. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param virtualnetworkaddressname: Virtual IP address hostname. Required. + :type virtualnetworkaddressname: str + :return: VirtualNetworkAddress or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.VirtualNetworkAddress + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualNetworkAddress] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + virtualnetworkaddressname=virtualnetworkaddressname, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualNetworkAddress", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + virtualnetworkaddressname: str, + resource: Union[_models.VirtualNetworkAddress, IO[bytes]], + **kwargs: Any + ) -> _models.VirtualNetworkAddress: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkAddress] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "VirtualNetworkAddress") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + virtualnetworkaddressname=virtualnetworkaddressname, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("VirtualNetworkAddress", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("VirtualNetworkAddress", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cloudvmclustername: str, + virtualnetworkaddressname: str, + resource: _models.VirtualNetworkAddress, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkAddress]: + """Create a VirtualNetworkAddress. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param virtualnetworkaddressname: Virtual IP address hostname. Required. + :type virtualnetworkaddressname: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.oracledatabase.models.VirtualNetworkAddress + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either VirtualNetworkAddress or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.VirtualNetworkAddress] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cloudvmclustername: str, + virtualnetworkaddressname: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkAddress]: + """Create a VirtualNetworkAddress. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param virtualnetworkaddressname: Virtual IP address hostname. Required. + :type virtualnetworkaddressname: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either VirtualNetworkAddress or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.VirtualNetworkAddress] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + cloudvmclustername: str, + virtualnetworkaddressname: str, + resource: Union[_models.VirtualNetworkAddress, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualNetworkAddress]: + """Create a VirtualNetworkAddress. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param virtualnetworkaddressname: Virtual IP address hostname. Required. + :type virtualnetworkaddressname: str + :param resource: Resource create parameters. Is either a VirtualNetworkAddress type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.oracledatabase.models.VirtualNetworkAddress or IO[bytes] + :return: An instance of AsyncLROPoller that returns either VirtualNetworkAddress or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.oracledatabase.models.VirtualNetworkAddress] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkAddress] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + virtualnetworkaddressname=virtualnetworkaddressname, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualNetworkAddress", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.VirtualNetworkAddress].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.VirtualNetworkAddress]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cloudvmclustername: str, virtualnetworkaddressname: str, **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + virtualnetworkaddressname=virtualnetworkaddressname, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, cloudvmclustername: str, virtualnetworkaddressname: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a VirtualNetworkAddress. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param virtualnetworkaddressname: Virtual IP address hostname. Required. + :type virtualnetworkaddressname: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + virtualnetworkaddressname=virtualnetworkaddressname, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/models/__init__.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/models/__init__.py new file mode 100644 index 000000000000..4dda9302c26f --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/models/__init__.py @@ -0,0 +1,329 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._models_py3 import ActivationLinks +from ._models_py3 import AddRemoveDbNode +from ._models_py3 import AllConnectionStringType +from ._models_py3 import ApexDetailsType +from ._models_py3 import AutonomousDatabase +from ._models_py3 import AutonomousDatabaseBackup +from ._models_py3 import AutonomousDatabaseBackupListResult +from ._models_py3 import AutonomousDatabaseBackupProperties +from ._models_py3 import AutonomousDatabaseBackupUpdate +from ._models_py3 import AutonomousDatabaseBackupUpdateProperties +from ._models_py3 import AutonomousDatabaseBaseProperties +from ._models_py3 import AutonomousDatabaseCharacterSet +from ._models_py3 import AutonomousDatabaseCharacterSetListResult +from ._models_py3 import AutonomousDatabaseCharacterSetProperties +from ._models_py3 import AutonomousDatabaseCloneProperties +from ._models_py3 import AutonomousDatabaseListResult +from ._models_py3 import AutonomousDatabaseNationalCharacterSet +from ._models_py3 import AutonomousDatabaseNationalCharacterSetListResult +from ._models_py3 import AutonomousDatabaseNationalCharacterSetProperties +from ._models_py3 import AutonomousDatabaseProperties +from ._models_py3 import AutonomousDatabaseStandbySummary +from ._models_py3 import AutonomousDatabaseUpdate +from ._models_py3 import AutonomousDatabaseUpdateProperties +from ._models_py3 import AutonomousDatabaseWalletFile +from ._models_py3 import AutonomousDbVersion +from ._models_py3 import AutonomousDbVersionListResult +from ._models_py3 import AutonomousDbVersionProperties +from ._models_py3 import CloudAccountDetails +from ._models_py3 import CloudExadataInfrastructure +from ._models_py3 import CloudExadataInfrastructureListResult +from ._models_py3 import CloudExadataInfrastructureProperties +from ._models_py3 import CloudExadataInfrastructureUpdate +from ._models_py3 import CloudExadataInfrastructureUpdateProperties +from ._models_py3 import CloudVmCluster +from ._models_py3 import CloudVmClusterListResult +from ._models_py3 import CloudVmClusterProperties +from ._models_py3 import CloudVmClusterUpdate +from ._models_py3 import CloudVmClusterUpdateProperties +from ._models_py3 import ConnectionStringType +from ._models_py3 import ConnectionUrlType +from ._models_py3 import CustomerContact +from ._models_py3 import DataCollectionOptions +from ._models_py3 import DayOfWeek +from ._models_py3 import DayOfWeekUpdate +from ._models_py3 import DbIormConfig +from ._models_py3 import DbNode +from ._models_py3 import DbNodeAction +from ._models_py3 import DbNodeListResult +from ._models_py3 import DbNodeProperties +from ._models_py3 import DbServer +from ._models_py3 import DbServerListResult +from ._models_py3 import DbServerPatchingDetails +from ._models_py3 import DbServerProperties +from ._models_py3 import DbSystemShape +from ._models_py3 import DbSystemShapeListResult +from ._models_py3 import DbSystemShapeProperties +from ._models_py3 import DnsPrivateView +from ._models_py3 import DnsPrivateViewListResult +from ._models_py3 import DnsPrivateViewProperties +from ._models_py3 import DnsPrivateZone +from ._models_py3 import DnsPrivateZoneListResult +from ._models_py3 import DnsPrivateZoneProperties +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import EstimatedPatchingTime +from ._models_py3 import ExadataIormConfig +from ._models_py3 import GenerateAutonomousDatabaseWalletDetails +from ._models_py3 import GiVersion +from ._models_py3 import GiVersionListResult +from ._models_py3 import GiVersionProperties +from ._models_py3 import MaintenanceWindow +from ._models_py3 import Month +from ._models_py3 import NSGCidr +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import OracleSubscription +from ._models_py3 import OracleSubscriptionListResult +from ._models_py3 import OracleSubscriptionProperties +from ._models_py3 import OracleSubscriptionUpdate +from ._models_py3 import OracleSubscriptionUpdateProperties +from ._models_py3 import PeerDbDetails +from ._models_py3 import Plan +from ._models_py3 import PortRange +from ._models_py3 import PrivateIpAddressProperties +from ._models_py3 import PrivateIpAddressesFilter +from ._models_py3 import ProfileType +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import ResourcePlanTypeUpdate +from ._models_py3 import SaasSubscriptionDetails +from ._models_py3 import ScheduledOperationsType +from ._models_py3 import ScheduledOperationsTypeUpdate +from ._models_py3 import SystemData +from ._models_py3 import TrackedResource +from ._models_py3 import ValidationError +from ._models_py3 import ValidationResult +from ._models_py3 import VirtualNetworkAddress +from ._models_py3 import VirtualNetworkAddressListResult +from ._models_py3 import VirtualNetworkAddressProperties + +from ._oracle_database_mgmt_client_enums import ActionType +from ._oracle_database_mgmt_client_enums import AutonomousDatabaseBackupLifecycleState +from ._oracle_database_mgmt_client_enums import AutonomousDatabaseBackupType +from ._oracle_database_mgmt_client_enums import AutonomousDatabaseLifecycleState +from ._oracle_database_mgmt_client_enums import AutonomousMaintenanceScheduleType +from ._oracle_database_mgmt_client_enums import AzureResourceProvisioningState +from ._oracle_database_mgmt_client_enums import CloneType +from ._oracle_database_mgmt_client_enums import CloudAccountProvisioningState +from ._oracle_database_mgmt_client_enums import CloudExadataInfrastructureLifecycleState +from ._oracle_database_mgmt_client_enums import CloudVmClusterLifecycleState +from ._oracle_database_mgmt_client_enums import ComputeModel +from ._oracle_database_mgmt_client_enums import ConsumerGroup +from ._oracle_database_mgmt_client_enums import CreatedByType +from ._oracle_database_mgmt_client_enums import DataBaseType +from ._oracle_database_mgmt_client_enums import DataSafeStatusType +from ._oracle_database_mgmt_client_enums import DatabaseEditionType +from ._oracle_database_mgmt_client_enums import DayOfWeekName +from ._oracle_database_mgmt_client_enums import DbNodeActionEnum +from ._oracle_database_mgmt_client_enums import DbNodeMaintenanceType +from ._oracle_database_mgmt_client_enums import DbNodeProvisioningState +from ._oracle_database_mgmt_client_enums import DbServerPatchingStatus +from ._oracle_database_mgmt_client_enums import DbServerProvisioningState +from ._oracle_database_mgmt_client_enums import DisasterRecoveryType +from ._oracle_database_mgmt_client_enums import DiskRedundancy +from ._oracle_database_mgmt_client_enums import DnsPrivateViewsLifecycleState +from ._oracle_database_mgmt_client_enums import DnsPrivateZonesLifecycleState +from ._oracle_database_mgmt_client_enums import GenerateType +from ._oracle_database_mgmt_client_enums import HostFormatType +from ._oracle_database_mgmt_client_enums import Intent +from ._oracle_database_mgmt_client_enums import IormLifecycleState +from ._oracle_database_mgmt_client_enums import LicenseModel +from ._oracle_database_mgmt_client_enums import MonthName +from ._oracle_database_mgmt_client_enums import Objective +from ._oracle_database_mgmt_client_enums import OpenModeType +from ._oracle_database_mgmt_client_enums import OperationsInsightsStatusType +from ._oracle_database_mgmt_client_enums import OracleSubscriptionProvisioningState +from ._oracle_database_mgmt_client_enums import Origin +from ._oracle_database_mgmt_client_enums import PatchingMode +from ._oracle_database_mgmt_client_enums import PermissionLevelType +from ._oracle_database_mgmt_client_enums import Preference +from ._oracle_database_mgmt_client_enums import ProtocolType +from ._oracle_database_mgmt_client_enums import RefreshableModelType +from ._oracle_database_mgmt_client_enums import RefreshableStatusType +from ._oracle_database_mgmt_client_enums import ResourceProvisioningState +from ._oracle_database_mgmt_client_enums import RoleType +from ._oracle_database_mgmt_client_enums import SessionModeType +from ._oracle_database_mgmt_client_enums import SourceType +from ._oracle_database_mgmt_client_enums import SyntaxFormatType +from ._oracle_database_mgmt_client_enums import TlsAuthenticationType +from ._oracle_database_mgmt_client_enums import UpdateAction +from ._oracle_database_mgmt_client_enums import ValidationStatus +from ._oracle_database_mgmt_client_enums import Versions +from ._oracle_database_mgmt_client_enums import VirtualNetworkAddressLifecycleState +from ._oracle_database_mgmt_client_enums import WorkloadType +from ._oracle_database_mgmt_client_enums import ZoneType +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ActivationLinks", + "AddRemoveDbNode", + "AllConnectionStringType", + "ApexDetailsType", + "AutonomousDatabase", + "AutonomousDatabaseBackup", + "AutonomousDatabaseBackupListResult", + "AutonomousDatabaseBackupProperties", + "AutonomousDatabaseBackupUpdate", + "AutonomousDatabaseBackupUpdateProperties", + "AutonomousDatabaseBaseProperties", + "AutonomousDatabaseCharacterSet", + "AutonomousDatabaseCharacterSetListResult", + "AutonomousDatabaseCharacterSetProperties", + "AutonomousDatabaseCloneProperties", + "AutonomousDatabaseListResult", + "AutonomousDatabaseNationalCharacterSet", + "AutonomousDatabaseNationalCharacterSetListResult", + "AutonomousDatabaseNationalCharacterSetProperties", + "AutonomousDatabaseProperties", + "AutonomousDatabaseStandbySummary", + "AutonomousDatabaseUpdate", + "AutonomousDatabaseUpdateProperties", + "AutonomousDatabaseWalletFile", + "AutonomousDbVersion", + "AutonomousDbVersionListResult", + "AutonomousDbVersionProperties", + "CloudAccountDetails", + "CloudExadataInfrastructure", + "CloudExadataInfrastructureListResult", + "CloudExadataInfrastructureProperties", + "CloudExadataInfrastructureUpdate", + "CloudExadataInfrastructureUpdateProperties", + "CloudVmCluster", + "CloudVmClusterListResult", + "CloudVmClusterProperties", + "CloudVmClusterUpdate", + "CloudVmClusterUpdateProperties", + "ConnectionStringType", + "ConnectionUrlType", + "CustomerContact", + "DataCollectionOptions", + "DayOfWeek", + "DayOfWeekUpdate", + "DbIormConfig", + "DbNode", + "DbNodeAction", + "DbNodeListResult", + "DbNodeProperties", + "DbServer", + "DbServerListResult", + "DbServerPatchingDetails", + "DbServerProperties", + "DbSystemShape", + "DbSystemShapeListResult", + "DbSystemShapeProperties", + "DnsPrivateView", + "DnsPrivateViewListResult", + "DnsPrivateViewProperties", + "DnsPrivateZone", + "DnsPrivateZoneListResult", + "DnsPrivateZoneProperties", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", + "EstimatedPatchingTime", + "ExadataIormConfig", + "GenerateAutonomousDatabaseWalletDetails", + "GiVersion", + "GiVersionListResult", + "GiVersionProperties", + "MaintenanceWindow", + "Month", + "NSGCidr", + "Operation", + "OperationDisplay", + "OperationListResult", + "OracleSubscription", + "OracleSubscriptionListResult", + "OracleSubscriptionProperties", + "OracleSubscriptionUpdate", + "OracleSubscriptionUpdateProperties", + "PeerDbDetails", + "Plan", + "PortRange", + "PrivateIpAddressProperties", + "PrivateIpAddressesFilter", + "ProfileType", + "ProxyResource", + "Resource", + "ResourcePlanTypeUpdate", + "SaasSubscriptionDetails", + "ScheduledOperationsType", + "ScheduledOperationsTypeUpdate", + "SystemData", + "TrackedResource", + "ValidationError", + "ValidationResult", + "VirtualNetworkAddress", + "VirtualNetworkAddressListResult", + "VirtualNetworkAddressProperties", + "ActionType", + "AutonomousDatabaseBackupLifecycleState", + "AutonomousDatabaseBackupType", + "AutonomousDatabaseLifecycleState", + "AutonomousMaintenanceScheduleType", + "AzureResourceProvisioningState", + "CloneType", + "CloudAccountProvisioningState", + "CloudExadataInfrastructureLifecycleState", + "CloudVmClusterLifecycleState", + "ComputeModel", + "ConsumerGroup", + "CreatedByType", + "DataBaseType", + "DataSafeStatusType", + "DatabaseEditionType", + "DayOfWeekName", + "DbNodeActionEnum", + "DbNodeMaintenanceType", + "DbNodeProvisioningState", + "DbServerPatchingStatus", + "DbServerProvisioningState", + "DisasterRecoveryType", + "DiskRedundancy", + "DnsPrivateViewsLifecycleState", + "DnsPrivateZonesLifecycleState", + "GenerateType", + "HostFormatType", + "Intent", + "IormLifecycleState", + "LicenseModel", + "MonthName", + "Objective", + "OpenModeType", + "OperationsInsightsStatusType", + "OracleSubscriptionProvisioningState", + "Origin", + "PatchingMode", + "PermissionLevelType", + "Preference", + "ProtocolType", + "RefreshableModelType", + "RefreshableStatusType", + "ResourceProvisioningState", + "RoleType", + "SessionModeType", + "SourceType", + "SyntaxFormatType", + "TlsAuthenticationType", + "UpdateAction", + "ValidationStatus", + "Versions", + "VirtualNetworkAddressLifecycleState", + "WorkloadType", + "ZoneType", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/models/_models_py3.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/models/_models_py3.py new file mode 100644 index 000000000000..30787a5b3748 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/models/_models_py3.py @@ -0,0 +1,7046 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from .. import _serialization + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + + +class ActivationLinks(_serialization.Model): + """Activation Links model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar new_cloud_account_activation_link: New Cloud Account Activation Link. + :vartype new_cloud_account_activation_link: str + :ivar existing_cloud_account_activation_link: Existing Cloud Account Activation Link. + :vartype existing_cloud_account_activation_link: str + """ + + _validation = { + "new_cloud_account_activation_link": {"readonly": True}, + "existing_cloud_account_activation_link": {"readonly": True}, + } + + _attribute_map = { + "new_cloud_account_activation_link": {"key": "newCloudAccountActivationLink", "type": "str"}, + "existing_cloud_account_activation_link": {"key": "existingCloudAccountActivationLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.new_cloud_account_activation_link = None + self.existing_cloud_account_activation_link = None + + +class AddRemoveDbNode(_serialization.Model): + """Add/Remove (Virtual Machine) DbNode model. + + All required parameters must be populated in order to send to server. + + :ivar db_servers: Db servers ocids. Required. + :vartype db_servers: list[str] + """ + + _validation = { + "db_servers": {"required": True}, + } + + _attribute_map = { + "db_servers": {"key": "dbServers", "type": "[str]"}, + } + + def __init__(self, *, db_servers: List[str], **kwargs: Any) -> None: + """ + :keyword db_servers: Db servers ocids. Required. + :paramtype db_servers: list[str] + """ + super().__init__(**kwargs) + self.db_servers = db_servers + + +class AllConnectionStringType(_serialization.Model): + """The connection string profile to allow clients to group, filter and select connection string + values based on structured metadata. + + :ivar high: The High database service provides the highest level of resources to each SQL + statement resulting in the highest performance, but supports the fewest number of concurrent + SQL statements. + :vartype high: str + :ivar low: The Low database service provides the least level of resources to each SQL + statement, but supports the most number of concurrent SQL statements. + :vartype low: str + :ivar medium: The Medium database service provides a lower level of resources to each SQL + statement potentially resulting a lower level of performance, but supports more concurrent SQL + statements. + :vartype medium: str + """ + + _validation = { + "high": {"max_length": 255, "min_length": 10}, + "low": {"max_length": 255, "min_length": 10}, + "medium": {"max_length": 255, "min_length": 10}, + } + + _attribute_map = { + "high": {"key": "high", "type": "str"}, + "low": {"key": "low", "type": "str"}, + "medium": {"key": "medium", "type": "str"}, + } + + def __init__( + self, *, high: Optional[str] = None, low: Optional[str] = None, medium: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword high: The High database service provides the highest level of resources to each SQL + statement resulting in the highest performance, but supports the fewest number of concurrent + SQL statements. + :paramtype high: str + :keyword low: The Low database service provides the least level of resources to each SQL + statement, but supports the most number of concurrent SQL statements. + :paramtype low: str + :keyword medium: The Medium database service provides a lower level of resources to each SQL + statement potentially resulting a lower level of performance, but supports more concurrent SQL + statements. + :paramtype medium: str + """ + super().__init__(**kwargs) + self.high = high + self.low = low + self.medium = medium + + +class ApexDetailsType(_serialization.Model): + """Information about Oracle APEX Application Development. + + :ivar apex_version: The Oracle APEX Application Development version. + :vartype apex_version: str + :ivar ords_version: The Oracle REST Data Services (ORDS) version. + :vartype ords_version: str + """ + + _attribute_map = { + "apex_version": {"key": "apexVersion", "type": "str"}, + "ords_version": {"key": "ordsVersion", "type": "str"}, + } + + def __init__( + self, *, apex_version: Optional[str] = None, ords_version: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword apex_version: The Oracle APEX Application Development version. + :paramtype apex_version: str + :keyword ords_version: The Oracle REST Data Services (ORDS) version. + :paramtype ords_version: str + """ + super().__init__(**kwargs) + self.apex_version = apex_version + self.ords_version = ords_version + + +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.oracledatabase.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.oracledatabase.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class AutonomousDatabase(TrackedResource): + """Autonomous Database resource model. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.oracledatabase.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBaseProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "AutonomousDatabaseBaseProperties"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.AutonomousDatabaseBaseProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBaseProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.oracledatabase.models.SystemData + """ + + +class AutonomousDatabaseBackup(ProxyResource): + """AutonomousDatabaseBackup resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.oracledatabase.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackupProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "AutonomousDatabaseBackupProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.AutonomousDatabaseBackupProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackupProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class AutonomousDatabaseBackupListResult(_serialization.Model): + """The response of a AutonomousDatabaseBackup list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: The AutonomousDatabaseBackup items on this page. Required. + :vartype value: list[~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AutonomousDatabaseBackup]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.AutonomousDatabaseBackup"], **kwargs: Any) -> None: + """ + :keyword value: The AutonomousDatabaseBackup items on this page. Required. + :paramtype value: list[~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class AutonomousDatabaseBackupProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """AutonomousDatabaseBackup resource model. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar autonomous_database_id: The OCID of the Autonomous Database. Required. + :vartype autonomous_database_id: str + :ivar database_size_in_t_bs: The size of the database in terabytes at the time the backup was + taken. + :vartype database_size_in_t_bs: int + :ivar db_version: A valid Oracle Database version for Autonomous Database. + :vartype db_version: str + :ivar display_name: The user-friendly name for the backup. The name does not have to be unique. + :vartype display_name: str + :ivar ocid: The OCID of the Autonomous Database backup. + :vartype ocid: str + :ivar is_automatic: Indicates whether the backup is user-initiated or automatic. + :vartype is_automatic: bool + :ivar is_restorable: Indicates whether the backup can be used to restore the associated + Autonomous Database. + :vartype is_restorable: bool + :ivar lifecycle_details: Additional information about the current lifecycle state. + :vartype lifecycle_details: str + :ivar lifecycle_state: The current state of the backup. Known values are: "Creating", "Active", + "Deleting", "Failed", and "Updating". + :vartype lifecycle_state: str or + ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackupLifecycleState + :ivar retention_period_in_days: Retention period, in days, for long-term backups. + :vartype retention_period_in_days: int + :ivar size_in_t_bs: The backup size in terabytes (TB). + :vartype size_in_t_bs: int + :ivar time_available_til: Timestamp until when the backup will be available. + :vartype time_available_til: ~datetime.datetime + :ivar time_ended: The date and time the backup completed. + :vartype time_ended: str + :ivar type: The type of backup. Known values are: "Incremental", "Full", and "LongTerm". + :vartype type: str or ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackupType + :ivar provisioning_state: Azure resource provisioning state. Known values are: "Succeeded", + "Failed", "Canceled", and "Provisioning". + :vartype provisioning_state: str or + ~azure.mgmt.oracledatabase.models.AzureResourceProvisioningState + """ + + _validation = { + "autonomous_database_id": {"required": True, "readonly": True}, + "database_size_in_t_bs": {"readonly": True}, + "db_version": {"readonly": True}, + "ocid": {"readonly": True, "max_length": 255, "min_length": 1}, + "is_automatic": {"readonly": True}, + "is_restorable": {"readonly": True}, + "lifecycle_details": {"readonly": True}, + "lifecycle_state": {"readonly": True}, + "retention_period_in_days": {"maximum": 3650, "minimum": 90}, + "size_in_t_bs": {"readonly": True}, + "time_available_til": {"readonly": True}, + "time_ended": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "autonomous_database_id": {"key": "autonomousDatabaseId", "type": "str"}, + "database_size_in_t_bs": {"key": "databaseSizeInTBs", "type": "int"}, + "db_version": {"key": "dbVersion", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "ocid": {"key": "ocid", "type": "str"}, + "is_automatic": {"key": "isAutomatic", "type": "bool"}, + "is_restorable": {"key": "isRestorable", "type": "bool"}, + "lifecycle_details": {"key": "lifecycleDetails", "type": "str"}, + "lifecycle_state": {"key": "lifecycleState", "type": "str"}, + "retention_period_in_days": {"key": "retentionPeriodInDays", "type": "int"}, + "size_in_t_bs": {"key": "sizeInTBs", "type": "int"}, + "time_available_til": {"key": "timeAvailableTil", "type": "iso-8601"}, + "time_ended": {"key": "timeEnded", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, *, display_name: Optional[str] = None, retention_period_in_days: Optional[int] = None, **kwargs: Any + ) -> None: + """ + :keyword display_name: The user-friendly name for the backup. The name does not have to be + unique. + :paramtype display_name: str + :keyword retention_period_in_days: Retention period, in days, for long-term backups. + :paramtype retention_period_in_days: int + """ + super().__init__(**kwargs) + self.autonomous_database_id = None + self.database_size_in_t_bs = None + self.db_version = None + self.display_name = display_name + self.ocid = None + self.is_automatic = None + self.is_restorable = None + self.lifecycle_details = None + self.lifecycle_state = None + self.retention_period_in_days = retention_period_in_days + self.size_in_t_bs = None + self.time_available_til = None + self.time_ended = None + self.type = None + self.provisioning_state = None + + +class AutonomousDatabaseBackupUpdate(_serialization.Model): + """The type used for update operations of the AutonomousDatabaseBackup. + + :ivar properties: The updatable properties of the AutonomousDatabaseBackup. + :vartype properties: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackupUpdateProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "AutonomousDatabaseBackupUpdateProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.AutonomousDatabaseBackupUpdateProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The updatable properties of the AutonomousDatabaseBackup. + :paramtype properties: + ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackupUpdateProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class AutonomousDatabaseBackupUpdateProperties(_serialization.Model): + """The updatable properties of the AutonomousDatabaseBackup. + + :ivar retention_period_in_days: Retention period, in days, for long-term backups. + :vartype retention_period_in_days: int + """ + + _validation = { + "retention_period_in_days": {"maximum": 3650, "minimum": 90}, + } + + _attribute_map = { + "retention_period_in_days": {"key": "retentionPeriodInDays", "type": "int"}, + } + + def __init__(self, *, retention_period_in_days: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword retention_period_in_days: Retention period, in days, for long-term backups. + :paramtype retention_period_in_days: int + """ + super().__init__(**kwargs) + self.retention_period_in_days = retention_period_in_days + + +class AutonomousDatabaseBaseProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Autonomous Database base resource model. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AutonomousDatabaseCloneProperties, AutonomousDatabaseProperties + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar admin_password: Admin password. + :vartype admin_password: str + :ivar data_base_type: Database type to be created. Required. Known values are: "Regular" and + "Clone". + :vartype data_base_type: str or ~azure.mgmt.oracledatabase.models.DataBaseType + :ivar autonomous_maintenance_schedule_type: The maintenance schedule type of the Autonomous + Database Serverless. Known values are: "Early" and "Regular". + :vartype autonomous_maintenance_schedule_type: str or + ~azure.mgmt.oracledatabase.models.AutonomousMaintenanceScheduleType + :ivar character_set: The character set for the autonomous database. + :vartype character_set: str + :ivar compute_count: The compute amount (CPUs) available to the database. + :vartype compute_count: float + :ivar compute_model: The compute model of the Autonomous Database. Known values are: "ECPU" and + "OCPU". + :vartype compute_model: str or ~azure.mgmt.oracledatabase.models.ComputeModel + :ivar cpu_core_count: The number of CPU cores to be made available to the database. + :vartype cpu_core_count: int + :ivar customer_contacts: Customer Contacts. + :vartype customer_contacts: list[~azure.mgmt.oracledatabase.models.CustomerContact] + :ivar data_storage_size_in_tbs: The quantity of data in the database, in terabytes. + :vartype data_storage_size_in_tbs: int + :ivar data_storage_size_in_gbs: The size, in gigabytes, of the data volume that will be created + and attached to the database. + :vartype data_storage_size_in_gbs: int + :ivar db_version: A valid Oracle Database version for Autonomous Database. + :vartype db_version: str + :ivar db_workload: The Autonomous Database workload type. Known values are: "OLTP", "DW", + "AJD", and "APEX". + :vartype db_workload: str or ~azure.mgmt.oracledatabase.models.WorkloadType + :ivar display_name: The user-friendly name for the Autonomous Database. + :vartype display_name: str + :ivar is_auto_scaling_enabled: Indicates if auto scaling is enabled for the Autonomous Database + CPU core count. + :vartype is_auto_scaling_enabled: bool + :ivar is_auto_scaling_for_storage_enabled: Indicates if auto scaling is enabled for the + Autonomous Database storage. + :vartype is_auto_scaling_for_storage_enabled: bool + :ivar peer_db_ids: The list of `OCIDs + `_ 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. + :vartype peer_db_ids: list[str] + :ivar peer_db_id: The database OCID of the Disaster Recovery peer database, which is located in + a different region from the current peer database. + :vartype peer_db_id: str + :ivar is_local_data_guard_enabled: Indicates whether the Autonomous Database has local or + called in-region Data Guard enabled. + :vartype is_local_data_guard_enabled: bool + :ivar is_remote_data_guard_enabled: Indicates whether the Autonomous Database has Cross Region + Data Guard enabled. + :vartype is_remote_data_guard_enabled: bool + :ivar local_disaster_recovery_type: Indicates the local disaster recovery (DR) type of the + Autonomous Database Serverless instance.Autonomous Data Guard (ADG) DR type provides business + critical DR with a faster recovery time objective (RTO) during failover or + switchover.Backup-based DR type provides lower cost DR with a slower RTO during failover or + switchover. Known values are: "Adg" and "BackupBased". + :vartype local_disaster_recovery_type: str or + ~azure.mgmt.oracledatabase.models.DisasterRecoveryType + :ivar local_standby_db: Local Autonomous Disaster Recovery standby database details. + :vartype local_standby_db: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseStandbySummary + :ivar failed_data_recovery_in_seconds: Indicates the number of seconds of data loss for a Data + Guard failover. + :vartype failed_data_recovery_in_seconds: int + :ivar is_mtls_connection_required: Specifies if the Autonomous Database requires mTLS + connections. + :vartype is_mtls_connection_required: bool + :ivar is_preview_version_with_service_terms_accepted: Specifies if the Autonomous Database + preview version is being provisioned. + :vartype is_preview_version_with_service_terms_accepted: bool + :ivar license_model: The Oracle license model that applies to the Oracle Autonomous Database. + The default is LICENSE_INCLUDED. Known values are: "LicenseIncluded" and "BringYourOwnLicense". + :vartype license_model: str or ~azure.mgmt.oracledatabase.models.LicenseModel + :ivar ncharacter_set: The character set for the Autonomous Database. + :vartype ncharacter_set: str + :ivar lifecycle_details: Additional information about the current lifecycle state. + :vartype lifecycle_details: str + :ivar provisioning_state: Azure resource provisioning state. Known values are: "Succeeded", + "Failed", "Canceled", and "Provisioning". + :vartype provisioning_state: str or + ~azure.mgmt.oracledatabase.models.AzureResourceProvisioningState + :ivar lifecycle_state: Views lifecycleState. Known values are: "Provisioning", "Available", + "Stopping", "Stopped", "Starting", "Terminating", "Terminated", "Unavailable", + "RestoreInProgress", "RestoreFailed", "BackupInProgress", "ScaleInProgress", + "AvailableNeedsAttention", "Updating", "MaintenanceInProgress", "Restarting", "Recreating", + "RoleChangeInProgress", "Upgrading", "Inaccessible", and "Standby". + :vartype lifecycle_state: str or + ~azure.mgmt.oracledatabase.models.AutonomousDatabaseLifecycleState + :ivar scheduled_operations: The list of scheduled operations. + :vartype scheduled_operations: ~azure.mgmt.oracledatabase.models.ScheduledOperationsType + :ivar private_endpoint_ip: The private endpoint Ip address for the resource. + :vartype private_endpoint_ip: str + :ivar private_endpoint_label: The resource's private endpoint label. + :vartype private_endpoint_label: str + :ivar oci_url: HTTPS link to OCI resources exposed to Azure Customer via Azure Interface. + :vartype oci_url: str + :ivar subnet_id: Client subnet. + :vartype subnet_id: str + :ivar vnet_id: VNET for network connectivity. + :vartype vnet_id: str + :ivar time_created: The date and time that the database was created. + :vartype time_created: ~datetime.datetime + :ivar time_maintenance_begin: The date and time when maintenance will begin. + :vartype time_maintenance_begin: ~datetime.datetime + :ivar time_maintenance_end: The date and time when maintenance will end. + :vartype time_maintenance_end: ~datetime.datetime + :ivar actual_used_data_storage_size_in_tbs: The current amount of storage in use for user and + system data, in terabytes (TB). + :vartype actual_used_data_storage_size_in_tbs: float + :ivar allocated_storage_size_in_tbs: The amount of storage currently allocated for the database + tables and billed for, rounded up. + :vartype allocated_storage_size_in_tbs: float + :ivar apex_details: Information about Oracle APEX Application Development. + :vartype apex_details: ~azure.mgmt.oracledatabase.models.ApexDetailsType + :ivar available_upgrade_versions: List of Oracle Database versions available for a database + upgrade. If there are no version upgrades available, this list is empty. + :vartype available_upgrade_versions: list[str] + :ivar connection_strings: The connection string used to connect to the Autonomous Database. + :vartype connection_strings: ~azure.mgmt.oracledatabase.models.ConnectionStringType + :ivar connection_urls: The URLs for accessing Oracle Application Express (APEX) and SQL + Developer Web with a browser from a Compute instance within your VCN or that has a direct + connection to your VCN. + :vartype connection_urls: ~azure.mgmt.oracledatabase.models.ConnectionUrlType + :ivar data_safe_status: Status of the Data Safe registration for this Autonomous Database. + Known values are: "Registering", "Registered", "Deregistering", "NotRegistered", and "Failed". + :vartype data_safe_status: str or ~azure.mgmt.oracledatabase.models.DataSafeStatusType + :ivar database_edition: The Oracle Database Edition that applies to the Autonomous databases. + Known values are: "StandardEdition" and "EnterpriseEdition". + :vartype database_edition: str or ~azure.mgmt.oracledatabase.models.DatabaseEditionType + :ivar autonomous_database_id: Autonomous Database ID. + :vartype autonomous_database_id: str + :ivar in_memory_area_in_gbs: The area assigned to In-Memory tables in Autonomous Database. + :vartype in_memory_area_in_gbs: int + :ivar is_preview: Indicates if the Autonomous Database version is a preview version. + :vartype is_preview: bool + :ivar 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. + :vartype local_adg_auto_failover_max_data_loss_limit: int + :ivar memory_per_oracle_compute_unit_in_gbs: The amount of memory (in GBs) enabled per ECPU or + OCPU. + :vartype memory_per_oracle_compute_unit_in_gbs: int + :ivar open_mode: Indicates the Autonomous Database mode. Known values are: "ReadOnly" and + "ReadWrite". + :vartype open_mode: str or ~azure.mgmt.oracledatabase.models.OpenModeType + :ivar operations_insights_status: Status of Operations Insights for this Autonomous Database. + Known values are: "Enabling", "Enabled", "Disabling", "NotEnabled", "FailedEnabling", and + "FailedDisabling". + :vartype operations_insights_status: str or + ~azure.mgmt.oracledatabase.models.OperationsInsightsStatusType + :ivar permission_level: The Autonomous Database permission level. Known values are: + "Restricted" and "Unrestricted". + :vartype permission_level: str or ~azure.mgmt.oracledatabase.models.PermissionLevelType + :ivar private_endpoint: The private endpoint for the resource. + :vartype private_endpoint: str + :ivar provisionable_cpus: An array of CPU values that an Autonomous Database can be scaled to. + :vartype provisionable_cpus: list[int] + :ivar role: The Data Guard role of the Autonomous Container Database or Autonomous Database, if + Autonomous Data Guard is enabled. Known values are: "Primary", "Standby", "DisabledStandby", + "BackupCopy", and "SnapshotStandby". + :vartype role: str or ~azure.mgmt.oracledatabase.models.RoleType + :ivar service_console_url: The URL of the Service Console for the Autonomous Database. + :vartype service_console_url: str + :ivar sql_web_developer_url: The SQL Web Developer URL for the Oracle Autonomous Database. + :vartype sql_web_developer_url: str + :ivar 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. + :vartype supported_regions_to_clone_to: list[str] + :ivar time_data_guard_role_changed: The date and time the Autonomous Data Guard role was + switched for the Autonomous Database. + :vartype time_data_guard_role_changed: str + :ivar time_deletion_of_free_autonomous_database: The date and time the Always Free database + will be automatically deleted because of inactivity. + :vartype time_deletion_of_free_autonomous_database: str + :ivar 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. + :vartype time_local_data_guard_enabled: str + :ivar time_of_last_failover: The timestamp of the last failover operation. + :vartype time_of_last_failover: str + :ivar time_of_last_refresh: The date and time when last refresh happened. + :vartype time_of_last_refresh: str + :ivar time_of_last_refresh_point: The refresh point timestamp (UTC). + :vartype time_of_last_refresh_point: str + :ivar time_of_last_switchover: The timestamp of the last switchover operation for the + Autonomous Database. + :vartype time_of_last_switchover: str + :ivar time_reclamation_of_free_autonomous_database: The date and time the Always Free database + will be stopped because of inactivity. + :vartype time_reclamation_of_free_autonomous_database: str + :ivar used_data_storage_size_in_gbs: The storage space consumed by Autonomous Database in GBs. + :vartype used_data_storage_size_in_gbs: int + :ivar used_data_storage_size_in_tbs: The amount of storage that has been used, in terabytes. + :vartype used_data_storage_size_in_tbs: int + :ivar ocid: Database ocid. + :vartype ocid: str + :ivar backup_retention_period_in_days: Retention period, in days, for long-term backups. + :vartype backup_retention_period_in_days: int + :ivar whitelisted_ips: The client IP access control list (ACL). This is an array of CIDR + notations and/or IP addresses. Values should be separate strings, separated by commas. Example: + ['1.1.1.1','1.1.1.0/24','1.1.2.25']. + :vartype whitelisted_ips: list[str] + """ + + _validation = { + "data_base_type": {"required": True}, + "character_set": {"max_length": 255, "min_length": 1}, + "compute_count": {"maximum": 512, "minimum": 0.1}, + "cpu_core_count": {"maximum": 128, "minimum": 1}, + "data_storage_size_in_tbs": {"maximum": 384, "minimum": 1}, + "data_storage_size_in_gbs": {"maximum": 393216, "minimum": 20}, + "db_version": {"max_length": 255, "min_length": 1}, + "display_name": {"max_length": 255, "min_length": 1}, + "peer_db_ids": {"readonly": True}, + "peer_db_id": {"max_length": 255, "min_length": 1}, + "is_remote_data_guard_enabled": {"readonly": True}, + "local_disaster_recovery_type": {"readonly": True}, + "local_standby_db": {"readonly": True}, + "failed_data_recovery_in_seconds": {"readonly": True}, + "ncharacter_set": {"max_length": 255, "min_length": 1}, + "lifecycle_details": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "lifecycle_state": {"readonly": True}, + "oci_url": {"readonly": True}, + "time_created": {"readonly": True}, + "time_maintenance_begin": {"readonly": True}, + "time_maintenance_end": {"readonly": True}, + "actual_used_data_storage_size_in_tbs": {"readonly": True}, + "allocated_storage_size_in_tbs": {"readonly": True}, + "apex_details": {"readonly": True}, + "available_upgrade_versions": {"readonly": True}, + "connection_strings": {"readonly": True}, + "connection_urls": {"readonly": True}, + "data_safe_status": {"readonly": True}, + "in_memory_area_in_gbs": {"readonly": True}, + "is_preview": {"readonly": True}, + "local_adg_auto_failover_max_data_loss_limit": {"maximum": 3600, "minimum": 0}, + "memory_per_oracle_compute_unit_in_gbs": {"readonly": True}, + "operations_insights_status": {"readonly": True}, + "private_endpoint": {"readonly": True}, + "provisionable_cpus": {"readonly": True}, + "service_console_url": {"readonly": True, "max_length": 255, "min_length": 10}, + "sql_web_developer_url": {"readonly": True, "max_length": 2048, "min_length": 10}, + "supported_regions_to_clone_to": {"readonly": True, "max_items": 50, "min_items": 0}, + "time_data_guard_role_changed": {"readonly": True}, + "time_deletion_of_free_autonomous_database": {"readonly": True}, + "time_local_data_guard_enabled": {"readonly": True}, + "time_of_last_failover": {"readonly": True}, + "time_of_last_refresh": {"readonly": True}, + "time_of_last_refresh_point": {"readonly": True}, + "time_of_last_switchover": {"readonly": True}, + "time_reclamation_of_free_autonomous_database": {"readonly": True}, + "used_data_storage_size_in_gbs": {"readonly": True}, + "used_data_storage_size_in_tbs": {"readonly": True}, + "ocid": {"readonly": True, "max_length": 255, "min_length": 1}, + } + + _attribute_map = { + "admin_password": {"key": "adminPassword", "type": "str"}, + "data_base_type": {"key": "dataBaseType", "type": "str"}, + "autonomous_maintenance_schedule_type": {"key": "autonomousMaintenanceScheduleType", "type": "str"}, + "character_set": {"key": "characterSet", "type": "str"}, + "compute_count": {"key": "computeCount", "type": "float"}, + "compute_model": {"key": "computeModel", "type": "str"}, + "cpu_core_count": {"key": "cpuCoreCount", "type": "int"}, + "customer_contacts": {"key": "customerContacts", "type": "[CustomerContact]"}, + "data_storage_size_in_tbs": {"key": "dataStorageSizeInTbs", "type": "int"}, + "data_storage_size_in_gbs": {"key": "dataStorageSizeInGbs", "type": "int"}, + "db_version": {"key": "dbVersion", "type": "str"}, + "db_workload": {"key": "dbWorkload", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "is_auto_scaling_enabled": {"key": "isAutoScalingEnabled", "type": "bool"}, + "is_auto_scaling_for_storage_enabled": {"key": "isAutoScalingForStorageEnabled", "type": "bool"}, + "peer_db_ids": {"key": "peerDbIds", "type": "[str]"}, + "peer_db_id": {"key": "peerDbId", "type": "str"}, + "is_local_data_guard_enabled": {"key": "isLocalDataGuardEnabled", "type": "bool"}, + "is_remote_data_guard_enabled": {"key": "isRemoteDataGuardEnabled", "type": "bool"}, + "local_disaster_recovery_type": {"key": "localDisasterRecoveryType", "type": "str"}, + "local_standby_db": {"key": "localStandbyDb", "type": "AutonomousDatabaseStandbySummary"}, + "failed_data_recovery_in_seconds": {"key": "failedDataRecoveryInSeconds", "type": "int"}, + "is_mtls_connection_required": {"key": "isMtlsConnectionRequired", "type": "bool"}, + "is_preview_version_with_service_terms_accepted": { + "key": "isPreviewVersionWithServiceTermsAccepted", + "type": "bool", + }, + "license_model": {"key": "licenseModel", "type": "str"}, + "ncharacter_set": {"key": "ncharacterSet", "type": "str"}, + "lifecycle_details": {"key": "lifecycleDetails", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "lifecycle_state": {"key": "lifecycleState", "type": "str"}, + "scheduled_operations": {"key": "scheduledOperations", "type": "ScheduledOperationsType"}, + "private_endpoint_ip": {"key": "privateEndpointIp", "type": "str"}, + "private_endpoint_label": {"key": "privateEndpointLabel", "type": "str"}, + "oci_url": {"key": "ociUrl", "type": "str"}, + "subnet_id": {"key": "subnetId", "type": "str"}, + "vnet_id": {"key": "vnetId", "type": "str"}, + "time_created": {"key": "timeCreated", "type": "iso-8601"}, + "time_maintenance_begin": {"key": "timeMaintenanceBegin", "type": "iso-8601"}, + "time_maintenance_end": {"key": "timeMaintenanceEnd", "type": "iso-8601"}, + "actual_used_data_storage_size_in_tbs": {"key": "actualUsedDataStorageSizeInTbs", "type": "float"}, + "allocated_storage_size_in_tbs": {"key": "allocatedStorageSizeInTbs", "type": "float"}, + "apex_details": {"key": "apexDetails", "type": "ApexDetailsType"}, + "available_upgrade_versions": {"key": "availableUpgradeVersions", "type": "[str]"}, + "connection_strings": {"key": "connectionStrings", "type": "ConnectionStringType"}, + "connection_urls": {"key": "connectionUrls", "type": "ConnectionUrlType"}, + "data_safe_status": {"key": "dataSafeStatus", "type": "str"}, + "database_edition": {"key": "databaseEdition", "type": "str"}, + "autonomous_database_id": {"key": "autonomousDatabaseId", "type": "str"}, + "in_memory_area_in_gbs": {"key": "inMemoryAreaInGbs", "type": "int"}, + "is_preview": {"key": "isPreview", "type": "bool"}, + "local_adg_auto_failover_max_data_loss_limit": {"key": "localAdgAutoFailoverMaxDataLossLimit", "type": "int"}, + "memory_per_oracle_compute_unit_in_gbs": {"key": "memoryPerOracleComputeUnitInGbs", "type": "int"}, + "open_mode": {"key": "openMode", "type": "str"}, + "operations_insights_status": {"key": "operationsInsightsStatus", "type": "str"}, + "permission_level": {"key": "permissionLevel", "type": "str"}, + "private_endpoint": {"key": "privateEndpoint", "type": "str"}, + "provisionable_cpus": {"key": "provisionableCpus", "type": "[int]"}, + "role": {"key": "role", "type": "str"}, + "service_console_url": {"key": "serviceConsoleUrl", "type": "str"}, + "sql_web_developer_url": {"key": "sqlWebDeveloperUrl", "type": "str"}, + "supported_regions_to_clone_to": {"key": "supportedRegionsToCloneTo", "type": "[str]"}, + "time_data_guard_role_changed": {"key": "timeDataGuardRoleChanged", "type": "str"}, + "time_deletion_of_free_autonomous_database": {"key": "timeDeletionOfFreeAutonomousDatabase", "type": "str"}, + "time_local_data_guard_enabled": {"key": "timeLocalDataGuardEnabled", "type": "str"}, + "time_of_last_failover": {"key": "timeOfLastFailover", "type": "str"}, + "time_of_last_refresh": {"key": "timeOfLastRefresh", "type": "str"}, + "time_of_last_refresh_point": {"key": "timeOfLastRefreshPoint", "type": "str"}, + "time_of_last_switchover": {"key": "timeOfLastSwitchover", "type": "str"}, + "time_reclamation_of_free_autonomous_database": { + "key": "timeReclamationOfFreeAutonomousDatabase", + "type": "str", + }, + "used_data_storage_size_in_gbs": {"key": "usedDataStorageSizeInGbs", "type": "int"}, + "used_data_storage_size_in_tbs": {"key": "usedDataStorageSizeInTbs", "type": "int"}, + "ocid": {"key": "ocid", "type": "str"}, + "backup_retention_period_in_days": {"key": "backupRetentionPeriodInDays", "type": "int"}, + "whitelisted_ips": {"key": "whitelistedIps", "type": "[str]"}, + } + + _subtype_map = { + "data_base_type": {"Clone": "AutonomousDatabaseCloneProperties", "Regular": "AutonomousDatabaseProperties"} + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + admin_password: Optional[str] = None, + autonomous_maintenance_schedule_type: Optional[Union[str, "_models.AutonomousMaintenanceScheduleType"]] = None, + character_set: Optional[str] = None, + compute_count: Optional[float] = None, + compute_model: Optional[Union[str, "_models.ComputeModel"]] = None, + cpu_core_count: Optional[int] = None, + customer_contacts: Optional[List["_models.CustomerContact"]] = None, + data_storage_size_in_tbs: Optional[int] = None, + data_storage_size_in_gbs: Optional[int] = None, + db_version: Optional[str] = None, + db_workload: Optional[Union[str, "_models.WorkloadType"]] = None, + display_name: Optional[str] = None, + is_auto_scaling_enabled: Optional[bool] = None, + is_auto_scaling_for_storage_enabled: Optional[bool] = None, + peer_db_id: Optional[str] = None, + is_local_data_guard_enabled: Optional[bool] = None, + is_mtls_connection_required: Optional[bool] = None, + is_preview_version_with_service_terms_accepted: Optional[bool] = None, + license_model: Optional[Union[str, "_models.LicenseModel"]] = None, + ncharacter_set: Optional[str] = None, + scheduled_operations: Optional["_models.ScheduledOperationsType"] = None, + private_endpoint_ip: Optional[str] = None, + private_endpoint_label: Optional[str] = None, + subnet_id: Optional[str] = None, + vnet_id: Optional[str] = None, + database_edition: Optional[Union[str, "_models.DatabaseEditionType"]] = None, + autonomous_database_id: Optional[str] = None, + local_adg_auto_failover_max_data_loss_limit: Optional[int] = None, + open_mode: Optional[Union[str, "_models.OpenModeType"]] = None, + permission_level: Optional[Union[str, "_models.PermissionLevelType"]] = None, + role: Optional[Union[str, "_models.RoleType"]] = None, + backup_retention_period_in_days: Optional[int] = None, + whitelisted_ips: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword admin_password: Admin password. + :paramtype admin_password: str + :keyword autonomous_maintenance_schedule_type: The maintenance schedule type of the Autonomous + Database Serverless. Known values are: "Early" and "Regular". + :paramtype autonomous_maintenance_schedule_type: str or + ~azure.mgmt.oracledatabase.models.AutonomousMaintenanceScheduleType + :keyword character_set: The character set for the autonomous database. + :paramtype character_set: str + :keyword compute_count: The compute amount (CPUs) available to the database. + :paramtype compute_count: float + :keyword compute_model: The compute model of the Autonomous Database. Known values are: "ECPU" + and "OCPU". + :paramtype compute_model: str or ~azure.mgmt.oracledatabase.models.ComputeModel + :keyword cpu_core_count: The number of CPU cores to be made available to the database. + :paramtype cpu_core_count: int + :keyword customer_contacts: Customer Contacts. + :paramtype customer_contacts: list[~azure.mgmt.oracledatabase.models.CustomerContact] + :keyword data_storage_size_in_tbs: The quantity of data in the database, in terabytes. + :paramtype data_storage_size_in_tbs: int + :keyword data_storage_size_in_gbs: The size, in gigabytes, of the data volume that will be + created and attached to the database. + :paramtype data_storage_size_in_gbs: int + :keyword db_version: A valid Oracle Database version for Autonomous Database. + :paramtype db_version: str + :keyword db_workload: The Autonomous Database workload type. Known values are: "OLTP", "DW", + "AJD", and "APEX". + :paramtype db_workload: str or ~azure.mgmt.oracledatabase.models.WorkloadType + :keyword display_name: The user-friendly name for the Autonomous Database. + :paramtype display_name: str + :keyword is_auto_scaling_enabled: Indicates if auto scaling is enabled for the Autonomous + Database CPU core count. + :paramtype is_auto_scaling_enabled: bool + :keyword is_auto_scaling_for_storage_enabled: Indicates if auto scaling is enabled for the + Autonomous Database storage. + :paramtype is_auto_scaling_for_storage_enabled: bool + :keyword peer_db_id: The database OCID of the Disaster Recovery peer database, which is located + in a different region from the current peer database. + :paramtype peer_db_id: str + :keyword is_local_data_guard_enabled: Indicates whether the Autonomous Database has local or + called in-region Data Guard enabled. + :paramtype is_local_data_guard_enabled: bool + :keyword is_mtls_connection_required: Specifies if the Autonomous Database requires mTLS + connections. + :paramtype is_mtls_connection_required: bool + :keyword is_preview_version_with_service_terms_accepted: Specifies if the Autonomous Database + preview version is being provisioned. + :paramtype is_preview_version_with_service_terms_accepted: bool + :keyword license_model: The Oracle license model that applies to the Oracle Autonomous + Database. The default is LICENSE_INCLUDED. Known values are: "LicenseIncluded" and + "BringYourOwnLicense". + :paramtype license_model: str or ~azure.mgmt.oracledatabase.models.LicenseModel + :keyword ncharacter_set: The character set for the Autonomous Database. + :paramtype ncharacter_set: str + :keyword scheduled_operations: The list of scheduled operations. + :paramtype scheduled_operations: ~azure.mgmt.oracledatabase.models.ScheduledOperationsType + :keyword private_endpoint_ip: The private endpoint Ip address for the resource. + :paramtype private_endpoint_ip: str + :keyword private_endpoint_label: The resource's private endpoint label. + :paramtype private_endpoint_label: str + :keyword subnet_id: Client subnet. + :paramtype subnet_id: str + :keyword vnet_id: VNET for network connectivity. + :paramtype vnet_id: str + :keyword database_edition: The Oracle Database Edition that applies to the Autonomous + databases. Known values are: "StandardEdition" and "EnterpriseEdition". + :paramtype database_edition: str or ~azure.mgmt.oracledatabase.models.DatabaseEditionType + :keyword autonomous_database_id: Autonomous Database ID. + :paramtype autonomous_database_id: str + :keyword 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. + :paramtype local_adg_auto_failover_max_data_loss_limit: int + :keyword open_mode: Indicates the Autonomous Database mode. Known values are: "ReadOnly" and + "ReadWrite". + :paramtype open_mode: str or ~azure.mgmt.oracledatabase.models.OpenModeType + :keyword permission_level: The Autonomous Database permission level. Known values are: + "Restricted" and "Unrestricted". + :paramtype permission_level: str or ~azure.mgmt.oracledatabase.models.PermissionLevelType + :keyword role: The Data Guard role of the Autonomous Container Database or Autonomous Database, + if Autonomous Data Guard is enabled. Known values are: "Primary", "Standby", "DisabledStandby", + "BackupCopy", and "SnapshotStandby". + :paramtype role: str or ~azure.mgmt.oracledatabase.models.RoleType + :keyword backup_retention_period_in_days: Retention period, in days, for long-term backups. + :paramtype backup_retention_period_in_days: int + :keyword whitelisted_ips: The client IP access control list (ACL). This is an array of CIDR + notations and/or IP addresses. Values should be separate strings, separated by commas. Example: + ['1.1.1.1','1.1.1.0/24','1.1.2.25']. + :paramtype whitelisted_ips: list[str] + """ + super().__init__(**kwargs) + self.admin_password = admin_password + self.data_base_type: Optional[str] = None + self.autonomous_maintenance_schedule_type = autonomous_maintenance_schedule_type + self.character_set = character_set + self.compute_count = compute_count + self.compute_model = compute_model + self.cpu_core_count = cpu_core_count + self.customer_contacts = customer_contacts + self.data_storage_size_in_tbs = data_storage_size_in_tbs + self.data_storage_size_in_gbs = data_storage_size_in_gbs + self.db_version = db_version + self.db_workload = db_workload + self.display_name = display_name + self.is_auto_scaling_enabled = is_auto_scaling_enabled + self.is_auto_scaling_for_storage_enabled = is_auto_scaling_for_storage_enabled + self.peer_db_ids = None + self.peer_db_id = peer_db_id + self.is_local_data_guard_enabled = is_local_data_guard_enabled + self.is_remote_data_guard_enabled = None + self.local_disaster_recovery_type = None + self.local_standby_db = None + self.failed_data_recovery_in_seconds = None + self.is_mtls_connection_required = is_mtls_connection_required + self.is_preview_version_with_service_terms_accepted = is_preview_version_with_service_terms_accepted + self.license_model = license_model + self.ncharacter_set = ncharacter_set + self.lifecycle_details = None + self.provisioning_state = None + self.lifecycle_state = None + self.scheduled_operations = scheduled_operations + self.private_endpoint_ip = private_endpoint_ip + self.private_endpoint_label = private_endpoint_label + self.oci_url = None + self.subnet_id = subnet_id + self.vnet_id = vnet_id + self.time_created = None + self.time_maintenance_begin = None + self.time_maintenance_end = None + self.actual_used_data_storage_size_in_tbs = None + self.allocated_storage_size_in_tbs = None + self.apex_details = None + self.available_upgrade_versions = None + self.connection_strings = None + self.connection_urls = None + self.data_safe_status = None + self.database_edition = database_edition + self.autonomous_database_id = autonomous_database_id + self.in_memory_area_in_gbs = None + self.is_preview = None + self.local_adg_auto_failover_max_data_loss_limit = local_adg_auto_failover_max_data_loss_limit + self.memory_per_oracle_compute_unit_in_gbs = None + self.open_mode = open_mode + self.operations_insights_status = None + self.permission_level = permission_level + self.private_endpoint = None + self.provisionable_cpus = None + self.role = role + self.service_console_url = None + self.sql_web_developer_url = None + self.supported_regions_to_clone_to = None + self.time_data_guard_role_changed = None + self.time_deletion_of_free_autonomous_database = None + self.time_local_data_guard_enabled = None + self.time_of_last_failover = None + self.time_of_last_refresh = None + self.time_of_last_refresh_point = None + self.time_of_last_switchover = None + self.time_reclamation_of_free_autonomous_database = None + self.used_data_storage_size_in_gbs = None + self.used_data_storage_size_in_tbs = None + self.ocid = None + self.backup_retention_period_in_days = backup_retention_period_in_days + self.whitelisted_ips = whitelisted_ips + + +class AutonomousDatabaseCharacterSet(ProxyResource): + """AutonomousDatabaseCharacterSets resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.oracledatabase.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseCharacterSetProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "AutonomousDatabaseCharacterSetProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.AutonomousDatabaseCharacterSetProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: + ~azure.mgmt.oracledatabase.models.AutonomousDatabaseCharacterSetProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class AutonomousDatabaseCharacterSetListResult(_serialization.Model): + """The response of a AutonomousDatabaseCharacterSet list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: The AutonomousDatabaseCharacterSet items on this page. Required. + :vartype value: list[~azure.mgmt.oracledatabase.models.AutonomousDatabaseCharacterSet] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AutonomousDatabaseCharacterSet]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.AutonomousDatabaseCharacterSet"], **kwargs: Any) -> None: + """ + :keyword value: The AutonomousDatabaseCharacterSet items on this page. Required. + :paramtype value: list[~azure.mgmt.oracledatabase.models.AutonomousDatabaseCharacterSet] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class AutonomousDatabaseCharacterSetProperties(_serialization.Model): + """AutonomousDatabaseCharacterSet resource model. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar character_set: The Oracle Autonomous Database supported character sets. Required. + :vartype character_set: str + """ + + _validation = { + "character_set": {"required": True, "readonly": True, "max_length": 255, "min_length": 1}, + } + + _attribute_map = { + "character_set": {"key": "characterSet", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.character_set = None + + +class AutonomousDatabaseCloneProperties( + AutonomousDatabaseBaseProperties +): # pylint: disable=too-many-instance-attributes + """Autonomous Database clone resource model. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar admin_password: Admin password. + :vartype admin_password: str + :ivar data_base_type: Database type to be created. Required. Known values are: "Regular" and + "Clone". + :vartype data_base_type: str or ~azure.mgmt.oracledatabase.models.DataBaseType + :ivar autonomous_maintenance_schedule_type: The maintenance schedule type of the Autonomous + Database Serverless. Known values are: "Early" and "Regular". + :vartype autonomous_maintenance_schedule_type: str or + ~azure.mgmt.oracledatabase.models.AutonomousMaintenanceScheduleType + :ivar character_set: The character set for the autonomous database. + :vartype character_set: str + :ivar compute_count: The compute amount (CPUs) available to the database. + :vartype compute_count: float + :ivar compute_model: The compute model of the Autonomous Database. Known values are: "ECPU" and + "OCPU". + :vartype compute_model: str or ~azure.mgmt.oracledatabase.models.ComputeModel + :ivar cpu_core_count: The number of CPU cores to be made available to the database. + :vartype cpu_core_count: int + :ivar customer_contacts: Customer Contacts. + :vartype customer_contacts: list[~azure.mgmt.oracledatabase.models.CustomerContact] + :ivar data_storage_size_in_tbs: The quantity of data in the database, in terabytes. + :vartype data_storage_size_in_tbs: int + :ivar data_storage_size_in_gbs: The size, in gigabytes, of the data volume that will be created + and attached to the database. + :vartype data_storage_size_in_gbs: int + :ivar db_version: A valid Oracle Database version for Autonomous Database. + :vartype db_version: str + :ivar db_workload: The Autonomous Database workload type. Known values are: "OLTP", "DW", + "AJD", and "APEX". + :vartype db_workload: str or ~azure.mgmt.oracledatabase.models.WorkloadType + :ivar display_name: The user-friendly name for the Autonomous Database. + :vartype display_name: str + :ivar is_auto_scaling_enabled: Indicates if auto scaling is enabled for the Autonomous Database + CPU core count. + :vartype is_auto_scaling_enabled: bool + :ivar is_auto_scaling_for_storage_enabled: Indicates if auto scaling is enabled for the + Autonomous Database storage. + :vartype is_auto_scaling_for_storage_enabled: bool + :ivar peer_db_ids: The list of `OCIDs + `_ 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. + :vartype peer_db_ids: list[str] + :ivar peer_db_id: The database OCID of the Disaster Recovery peer database, which is located in + a different region from the current peer database. + :vartype peer_db_id: str + :ivar is_local_data_guard_enabled: Indicates whether the Autonomous Database has local or + called in-region Data Guard enabled. + :vartype is_local_data_guard_enabled: bool + :ivar is_remote_data_guard_enabled: Indicates whether the Autonomous Database has Cross Region + Data Guard enabled. + :vartype is_remote_data_guard_enabled: bool + :ivar local_disaster_recovery_type: Indicates the local disaster recovery (DR) type of the + Autonomous Database Serverless instance.Autonomous Data Guard (ADG) DR type provides business + critical DR with a faster recovery time objective (RTO) during failover or + switchover.Backup-based DR type provides lower cost DR with a slower RTO during failover or + switchover. Known values are: "Adg" and "BackupBased". + :vartype local_disaster_recovery_type: str or + ~azure.mgmt.oracledatabase.models.DisasterRecoveryType + :ivar local_standby_db: Local Autonomous Disaster Recovery standby database details. + :vartype local_standby_db: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseStandbySummary + :ivar failed_data_recovery_in_seconds: Indicates the number of seconds of data loss for a Data + Guard failover. + :vartype failed_data_recovery_in_seconds: int + :ivar is_mtls_connection_required: Specifies if the Autonomous Database requires mTLS + connections. + :vartype is_mtls_connection_required: bool + :ivar is_preview_version_with_service_terms_accepted: Specifies if the Autonomous Database + preview version is being provisioned. + :vartype is_preview_version_with_service_terms_accepted: bool + :ivar license_model: The Oracle license model that applies to the Oracle Autonomous Database. + The default is LICENSE_INCLUDED. Known values are: "LicenseIncluded" and "BringYourOwnLicense". + :vartype license_model: str or ~azure.mgmt.oracledatabase.models.LicenseModel + :ivar ncharacter_set: The character set for the Autonomous Database. + :vartype ncharacter_set: str + :ivar lifecycle_details: Additional information about the current lifecycle state. + :vartype lifecycle_details: str + :ivar provisioning_state: Azure resource provisioning state. Known values are: "Succeeded", + "Failed", "Canceled", and "Provisioning". + :vartype provisioning_state: str or + ~azure.mgmt.oracledatabase.models.AzureResourceProvisioningState + :ivar lifecycle_state: Views lifecycleState. Known values are: "Provisioning", "Available", + "Stopping", "Stopped", "Starting", "Terminating", "Terminated", "Unavailable", + "RestoreInProgress", "RestoreFailed", "BackupInProgress", "ScaleInProgress", + "AvailableNeedsAttention", "Updating", "MaintenanceInProgress", "Restarting", "Recreating", + "RoleChangeInProgress", "Upgrading", "Inaccessible", and "Standby". + :vartype lifecycle_state: str or + ~azure.mgmt.oracledatabase.models.AutonomousDatabaseLifecycleState + :ivar scheduled_operations: The list of scheduled operations. + :vartype scheduled_operations: ~azure.mgmt.oracledatabase.models.ScheduledOperationsType + :ivar private_endpoint_ip: The private endpoint Ip address for the resource. + :vartype private_endpoint_ip: str + :ivar private_endpoint_label: The resource's private endpoint label. + :vartype private_endpoint_label: str + :ivar oci_url: HTTPS link to OCI resources exposed to Azure Customer via Azure Interface. + :vartype oci_url: str + :ivar subnet_id: Client subnet. + :vartype subnet_id: str + :ivar vnet_id: VNET for network connectivity. + :vartype vnet_id: str + :ivar time_created: The date and time that the database was created. + :vartype time_created: ~datetime.datetime + :ivar time_maintenance_begin: The date and time when maintenance will begin. + :vartype time_maintenance_begin: ~datetime.datetime + :ivar time_maintenance_end: The date and time when maintenance will end. + :vartype time_maintenance_end: ~datetime.datetime + :ivar actual_used_data_storage_size_in_tbs: The current amount of storage in use for user and + system data, in terabytes (TB). + :vartype actual_used_data_storage_size_in_tbs: float + :ivar allocated_storage_size_in_tbs: The amount of storage currently allocated for the database + tables and billed for, rounded up. + :vartype allocated_storage_size_in_tbs: float + :ivar apex_details: Information about Oracle APEX Application Development. + :vartype apex_details: ~azure.mgmt.oracledatabase.models.ApexDetailsType + :ivar available_upgrade_versions: List of Oracle Database versions available for a database + upgrade. If there are no version upgrades available, this list is empty. + :vartype available_upgrade_versions: list[str] + :ivar connection_strings: The connection string used to connect to the Autonomous Database. + :vartype connection_strings: ~azure.mgmt.oracledatabase.models.ConnectionStringType + :ivar connection_urls: The URLs for accessing Oracle Application Express (APEX) and SQL + Developer Web with a browser from a Compute instance within your VCN or that has a direct + connection to your VCN. + :vartype connection_urls: ~azure.mgmt.oracledatabase.models.ConnectionUrlType + :ivar data_safe_status: Status of the Data Safe registration for this Autonomous Database. + Known values are: "Registering", "Registered", "Deregistering", "NotRegistered", and "Failed". + :vartype data_safe_status: str or ~azure.mgmt.oracledatabase.models.DataSafeStatusType + :ivar database_edition: The Oracle Database Edition that applies to the Autonomous databases. + Known values are: "StandardEdition" and "EnterpriseEdition". + :vartype database_edition: str or ~azure.mgmt.oracledatabase.models.DatabaseEditionType + :ivar autonomous_database_id: Autonomous Database ID. + :vartype autonomous_database_id: str + :ivar in_memory_area_in_gbs: The area assigned to In-Memory tables in Autonomous Database. + :vartype in_memory_area_in_gbs: int + :ivar is_preview: Indicates if the Autonomous Database version is a preview version. + :vartype is_preview: bool + :ivar 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. + :vartype local_adg_auto_failover_max_data_loss_limit: int + :ivar memory_per_oracle_compute_unit_in_gbs: The amount of memory (in GBs) enabled per ECPU or + OCPU. + :vartype memory_per_oracle_compute_unit_in_gbs: int + :ivar open_mode: Indicates the Autonomous Database mode. Known values are: "ReadOnly" and + "ReadWrite". + :vartype open_mode: str or ~azure.mgmt.oracledatabase.models.OpenModeType + :ivar operations_insights_status: Status of Operations Insights for this Autonomous Database. + Known values are: "Enabling", "Enabled", "Disabling", "NotEnabled", "FailedEnabling", and + "FailedDisabling". + :vartype operations_insights_status: str or + ~azure.mgmt.oracledatabase.models.OperationsInsightsStatusType + :ivar permission_level: The Autonomous Database permission level. Known values are: + "Restricted" and "Unrestricted". + :vartype permission_level: str or ~azure.mgmt.oracledatabase.models.PermissionLevelType + :ivar private_endpoint: The private endpoint for the resource. + :vartype private_endpoint: str + :ivar provisionable_cpus: An array of CPU values that an Autonomous Database can be scaled to. + :vartype provisionable_cpus: list[int] + :ivar role: The Data Guard role of the Autonomous Container Database or Autonomous Database, if + Autonomous Data Guard is enabled. Known values are: "Primary", "Standby", "DisabledStandby", + "BackupCopy", and "SnapshotStandby". + :vartype role: str or ~azure.mgmt.oracledatabase.models.RoleType + :ivar service_console_url: The URL of the Service Console for the Autonomous Database. + :vartype service_console_url: str + :ivar sql_web_developer_url: The SQL Web Developer URL for the Oracle Autonomous Database. + :vartype sql_web_developer_url: str + :ivar 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. + :vartype supported_regions_to_clone_to: list[str] + :ivar time_data_guard_role_changed: The date and time the Autonomous Data Guard role was + switched for the Autonomous Database. + :vartype time_data_guard_role_changed: str + :ivar time_deletion_of_free_autonomous_database: The date and time the Always Free database + will be automatically deleted because of inactivity. + :vartype time_deletion_of_free_autonomous_database: str + :ivar 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. + :vartype time_local_data_guard_enabled: str + :ivar time_of_last_failover: The timestamp of the last failover operation. + :vartype time_of_last_failover: str + :ivar time_of_last_refresh: The date and time when last refresh happened. + :vartype time_of_last_refresh: str + :ivar time_of_last_refresh_point: The refresh point timestamp (UTC). + :vartype time_of_last_refresh_point: str + :ivar time_of_last_switchover: The timestamp of the last switchover operation for the + Autonomous Database. + :vartype time_of_last_switchover: str + :ivar time_reclamation_of_free_autonomous_database: The date and time the Always Free database + will be stopped because of inactivity. + :vartype time_reclamation_of_free_autonomous_database: str + :ivar used_data_storage_size_in_gbs: The storage space consumed by Autonomous Database in GBs. + :vartype used_data_storage_size_in_gbs: int + :ivar used_data_storage_size_in_tbs: The amount of storage that has been used, in terabytes. + :vartype used_data_storage_size_in_tbs: int + :ivar ocid: Database ocid. + :vartype ocid: str + :ivar backup_retention_period_in_days: Retention period, in days, for long-term backups. + :vartype backup_retention_period_in_days: int + :ivar whitelisted_ips: The client IP access control list (ACL). This is an array of CIDR + notations and/or IP addresses. Values should be separate strings, separated by commas. Example: + ['1.1.1.1','1.1.1.0/24','1.1.2.25']. + :vartype whitelisted_ips: list[str] + :ivar source: The source of the database. Known values are: "None", "Database", "BackupFromId", + "BackupFromTimestamp", "CloneToRefreshable", "CrossRegionDataguard", and + "CrossRegionDisasterRecovery". + :vartype source: str or ~azure.mgmt.oracledatabase.models.SourceType + :ivar source_id: The Azure ID of the Autonomous Database that was cloned to create the current + Autonomous Database. Required. + :vartype source_id: str + :ivar clone_type: The Autonomous Database clone type. Required. Known values are: "Full" and + "Metadata". + :vartype clone_type: str or ~azure.mgmt.oracledatabase.models.CloneType + :ivar is_reconnect_clone_enabled: Indicates if the refreshable clone can be reconnected to its + source database. + :vartype is_reconnect_clone_enabled: bool + :ivar is_refreshable_clone: Indicates if the Autonomous Database is a refreshable clone. + :vartype is_refreshable_clone: bool + :ivar refreshable_model: The refresh mode of the clone. Known values are: "Automatic" and + "Manual". + :vartype refreshable_model: str or ~azure.mgmt.oracledatabase.models.RefreshableModelType + :ivar refreshable_status: The refresh status of the clone. Known values are: "Refreshing" and + "NotRefreshing". + :vartype refreshable_status: str or ~azure.mgmt.oracledatabase.models.RefreshableStatusType + :ivar time_until_reconnect_clone_enabled: The time and date as an RFC3339 formatted string, + e.g., 2022-01-01T12:00:00.000Z, to set the limit for a refreshable clone to be reconnected to + its source database. + :vartype time_until_reconnect_clone_enabled: str + """ + + _validation = { + "data_base_type": {"required": True}, + "character_set": {"max_length": 255, "min_length": 1}, + "compute_count": {"maximum": 512, "minimum": 0.1}, + "cpu_core_count": {"maximum": 128, "minimum": 1}, + "data_storage_size_in_tbs": {"maximum": 384, "minimum": 1}, + "data_storage_size_in_gbs": {"maximum": 393216, "minimum": 20}, + "db_version": {"max_length": 255, "min_length": 1}, + "display_name": {"max_length": 255, "min_length": 1}, + "peer_db_ids": {"readonly": True}, + "peer_db_id": {"max_length": 255, "min_length": 1}, + "is_remote_data_guard_enabled": {"readonly": True}, + "local_disaster_recovery_type": {"readonly": True}, + "local_standby_db": {"readonly": True}, + "failed_data_recovery_in_seconds": {"readonly": True}, + "ncharacter_set": {"max_length": 255, "min_length": 1}, + "lifecycle_details": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "lifecycle_state": {"readonly": True}, + "oci_url": {"readonly": True}, + "time_created": {"readonly": True}, + "time_maintenance_begin": {"readonly": True}, + "time_maintenance_end": {"readonly": True}, + "actual_used_data_storage_size_in_tbs": {"readonly": True}, + "allocated_storage_size_in_tbs": {"readonly": True}, + "apex_details": {"readonly": True}, + "available_upgrade_versions": {"readonly": True}, + "connection_strings": {"readonly": True}, + "connection_urls": {"readonly": True}, + "data_safe_status": {"readonly": True}, + "in_memory_area_in_gbs": {"readonly": True}, + "is_preview": {"readonly": True}, + "local_adg_auto_failover_max_data_loss_limit": {"maximum": 3600, "minimum": 0}, + "memory_per_oracle_compute_unit_in_gbs": {"readonly": True}, + "operations_insights_status": {"readonly": True}, + "private_endpoint": {"readonly": True}, + "provisionable_cpus": {"readonly": True}, + "service_console_url": {"readonly": True, "max_length": 255, "min_length": 10}, + "sql_web_developer_url": {"readonly": True, "max_length": 2048, "min_length": 10}, + "supported_regions_to_clone_to": {"readonly": True, "max_items": 50, "min_items": 0}, + "time_data_guard_role_changed": {"readonly": True}, + "time_deletion_of_free_autonomous_database": {"readonly": True}, + "time_local_data_guard_enabled": {"readonly": True}, + "time_of_last_failover": {"readonly": True}, + "time_of_last_refresh": {"readonly": True}, + "time_of_last_refresh_point": {"readonly": True}, + "time_of_last_switchover": {"readonly": True}, + "time_reclamation_of_free_autonomous_database": {"readonly": True}, + "used_data_storage_size_in_gbs": {"readonly": True}, + "used_data_storage_size_in_tbs": {"readonly": True}, + "ocid": {"readonly": True, "max_length": 255, "min_length": 1}, + "source_id": {"required": True}, + "clone_type": {"required": True}, + "is_reconnect_clone_enabled": {"readonly": True}, + "is_refreshable_clone": {"readonly": True}, + "refreshable_status": {"readonly": True}, + } + + _attribute_map = { + "admin_password": {"key": "adminPassword", "type": "str"}, + "data_base_type": {"key": "dataBaseType", "type": "str"}, + "autonomous_maintenance_schedule_type": {"key": "autonomousMaintenanceScheduleType", "type": "str"}, + "character_set": {"key": "characterSet", "type": "str"}, + "compute_count": {"key": "computeCount", "type": "float"}, + "compute_model": {"key": "computeModel", "type": "str"}, + "cpu_core_count": {"key": "cpuCoreCount", "type": "int"}, + "customer_contacts": {"key": "customerContacts", "type": "[CustomerContact]"}, + "data_storage_size_in_tbs": {"key": "dataStorageSizeInTbs", "type": "int"}, + "data_storage_size_in_gbs": {"key": "dataStorageSizeInGbs", "type": "int"}, + "db_version": {"key": "dbVersion", "type": "str"}, + "db_workload": {"key": "dbWorkload", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "is_auto_scaling_enabled": {"key": "isAutoScalingEnabled", "type": "bool"}, + "is_auto_scaling_for_storage_enabled": {"key": "isAutoScalingForStorageEnabled", "type": "bool"}, + "peer_db_ids": {"key": "peerDbIds", "type": "[str]"}, + "peer_db_id": {"key": "peerDbId", "type": "str"}, + "is_local_data_guard_enabled": {"key": "isLocalDataGuardEnabled", "type": "bool"}, + "is_remote_data_guard_enabled": {"key": "isRemoteDataGuardEnabled", "type": "bool"}, + "local_disaster_recovery_type": {"key": "localDisasterRecoveryType", "type": "str"}, + "local_standby_db": {"key": "localStandbyDb", "type": "AutonomousDatabaseStandbySummary"}, + "failed_data_recovery_in_seconds": {"key": "failedDataRecoveryInSeconds", "type": "int"}, + "is_mtls_connection_required": {"key": "isMtlsConnectionRequired", "type": "bool"}, + "is_preview_version_with_service_terms_accepted": { + "key": "isPreviewVersionWithServiceTermsAccepted", + "type": "bool", + }, + "license_model": {"key": "licenseModel", "type": "str"}, + "ncharacter_set": {"key": "ncharacterSet", "type": "str"}, + "lifecycle_details": {"key": "lifecycleDetails", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "lifecycle_state": {"key": "lifecycleState", "type": "str"}, + "scheduled_operations": {"key": "scheduledOperations", "type": "ScheduledOperationsType"}, + "private_endpoint_ip": {"key": "privateEndpointIp", "type": "str"}, + "private_endpoint_label": {"key": "privateEndpointLabel", "type": "str"}, + "oci_url": {"key": "ociUrl", "type": "str"}, + "subnet_id": {"key": "subnetId", "type": "str"}, + "vnet_id": {"key": "vnetId", "type": "str"}, + "time_created": {"key": "timeCreated", "type": "iso-8601"}, + "time_maintenance_begin": {"key": "timeMaintenanceBegin", "type": "iso-8601"}, + "time_maintenance_end": {"key": "timeMaintenanceEnd", "type": "iso-8601"}, + "actual_used_data_storage_size_in_tbs": {"key": "actualUsedDataStorageSizeInTbs", "type": "float"}, + "allocated_storage_size_in_tbs": {"key": "allocatedStorageSizeInTbs", "type": "float"}, + "apex_details": {"key": "apexDetails", "type": "ApexDetailsType"}, + "available_upgrade_versions": {"key": "availableUpgradeVersions", "type": "[str]"}, + "connection_strings": {"key": "connectionStrings", "type": "ConnectionStringType"}, + "connection_urls": {"key": "connectionUrls", "type": "ConnectionUrlType"}, + "data_safe_status": {"key": "dataSafeStatus", "type": "str"}, + "database_edition": {"key": "databaseEdition", "type": "str"}, + "autonomous_database_id": {"key": "autonomousDatabaseId", "type": "str"}, + "in_memory_area_in_gbs": {"key": "inMemoryAreaInGbs", "type": "int"}, + "is_preview": {"key": "isPreview", "type": "bool"}, + "local_adg_auto_failover_max_data_loss_limit": {"key": "localAdgAutoFailoverMaxDataLossLimit", "type": "int"}, + "memory_per_oracle_compute_unit_in_gbs": {"key": "memoryPerOracleComputeUnitInGbs", "type": "int"}, + "open_mode": {"key": "openMode", "type": "str"}, + "operations_insights_status": {"key": "operationsInsightsStatus", "type": "str"}, + "permission_level": {"key": "permissionLevel", "type": "str"}, + "private_endpoint": {"key": "privateEndpoint", "type": "str"}, + "provisionable_cpus": {"key": "provisionableCpus", "type": "[int]"}, + "role": {"key": "role", "type": "str"}, + "service_console_url": {"key": "serviceConsoleUrl", "type": "str"}, + "sql_web_developer_url": {"key": "sqlWebDeveloperUrl", "type": "str"}, + "supported_regions_to_clone_to": {"key": "supportedRegionsToCloneTo", "type": "[str]"}, + "time_data_guard_role_changed": {"key": "timeDataGuardRoleChanged", "type": "str"}, + "time_deletion_of_free_autonomous_database": {"key": "timeDeletionOfFreeAutonomousDatabase", "type": "str"}, + "time_local_data_guard_enabled": {"key": "timeLocalDataGuardEnabled", "type": "str"}, + "time_of_last_failover": {"key": "timeOfLastFailover", "type": "str"}, + "time_of_last_refresh": {"key": "timeOfLastRefresh", "type": "str"}, + "time_of_last_refresh_point": {"key": "timeOfLastRefreshPoint", "type": "str"}, + "time_of_last_switchover": {"key": "timeOfLastSwitchover", "type": "str"}, + "time_reclamation_of_free_autonomous_database": { + "key": "timeReclamationOfFreeAutonomousDatabase", + "type": "str", + }, + "used_data_storage_size_in_gbs": {"key": "usedDataStorageSizeInGbs", "type": "int"}, + "used_data_storage_size_in_tbs": {"key": "usedDataStorageSizeInTbs", "type": "int"}, + "ocid": {"key": "ocid", "type": "str"}, + "backup_retention_period_in_days": {"key": "backupRetentionPeriodInDays", "type": "int"}, + "whitelisted_ips": {"key": "whitelistedIps", "type": "[str]"}, + "source": {"key": "source", "type": "str"}, + "source_id": {"key": "sourceId", "type": "str"}, + "clone_type": {"key": "cloneType", "type": "str"}, + "is_reconnect_clone_enabled": {"key": "isReconnectCloneEnabled", "type": "bool"}, + "is_refreshable_clone": {"key": "isRefreshableClone", "type": "bool"}, + "refreshable_model": {"key": "refreshableModel", "type": "str"}, + "refreshable_status": {"key": "refreshableStatus", "type": "str"}, + "time_until_reconnect_clone_enabled": {"key": "timeUntilReconnectCloneEnabled", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + source_id: str, + clone_type: Union[str, "_models.CloneType"], + admin_password: Optional[str] = None, + autonomous_maintenance_schedule_type: Optional[Union[str, "_models.AutonomousMaintenanceScheduleType"]] = None, + character_set: Optional[str] = None, + compute_count: Optional[float] = None, + compute_model: Optional[Union[str, "_models.ComputeModel"]] = None, + cpu_core_count: Optional[int] = None, + customer_contacts: Optional[List["_models.CustomerContact"]] = None, + data_storage_size_in_tbs: Optional[int] = None, + data_storage_size_in_gbs: Optional[int] = None, + db_version: Optional[str] = None, + db_workload: Optional[Union[str, "_models.WorkloadType"]] = None, + display_name: Optional[str] = None, + is_auto_scaling_enabled: Optional[bool] = None, + is_auto_scaling_for_storage_enabled: Optional[bool] = None, + peer_db_id: Optional[str] = None, + is_local_data_guard_enabled: Optional[bool] = None, + is_mtls_connection_required: Optional[bool] = None, + is_preview_version_with_service_terms_accepted: Optional[bool] = None, + license_model: Optional[Union[str, "_models.LicenseModel"]] = None, + ncharacter_set: Optional[str] = None, + scheduled_operations: Optional["_models.ScheduledOperationsType"] = None, + private_endpoint_ip: Optional[str] = None, + private_endpoint_label: Optional[str] = None, + subnet_id: Optional[str] = None, + vnet_id: Optional[str] = None, + database_edition: Optional[Union[str, "_models.DatabaseEditionType"]] = None, + autonomous_database_id: Optional[str] = None, + local_adg_auto_failover_max_data_loss_limit: Optional[int] = None, + open_mode: Optional[Union[str, "_models.OpenModeType"]] = None, + permission_level: Optional[Union[str, "_models.PermissionLevelType"]] = None, + role: Optional[Union[str, "_models.RoleType"]] = None, + backup_retention_period_in_days: Optional[int] = None, + whitelisted_ips: Optional[List[str]] = None, + source: Optional[Union[str, "_models.SourceType"]] = None, + refreshable_model: Optional[Union[str, "_models.RefreshableModelType"]] = None, + time_until_reconnect_clone_enabled: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword admin_password: Admin password. + :paramtype admin_password: str + :keyword autonomous_maintenance_schedule_type: The maintenance schedule type of the Autonomous + Database Serverless. Known values are: "Early" and "Regular". + :paramtype autonomous_maintenance_schedule_type: str or + ~azure.mgmt.oracledatabase.models.AutonomousMaintenanceScheduleType + :keyword character_set: The character set for the autonomous database. + :paramtype character_set: str + :keyword compute_count: The compute amount (CPUs) available to the database. + :paramtype compute_count: float + :keyword compute_model: The compute model of the Autonomous Database. Known values are: "ECPU" + and "OCPU". + :paramtype compute_model: str or ~azure.mgmt.oracledatabase.models.ComputeModel + :keyword cpu_core_count: The number of CPU cores to be made available to the database. + :paramtype cpu_core_count: int + :keyword customer_contacts: Customer Contacts. + :paramtype customer_contacts: list[~azure.mgmt.oracledatabase.models.CustomerContact] + :keyword data_storage_size_in_tbs: The quantity of data in the database, in terabytes. + :paramtype data_storage_size_in_tbs: int + :keyword data_storage_size_in_gbs: The size, in gigabytes, of the data volume that will be + created and attached to the database. + :paramtype data_storage_size_in_gbs: int + :keyword db_version: A valid Oracle Database version for Autonomous Database. + :paramtype db_version: str + :keyword db_workload: The Autonomous Database workload type. Known values are: "OLTP", "DW", + "AJD", and "APEX". + :paramtype db_workload: str or ~azure.mgmt.oracledatabase.models.WorkloadType + :keyword display_name: The user-friendly name for the Autonomous Database. + :paramtype display_name: str + :keyword is_auto_scaling_enabled: Indicates if auto scaling is enabled for the Autonomous + Database CPU core count. + :paramtype is_auto_scaling_enabled: bool + :keyword is_auto_scaling_for_storage_enabled: Indicates if auto scaling is enabled for the + Autonomous Database storage. + :paramtype is_auto_scaling_for_storage_enabled: bool + :keyword peer_db_id: The database OCID of the Disaster Recovery peer database, which is located + in a different region from the current peer database. + :paramtype peer_db_id: str + :keyword is_local_data_guard_enabled: Indicates whether the Autonomous Database has local or + called in-region Data Guard enabled. + :paramtype is_local_data_guard_enabled: bool + :keyword is_mtls_connection_required: Specifies if the Autonomous Database requires mTLS + connections. + :paramtype is_mtls_connection_required: bool + :keyword is_preview_version_with_service_terms_accepted: Specifies if the Autonomous Database + preview version is being provisioned. + :paramtype is_preview_version_with_service_terms_accepted: bool + :keyword license_model: The Oracle license model that applies to the Oracle Autonomous + Database. The default is LICENSE_INCLUDED. Known values are: "LicenseIncluded" and + "BringYourOwnLicense". + :paramtype license_model: str or ~azure.mgmt.oracledatabase.models.LicenseModel + :keyword ncharacter_set: The character set for the Autonomous Database. + :paramtype ncharacter_set: str + :keyword scheduled_operations: The list of scheduled operations. + :paramtype scheduled_operations: ~azure.mgmt.oracledatabase.models.ScheduledOperationsType + :keyword private_endpoint_ip: The private endpoint Ip address for the resource. + :paramtype private_endpoint_ip: str + :keyword private_endpoint_label: The resource's private endpoint label. + :paramtype private_endpoint_label: str + :keyword subnet_id: Client subnet. + :paramtype subnet_id: str + :keyword vnet_id: VNET for network connectivity. + :paramtype vnet_id: str + :keyword database_edition: The Oracle Database Edition that applies to the Autonomous + databases. Known values are: "StandardEdition" and "EnterpriseEdition". + :paramtype database_edition: str or ~azure.mgmt.oracledatabase.models.DatabaseEditionType + :keyword autonomous_database_id: Autonomous Database ID. + :paramtype autonomous_database_id: str + :keyword 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. + :paramtype local_adg_auto_failover_max_data_loss_limit: int + :keyword open_mode: Indicates the Autonomous Database mode. Known values are: "ReadOnly" and + "ReadWrite". + :paramtype open_mode: str or ~azure.mgmt.oracledatabase.models.OpenModeType + :keyword permission_level: The Autonomous Database permission level. Known values are: + "Restricted" and "Unrestricted". + :paramtype permission_level: str or ~azure.mgmt.oracledatabase.models.PermissionLevelType + :keyword role: The Data Guard role of the Autonomous Container Database or Autonomous Database, + if Autonomous Data Guard is enabled. Known values are: "Primary", "Standby", "DisabledStandby", + "BackupCopy", and "SnapshotStandby". + :paramtype role: str or ~azure.mgmt.oracledatabase.models.RoleType + :keyword backup_retention_period_in_days: Retention period, in days, for long-term backups. + :paramtype backup_retention_period_in_days: int + :keyword whitelisted_ips: The client IP access control list (ACL). This is an array of CIDR + notations and/or IP addresses. Values should be separate strings, separated by commas. Example: + ['1.1.1.1','1.1.1.0/24','1.1.2.25']. + :paramtype whitelisted_ips: list[str] + :keyword source: The source of the database. Known values are: "None", "Database", + "BackupFromId", "BackupFromTimestamp", "CloneToRefreshable", "CrossRegionDataguard", and + "CrossRegionDisasterRecovery". + :paramtype source: str or ~azure.mgmt.oracledatabase.models.SourceType + :keyword source_id: The Azure ID of the Autonomous Database that was cloned to create the + current Autonomous Database. Required. + :paramtype source_id: str + :keyword clone_type: The Autonomous Database clone type. Required. Known values are: "Full" and + "Metadata". + :paramtype clone_type: str or ~azure.mgmt.oracledatabase.models.CloneType + :keyword refreshable_model: The refresh mode of the clone. Known values are: "Automatic" and + "Manual". + :paramtype refreshable_model: str or ~azure.mgmt.oracledatabase.models.RefreshableModelType + :keyword time_until_reconnect_clone_enabled: The time and date as an RFC3339 formatted string, + e.g., 2022-01-01T12:00:00.000Z, to set the limit for a refreshable clone to be reconnected to + its source database. + :paramtype time_until_reconnect_clone_enabled: str + """ + super().__init__( + admin_password=admin_password, + autonomous_maintenance_schedule_type=autonomous_maintenance_schedule_type, + character_set=character_set, + compute_count=compute_count, + compute_model=compute_model, + cpu_core_count=cpu_core_count, + customer_contacts=customer_contacts, + data_storage_size_in_tbs=data_storage_size_in_tbs, + data_storage_size_in_gbs=data_storage_size_in_gbs, + db_version=db_version, + db_workload=db_workload, + display_name=display_name, + is_auto_scaling_enabled=is_auto_scaling_enabled, + is_auto_scaling_for_storage_enabled=is_auto_scaling_for_storage_enabled, + peer_db_id=peer_db_id, + is_local_data_guard_enabled=is_local_data_guard_enabled, + is_mtls_connection_required=is_mtls_connection_required, + is_preview_version_with_service_terms_accepted=is_preview_version_with_service_terms_accepted, + license_model=license_model, + ncharacter_set=ncharacter_set, + scheduled_operations=scheduled_operations, + private_endpoint_ip=private_endpoint_ip, + private_endpoint_label=private_endpoint_label, + subnet_id=subnet_id, + vnet_id=vnet_id, + database_edition=database_edition, + autonomous_database_id=autonomous_database_id, + local_adg_auto_failover_max_data_loss_limit=local_adg_auto_failover_max_data_loss_limit, + open_mode=open_mode, + permission_level=permission_level, + role=role, + backup_retention_period_in_days=backup_retention_period_in_days, + whitelisted_ips=whitelisted_ips, + **kwargs + ) + self.data_base_type: str = "Clone" + self.source = source + self.source_id = source_id + self.clone_type = clone_type + self.is_reconnect_clone_enabled = None + self.is_refreshable_clone = None + self.refreshable_model = refreshable_model + self.refreshable_status = None + self.time_until_reconnect_clone_enabled = time_until_reconnect_clone_enabled + + +class AutonomousDatabaseListResult(_serialization.Model): + """The response of a AutonomousDatabase list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: The AutonomousDatabase items on this page. Required. + :vartype value: list[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AutonomousDatabase]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.AutonomousDatabase"], **kwargs: Any) -> None: + """ + :keyword value: The AutonomousDatabase items on this page. Required. + :paramtype value: list[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class AutonomousDatabaseNationalCharacterSet(ProxyResource): + """AutonomousDatabaseNationalCharacterSets resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.oracledatabase.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: + ~azure.mgmt.oracledatabase.models.AutonomousDatabaseNationalCharacterSetProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "AutonomousDatabaseNationalCharacterSetProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.AutonomousDatabaseNationalCharacterSetProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: + ~azure.mgmt.oracledatabase.models.AutonomousDatabaseNationalCharacterSetProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class AutonomousDatabaseNationalCharacterSetListResult(_serialization.Model): # pylint: disable=name-too-long + """The response of a AutonomousDatabaseNationalCharacterSet list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: The AutonomousDatabaseNationalCharacterSet items on this page. Required. + :vartype value: list[~azure.mgmt.oracledatabase.models.AutonomousDatabaseNationalCharacterSet] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AutonomousDatabaseNationalCharacterSet]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.AutonomousDatabaseNationalCharacterSet"], **kwargs: Any) -> None: + """ + :keyword value: The AutonomousDatabaseNationalCharacterSet items on this page. Required. + :paramtype value: + list[~azure.mgmt.oracledatabase.models.AutonomousDatabaseNationalCharacterSet] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class AutonomousDatabaseNationalCharacterSetProperties(_serialization.Model): # pylint: disable=name-too-long + """AutonomousDatabaseNationalCharacterSet resource model. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar character_set: The Oracle Autonomous Database supported national character sets. + Required. + :vartype character_set: str + """ + + _validation = { + "character_set": {"required": True, "readonly": True, "max_length": 255, "min_length": 1}, + } + + _attribute_map = { + "character_set": {"key": "characterSet", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.character_set = None + + +class AutonomousDatabaseProperties(AutonomousDatabaseBaseProperties): # pylint: disable=too-many-instance-attributes + """Autonomous Database resource model. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar admin_password: Admin password. + :vartype admin_password: str + :ivar data_base_type: Database type to be created. Required. Known values are: "Regular" and + "Clone". + :vartype data_base_type: str or ~azure.mgmt.oracledatabase.models.DataBaseType + :ivar autonomous_maintenance_schedule_type: The maintenance schedule type of the Autonomous + Database Serverless. Known values are: "Early" and "Regular". + :vartype autonomous_maintenance_schedule_type: str or + ~azure.mgmt.oracledatabase.models.AutonomousMaintenanceScheduleType + :ivar character_set: The character set for the autonomous database. + :vartype character_set: str + :ivar compute_count: The compute amount (CPUs) available to the database. + :vartype compute_count: float + :ivar compute_model: The compute model of the Autonomous Database. Known values are: "ECPU" and + "OCPU". + :vartype compute_model: str or ~azure.mgmt.oracledatabase.models.ComputeModel + :ivar cpu_core_count: The number of CPU cores to be made available to the database. + :vartype cpu_core_count: int + :ivar customer_contacts: Customer Contacts. + :vartype customer_contacts: list[~azure.mgmt.oracledatabase.models.CustomerContact] + :ivar data_storage_size_in_tbs: The quantity of data in the database, in terabytes. + :vartype data_storage_size_in_tbs: int + :ivar data_storage_size_in_gbs: The size, in gigabytes, of the data volume that will be created + and attached to the database. + :vartype data_storage_size_in_gbs: int + :ivar db_version: A valid Oracle Database version for Autonomous Database. + :vartype db_version: str + :ivar db_workload: The Autonomous Database workload type. Known values are: "OLTP", "DW", + "AJD", and "APEX". + :vartype db_workload: str or ~azure.mgmt.oracledatabase.models.WorkloadType + :ivar display_name: The user-friendly name for the Autonomous Database. + :vartype display_name: str + :ivar is_auto_scaling_enabled: Indicates if auto scaling is enabled for the Autonomous Database + CPU core count. + :vartype is_auto_scaling_enabled: bool + :ivar is_auto_scaling_for_storage_enabled: Indicates if auto scaling is enabled for the + Autonomous Database storage. + :vartype is_auto_scaling_for_storage_enabled: bool + :ivar peer_db_ids: The list of `OCIDs + `_ 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. + :vartype peer_db_ids: list[str] + :ivar peer_db_id: The database OCID of the Disaster Recovery peer database, which is located in + a different region from the current peer database. + :vartype peer_db_id: str + :ivar is_local_data_guard_enabled: Indicates whether the Autonomous Database has local or + called in-region Data Guard enabled. + :vartype is_local_data_guard_enabled: bool + :ivar is_remote_data_guard_enabled: Indicates whether the Autonomous Database has Cross Region + Data Guard enabled. + :vartype is_remote_data_guard_enabled: bool + :ivar local_disaster_recovery_type: Indicates the local disaster recovery (DR) type of the + Autonomous Database Serverless instance.Autonomous Data Guard (ADG) DR type provides business + critical DR with a faster recovery time objective (RTO) during failover or + switchover.Backup-based DR type provides lower cost DR with a slower RTO during failover or + switchover. Known values are: "Adg" and "BackupBased". + :vartype local_disaster_recovery_type: str or + ~azure.mgmt.oracledatabase.models.DisasterRecoveryType + :ivar local_standby_db: Local Autonomous Disaster Recovery standby database details. + :vartype local_standby_db: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseStandbySummary + :ivar failed_data_recovery_in_seconds: Indicates the number of seconds of data loss for a Data + Guard failover. + :vartype failed_data_recovery_in_seconds: int + :ivar is_mtls_connection_required: Specifies if the Autonomous Database requires mTLS + connections. + :vartype is_mtls_connection_required: bool + :ivar is_preview_version_with_service_terms_accepted: Specifies if the Autonomous Database + preview version is being provisioned. + :vartype is_preview_version_with_service_terms_accepted: bool + :ivar license_model: The Oracle license model that applies to the Oracle Autonomous Database. + The default is LICENSE_INCLUDED. Known values are: "LicenseIncluded" and "BringYourOwnLicense". + :vartype license_model: str or ~azure.mgmt.oracledatabase.models.LicenseModel + :ivar ncharacter_set: The character set for the Autonomous Database. + :vartype ncharacter_set: str + :ivar lifecycle_details: Additional information about the current lifecycle state. + :vartype lifecycle_details: str + :ivar provisioning_state: Azure resource provisioning state. Known values are: "Succeeded", + "Failed", "Canceled", and "Provisioning". + :vartype provisioning_state: str or + ~azure.mgmt.oracledatabase.models.AzureResourceProvisioningState + :ivar lifecycle_state: Views lifecycleState. Known values are: "Provisioning", "Available", + "Stopping", "Stopped", "Starting", "Terminating", "Terminated", "Unavailable", + "RestoreInProgress", "RestoreFailed", "BackupInProgress", "ScaleInProgress", + "AvailableNeedsAttention", "Updating", "MaintenanceInProgress", "Restarting", "Recreating", + "RoleChangeInProgress", "Upgrading", "Inaccessible", and "Standby". + :vartype lifecycle_state: str or + ~azure.mgmt.oracledatabase.models.AutonomousDatabaseLifecycleState + :ivar scheduled_operations: The list of scheduled operations. + :vartype scheduled_operations: ~azure.mgmt.oracledatabase.models.ScheduledOperationsType + :ivar private_endpoint_ip: The private endpoint Ip address for the resource. + :vartype private_endpoint_ip: str + :ivar private_endpoint_label: The resource's private endpoint label. + :vartype private_endpoint_label: str + :ivar oci_url: HTTPS link to OCI resources exposed to Azure Customer via Azure Interface. + :vartype oci_url: str + :ivar subnet_id: Client subnet. + :vartype subnet_id: str + :ivar vnet_id: VNET for network connectivity. + :vartype vnet_id: str + :ivar time_created: The date and time that the database was created. + :vartype time_created: ~datetime.datetime + :ivar time_maintenance_begin: The date and time when maintenance will begin. + :vartype time_maintenance_begin: ~datetime.datetime + :ivar time_maintenance_end: The date and time when maintenance will end. + :vartype time_maintenance_end: ~datetime.datetime + :ivar actual_used_data_storage_size_in_tbs: The current amount of storage in use for user and + system data, in terabytes (TB). + :vartype actual_used_data_storage_size_in_tbs: float + :ivar allocated_storage_size_in_tbs: The amount of storage currently allocated for the database + tables and billed for, rounded up. + :vartype allocated_storage_size_in_tbs: float + :ivar apex_details: Information about Oracle APEX Application Development. + :vartype apex_details: ~azure.mgmt.oracledatabase.models.ApexDetailsType + :ivar available_upgrade_versions: List of Oracle Database versions available for a database + upgrade. If there are no version upgrades available, this list is empty. + :vartype available_upgrade_versions: list[str] + :ivar connection_strings: The connection string used to connect to the Autonomous Database. + :vartype connection_strings: ~azure.mgmt.oracledatabase.models.ConnectionStringType + :ivar connection_urls: The URLs for accessing Oracle Application Express (APEX) and SQL + Developer Web with a browser from a Compute instance within your VCN or that has a direct + connection to your VCN. + :vartype connection_urls: ~azure.mgmt.oracledatabase.models.ConnectionUrlType + :ivar data_safe_status: Status of the Data Safe registration for this Autonomous Database. + Known values are: "Registering", "Registered", "Deregistering", "NotRegistered", and "Failed". + :vartype data_safe_status: str or ~azure.mgmt.oracledatabase.models.DataSafeStatusType + :ivar database_edition: The Oracle Database Edition that applies to the Autonomous databases. + Known values are: "StandardEdition" and "EnterpriseEdition". + :vartype database_edition: str or ~azure.mgmt.oracledatabase.models.DatabaseEditionType + :ivar autonomous_database_id: Autonomous Database ID. + :vartype autonomous_database_id: str + :ivar in_memory_area_in_gbs: The area assigned to In-Memory tables in Autonomous Database. + :vartype in_memory_area_in_gbs: int + :ivar is_preview: Indicates if the Autonomous Database version is a preview version. + :vartype is_preview: bool + :ivar 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. + :vartype local_adg_auto_failover_max_data_loss_limit: int + :ivar memory_per_oracle_compute_unit_in_gbs: The amount of memory (in GBs) enabled per ECPU or + OCPU. + :vartype memory_per_oracle_compute_unit_in_gbs: int + :ivar open_mode: Indicates the Autonomous Database mode. Known values are: "ReadOnly" and + "ReadWrite". + :vartype open_mode: str or ~azure.mgmt.oracledatabase.models.OpenModeType + :ivar operations_insights_status: Status of Operations Insights for this Autonomous Database. + Known values are: "Enabling", "Enabled", "Disabling", "NotEnabled", "FailedEnabling", and + "FailedDisabling". + :vartype operations_insights_status: str or + ~azure.mgmt.oracledatabase.models.OperationsInsightsStatusType + :ivar permission_level: The Autonomous Database permission level. Known values are: + "Restricted" and "Unrestricted". + :vartype permission_level: str or ~azure.mgmt.oracledatabase.models.PermissionLevelType + :ivar private_endpoint: The private endpoint for the resource. + :vartype private_endpoint: str + :ivar provisionable_cpus: An array of CPU values that an Autonomous Database can be scaled to. + :vartype provisionable_cpus: list[int] + :ivar role: The Data Guard role of the Autonomous Container Database or Autonomous Database, if + Autonomous Data Guard is enabled. Known values are: "Primary", "Standby", "DisabledStandby", + "BackupCopy", and "SnapshotStandby". + :vartype role: str or ~azure.mgmt.oracledatabase.models.RoleType + :ivar service_console_url: The URL of the Service Console for the Autonomous Database. + :vartype service_console_url: str + :ivar sql_web_developer_url: The SQL Web Developer URL for the Oracle Autonomous Database. + :vartype sql_web_developer_url: str + :ivar 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. + :vartype supported_regions_to_clone_to: list[str] + :ivar time_data_guard_role_changed: The date and time the Autonomous Data Guard role was + switched for the Autonomous Database. + :vartype time_data_guard_role_changed: str + :ivar time_deletion_of_free_autonomous_database: The date and time the Always Free database + will be automatically deleted because of inactivity. + :vartype time_deletion_of_free_autonomous_database: str + :ivar 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. + :vartype time_local_data_guard_enabled: str + :ivar time_of_last_failover: The timestamp of the last failover operation. + :vartype time_of_last_failover: str + :ivar time_of_last_refresh: The date and time when last refresh happened. + :vartype time_of_last_refresh: str + :ivar time_of_last_refresh_point: The refresh point timestamp (UTC). + :vartype time_of_last_refresh_point: str + :ivar time_of_last_switchover: The timestamp of the last switchover operation for the + Autonomous Database. + :vartype time_of_last_switchover: str + :ivar time_reclamation_of_free_autonomous_database: The date and time the Always Free database + will be stopped because of inactivity. + :vartype time_reclamation_of_free_autonomous_database: str + :ivar used_data_storage_size_in_gbs: The storage space consumed by Autonomous Database in GBs. + :vartype used_data_storage_size_in_gbs: int + :ivar used_data_storage_size_in_tbs: The amount of storage that has been used, in terabytes. + :vartype used_data_storage_size_in_tbs: int + :ivar ocid: Database ocid. + :vartype ocid: str + :ivar backup_retention_period_in_days: Retention period, in days, for long-term backups. + :vartype backup_retention_period_in_days: int + :ivar whitelisted_ips: The client IP access control list (ACL). This is an array of CIDR + notations and/or IP addresses. Values should be separate strings, separated by commas. Example: + ['1.1.1.1','1.1.1.0/24','1.1.2.25']. + :vartype whitelisted_ips: list[str] + """ + + _validation = { + "data_base_type": {"required": True}, + "character_set": {"max_length": 255, "min_length": 1}, + "compute_count": {"maximum": 512, "minimum": 0.1}, + "cpu_core_count": {"maximum": 128, "minimum": 1}, + "data_storage_size_in_tbs": {"maximum": 384, "minimum": 1}, + "data_storage_size_in_gbs": {"maximum": 393216, "minimum": 20}, + "db_version": {"max_length": 255, "min_length": 1}, + "display_name": {"max_length": 255, "min_length": 1}, + "peer_db_ids": {"readonly": True}, + "peer_db_id": {"max_length": 255, "min_length": 1}, + "is_remote_data_guard_enabled": {"readonly": True}, + "local_disaster_recovery_type": {"readonly": True}, + "local_standby_db": {"readonly": True}, + "failed_data_recovery_in_seconds": {"readonly": True}, + "ncharacter_set": {"max_length": 255, "min_length": 1}, + "lifecycle_details": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "lifecycle_state": {"readonly": True}, + "oci_url": {"readonly": True}, + "time_created": {"readonly": True}, + "time_maintenance_begin": {"readonly": True}, + "time_maintenance_end": {"readonly": True}, + "actual_used_data_storage_size_in_tbs": {"readonly": True}, + "allocated_storage_size_in_tbs": {"readonly": True}, + "apex_details": {"readonly": True}, + "available_upgrade_versions": {"readonly": True}, + "connection_strings": {"readonly": True}, + "connection_urls": {"readonly": True}, + "data_safe_status": {"readonly": True}, + "in_memory_area_in_gbs": {"readonly": True}, + "is_preview": {"readonly": True}, + "local_adg_auto_failover_max_data_loss_limit": {"maximum": 3600, "minimum": 0}, + "memory_per_oracle_compute_unit_in_gbs": {"readonly": True}, + "operations_insights_status": {"readonly": True}, + "private_endpoint": {"readonly": True}, + "provisionable_cpus": {"readonly": True}, + "service_console_url": {"readonly": True, "max_length": 255, "min_length": 10}, + "sql_web_developer_url": {"readonly": True, "max_length": 2048, "min_length": 10}, + "supported_regions_to_clone_to": {"readonly": True, "max_items": 50, "min_items": 0}, + "time_data_guard_role_changed": {"readonly": True}, + "time_deletion_of_free_autonomous_database": {"readonly": True}, + "time_local_data_guard_enabled": {"readonly": True}, + "time_of_last_failover": {"readonly": True}, + "time_of_last_refresh": {"readonly": True}, + "time_of_last_refresh_point": {"readonly": True}, + "time_of_last_switchover": {"readonly": True}, + "time_reclamation_of_free_autonomous_database": {"readonly": True}, + "used_data_storage_size_in_gbs": {"readonly": True}, + "used_data_storage_size_in_tbs": {"readonly": True}, + "ocid": {"readonly": True, "max_length": 255, "min_length": 1}, + } + + _attribute_map = { + "admin_password": {"key": "adminPassword", "type": "str"}, + "data_base_type": {"key": "dataBaseType", "type": "str"}, + "autonomous_maintenance_schedule_type": {"key": "autonomousMaintenanceScheduleType", "type": "str"}, + "character_set": {"key": "characterSet", "type": "str"}, + "compute_count": {"key": "computeCount", "type": "float"}, + "compute_model": {"key": "computeModel", "type": "str"}, + "cpu_core_count": {"key": "cpuCoreCount", "type": "int"}, + "customer_contacts": {"key": "customerContacts", "type": "[CustomerContact]"}, + "data_storage_size_in_tbs": {"key": "dataStorageSizeInTbs", "type": "int"}, + "data_storage_size_in_gbs": {"key": "dataStorageSizeInGbs", "type": "int"}, + "db_version": {"key": "dbVersion", "type": "str"}, + "db_workload": {"key": "dbWorkload", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "is_auto_scaling_enabled": {"key": "isAutoScalingEnabled", "type": "bool"}, + "is_auto_scaling_for_storage_enabled": {"key": "isAutoScalingForStorageEnabled", "type": "bool"}, + "peer_db_ids": {"key": "peerDbIds", "type": "[str]"}, + "peer_db_id": {"key": "peerDbId", "type": "str"}, + "is_local_data_guard_enabled": {"key": "isLocalDataGuardEnabled", "type": "bool"}, + "is_remote_data_guard_enabled": {"key": "isRemoteDataGuardEnabled", "type": "bool"}, + "local_disaster_recovery_type": {"key": "localDisasterRecoveryType", "type": "str"}, + "local_standby_db": {"key": "localStandbyDb", "type": "AutonomousDatabaseStandbySummary"}, + "failed_data_recovery_in_seconds": {"key": "failedDataRecoveryInSeconds", "type": "int"}, + "is_mtls_connection_required": {"key": "isMtlsConnectionRequired", "type": "bool"}, + "is_preview_version_with_service_terms_accepted": { + "key": "isPreviewVersionWithServiceTermsAccepted", + "type": "bool", + }, + "license_model": {"key": "licenseModel", "type": "str"}, + "ncharacter_set": {"key": "ncharacterSet", "type": "str"}, + "lifecycle_details": {"key": "lifecycleDetails", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "lifecycle_state": {"key": "lifecycleState", "type": "str"}, + "scheduled_operations": {"key": "scheduledOperations", "type": "ScheduledOperationsType"}, + "private_endpoint_ip": {"key": "privateEndpointIp", "type": "str"}, + "private_endpoint_label": {"key": "privateEndpointLabel", "type": "str"}, + "oci_url": {"key": "ociUrl", "type": "str"}, + "subnet_id": {"key": "subnetId", "type": "str"}, + "vnet_id": {"key": "vnetId", "type": "str"}, + "time_created": {"key": "timeCreated", "type": "iso-8601"}, + "time_maintenance_begin": {"key": "timeMaintenanceBegin", "type": "iso-8601"}, + "time_maintenance_end": {"key": "timeMaintenanceEnd", "type": "iso-8601"}, + "actual_used_data_storage_size_in_tbs": {"key": "actualUsedDataStorageSizeInTbs", "type": "float"}, + "allocated_storage_size_in_tbs": {"key": "allocatedStorageSizeInTbs", "type": "float"}, + "apex_details": {"key": "apexDetails", "type": "ApexDetailsType"}, + "available_upgrade_versions": {"key": "availableUpgradeVersions", "type": "[str]"}, + "connection_strings": {"key": "connectionStrings", "type": "ConnectionStringType"}, + "connection_urls": {"key": "connectionUrls", "type": "ConnectionUrlType"}, + "data_safe_status": {"key": "dataSafeStatus", "type": "str"}, + "database_edition": {"key": "databaseEdition", "type": "str"}, + "autonomous_database_id": {"key": "autonomousDatabaseId", "type": "str"}, + "in_memory_area_in_gbs": {"key": "inMemoryAreaInGbs", "type": "int"}, + "is_preview": {"key": "isPreview", "type": "bool"}, + "local_adg_auto_failover_max_data_loss_limit": {"key": "localAdgAutoFailoverMaxDataLossLimit", "type": "int"}, + "memory_per_oracle_compute_unit_in_gbs": {"key": "memoryPerOracleComputeUnitInGbs", "type": "int"}, + "open_mode": {"key": "openMode", "type": "str"}, + "operations_insights_status": {"key": "operationsInsightsStatus", "type": "str"}, + "permission_level": {"key": "permissionLevel", "type": "str"}, + "private_endpoint": {"key": "privateEndpoint", "type": "str"}, + "provisionable_cpus": {"key": "provisionableCpus", "type": "[int]"}, + "role": {"key": "role", "type": "str"}, + "service_console_url": {"key": "serviceConsoleUrl", "type": "str"}, + "sql_web_developer_url": {"key": "sqlWebDeveloperUrl", "type": "str"}, + "supported_regions_to_clone_to": {"key": "supportedRegionsToCloneTo", "type": "[str]"}, + "time_data_guard_role_changed": {"key": "timeDataGuardRoleChanged", "type": "str"}, + "time_deletion_of_free_autonomous_database": {"key": "timeDeletionOfFreeAutonomousDatabase", "type": "str"}, + "time_local_data_guard_enabled": {"key": "timeLocalDataGuardEnabled", "type": "str"}, + "time_of_last_failover": {"key": "timeOfLastFailover", "type": "str"}, + "time_of_last_refresh": {"key": "timeOfLastRefresh", "type": "str"}, + "time_of_last_refresh_point": {"key": "timeOfLastRefreshPoint", "type": "str"}, + "time_of_last_switchover": {"key": "timeOfLastSwitchover", "type": "str"}, + "time_reclamation_of_free_autonomous_database": { + "key": "timeReclamationOfFreeAutonomousDatabase", + "type": "str", + }, + "used_data_storage_size_in_gbs": {"key": "usedDataStorageSizeInGbs", "type": "int"}, + "used_data_storage_size_in_tbs": {"key": "usedDataStorageSizeInTbs", "type": "int"}, + "ocid": {"key": "ocid", "type": "str"}, + "backup_retention_period_in_days": {"key": "backupRetentionPeriodInDays", "type": "int"}, + "whitelisted_ips": {"key": "whitelistedIps", "type": "[str]"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + admin_password: Optional[str] = None, + autonomous_maintenance_schedule_type: Optional[Union[str, "_models.AutonomousMaintenanceScheduleType"]] = None, + character_set: Optional[str] = None, + compute_count: Optional[float] = None, + compute_model: Optional[Union[str, "_models.ComputeModel"]] = None, + cpu_core_count: Optional[int] = None, + customer_contacts: Optional[List["_models.CustomerContact"]] = None, + data_storage_size_in_tbs: Optional[int] = None, + data_storage_size_in_gbs: Optional[int] = None, + db_version: Optional[str] = None, + db_workload: Optional[Union[str, "_models.WorkloadType"]] = None, + display_name: Optional[str] = None, + is_auto_scaling_enabled: Optional[bool] = None, + is_auto_scaling_for_storage_enabled: Optional[bool] = None, + peer_db_id: Optional[str] = None, + is_local_data_guard_enabled: Optional[bool] = None, + is_mtls_connection_required: Optional[bool] = None, + is_preview_version_with_service_terms_accepted: Optional[bool] = None, + license_model: Optional[Union[str, "_models.LicenseModel"]] = None, + ncharacter_set: Optional[str] = None, + scheduled_operations: Optional["_models.ScheduledOperationsType"] = None, + private_endpoint_ip: Optional[str] = None, + private_endpoint_label: Optional[str] = None, + subnet_id: Optional[str] = None, + vnet_id: Optional[str] = None, + database_edition: Optional[Union[str, "_models.DatabaseEditionType"]] = None, + autonomous_database_id: Optional[str] = None, + local_adg_auto_failover_max_data_loss_limit: Optional[int] = None, + open_mode: Optional[Union[str, "_models.OpenModeType"]] = None, + permission_level: Optional[Union[str, "_models.PermissionLevelType"]] = None, + role: Optional[Union[str, "_models.RoleType"]] = None, + backup_retention_period_in_days: Optional[int] = None, + whitelisted_ips: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword admin_password: Admin password. + :paramtype admin_password: str + :keyword autonomous_maintenance_schedule_type: The maintenance schedule type of the Autonomous + Database Serverless. Known values are: "Early" and "Regular". + :paramtype autonomous_maintenance_schedule_type: str or + ~azure.mgmt.oracledatabase.models.AutonomousMaintenanceScheduleType + :keyword character_set: The character set for the autonomous database. + :paramtype character_set: str + :keyword compute_count: The compute amount (CPUs) available to the database. + :paramtype compute_count: float + :keyword compute_model: The compute model of the Autonomous Database. Known values are: "ECPU" + and "OCPU". + :paramtype compute_model: str or ~azure.mgmt.oracledatabase.models.ComputeModel + :keyword cpu_core_count: The number of CPU cores to be made available to the database. + :paramtype cpu_core_count: int + :keyword customer_contacts: Customer Contacts. + :paramtype customer_contacts: list[~azure.mgmt.oracledatabase.models.CustomerContact] + :keyword data_storage_size_in_tbs: The quantity of data in the database, in terabytes. + :paramtype data_storage_size_in_tbs: int + :keyword data_storage_size_in_gbs: The size, in gigabytes, of the data volume that will be + created and attached to the database. + :paramtype data_storage_size_in_gbs: int + :keyword db_version: A valid Oracle Database version for Autonomous Database. + :paramtype db_version: str + :keyword db_workload: The Autonomous Database workload type. Known values are: "OLTP", "DW", + "AJD", and "APEX". + :paramtype db_workload: str or ~azure.mgmt.oracledatabase.models.WorkloadType + :keyword display_name: The user-friendly name for the Autonomous Database. + :paramtype display_name: str + :keyword is_auto_scaling_enabled: Indicates if auto scaling is enabled for the Autonomous + Database CPU core count. + :paramtype is_auto_scaling_enabled: bool + :keyword is_auto_scaling_for_storage_enabled: Indicates if auto scaling is enabled for the + Autonomous Database storage. + :paramtype is_auto_scaling_for_storage_enabled: bool + :keyword peer_db_id: The database OCID of the Disaster Recovery peer database, which is located + in a different region from the current peer database. + :paramtype peer_db_id: str + :keyword is_local_data_guard_enabled: Indicates whether the Autonomous Database has local or + called in-region Data Guard enabled. + :paramtype is_local_data_guard_enabled: bool + :keyword is_mtls_connection_required: Specifies if the Autonomous Database requires mTLS + connections. + :paramtype is_mtls_connection_required: bool + :keyword is_preview_version_with_service_terms_accepted: Specifies if the Autonomous Database + preview version is being provisioned. + :paramtype is_preview_version_with_service_terms_accepted: bool + :keyword license_model: The Oracle license model that applies to the Oracle Autonomous + Database. The default is LICENSE_INCLUDED. Known values are: "LicenseIncluded" and + "BringYourOwnLicense". + :paramtype license_model: str or ~azure.mgmt.oracledatabase.models.LicenseModel + :keyword ncharacter_set: The character set for the Autonomous Database. + :paramtype ncharacter_set: str + :keyword scheduled_operations: The list of scheduled operations. + :paramtype scheduled_operations: ~azure.mgmt.oracledatabase.models.ScheduledOperationsType + :keyword private_endpoint_ip: The private endpoint Ip address for the resource. + :paramtype private_endpoint_ip: str + :keyword private_endpoint_label: The resource's private endpoint label. + :paramtype private_endpoint_label: str + :keyword subnet_id: Client subnet. + :paramtype subnet_id: str + :keyword vnet_id: VNET for network connectivity. + :paramtype vnet_id: str + :keyword database_edition: The Oracle Database Edition that applies to the Autonomous + databases. Known values are: "StandardEdition" and "EnterpriseEdition". + :paramtype database_edition: str or ~azure.mgmt.oracledatabase.models.DatabaseEditionType + :keyword autonomous_database_id: Autonomous Database ID. + :paramtype autonomous_database_id: str + :keyword 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. + :paramtype local_adg_auto_failover_max_data_loss_limit: int + :keyword open_mode: Indicates the Autonomous Database mode. Known values are: "ReadOnly" and + "ReadWrite". + :paramtype open_mode: str or ~azure.mgmt.oracledatabase.models.OpenModeType + :keyword permission_level: The Autonomous Database permission level. Known values are: + "Restricted" and "Unrestricted". + :paramtype permission_level: str or ~azure.mgmt.oracledatabase.models.PermissionLevelType + :keyword role: The Data Guard role of the Autonomous Container Database or Autonomous Database, + if Autonomous Data Guard is enabled. Known values are: "Primary", "Standby", "DisabledStandby", + "BackupCopy", and "SnapshotStandby". + :paramtype role: str or ~azure.mgmt.oracledatabase.models.RoleType + :keyword backup_retention_period_in_days: Retention period, in days, for long-term backups. + :paramtype backup_retention_period_in_days: int + :keyword whitelisted_ips: The client IP access control list (ACL). This is an array of CIDR + notations and/or IP addresses. Values should be separate strings, separated by commas. Example: + ['1.1.1.1','1.1.1.0/24','1.1.2.25']. + :paramtype whitelisted_ips: list[str] + """ + super().__init__( + admin_password=admin_password, + autonomous_maintenance_schedule_type=autonomous_maintenance_schedule_type, + character_set=character_set, + compute_count=compute_count, + compute_model=compute_model, + cpu_core_count=cpu_core_count, + customer_contacts=customer_contacts, + data_storage_size_in_tbs=data_storage_size_in_tbs, + data_storage_size_in_gbs=data_storage_size_in_gbs, + db_version=db_version, + db_workload=db_workload, + display_name=display_name, + is_auto_scaling_enabled=is_auto_scaling_enabled, + is_auto_scaling_for_storage_enabled=is_auto_scaling_for_storage_enabled, + peer_db_id=peer_db_id, + is_local_data_guard_enabled=is_local_data_guard_enabled, + is_mtls_connection_required=is_mtls_connection_required, + is_preview_version_with_service_terms_accepted=is_preview_version_with_service_terms_accepted, + license_model=license_model, + ncharacter_set=ncharacter_set, + scheduled_operations=scheduled_operations, + private_endpoint_ip=private_endpoint_ip, + private_endpoint_label=private_endpoint_label, + subnet_id=subnet_id, + vnet_id=vnet_id, + database_edition=database_edition, + autonomous_database_id=autonomous_database_id, + local_adg_auto_failover_max_data_loss_limit=local_adg_auto_failover_max_data_loss_limit, + open_mode=open_mode, + permission_level=permission_level, + role=role, + backup_retention_period_in_days=backup_retention_period_in_days, + whitelisted_ips=whitelisted_ips, + **kwargs + ) + self.data_base_type: str = "Regular" + + +class AutonomousDatabaseStandbySummary(_serialization.Model): + """Autonomous Disaster Recovery standby database details. + + :ivar lag_time_in_seconds: The amount of time, in seconds, that the data of the standby + database lags the data of the primary database. Can be used to determine the potential data + loss in the event of a failover. + :vartype lag_time_in_seconds: int + :ivar lifecycle_state: The current state of the Autonomous Database. Known values are: + "Provisioning", "Available", "Stopping", "Stopped", "Starting", "Terminating", "Terminated", + "Unavailable", "RestoreInProgress", "RestoreFailed", "BackupInProgress", "ScaleInProgress", + "AvailableNeedsAttention", "Updating", "MaintenanceInProgress", "Restarting", "Recreating", + "RoleChangeInProgress", "Upgrading", "Inaccessible", and "Standby". + :vartype lifecycle_state: str or + ~azure.mgmt.oracledatabase.models.AutonomousDatabaseLifecycleState + :ivar lifecycle_details: Additional information about the current lifecycle state. + :vartype lifecycle_details: str + :ivar time_data_guard_role_changed: The date and time the Autonomous Data Guard role was + switched for the standby Autonomous Database. + :vartype time_data_guard_role_changed: str + :ivar time_disaster_recovery_role_changed: The date and time the Disaster Recovery role was + switched for the standby Autonomous Database. + :vartype time_disaster_recovery_role_changed: str + """ + + _attribute_map = { + "lag_time_in_seconds": {"key": "lagTimeInSeconds", "type": "int"}, + "lifecycle_state": {"key": "lifecycleState", "type": "str"}, + "lifecycle_details": {"key": "lifecycleDetails", "type": "str"}, + "time_data_guard_role_changed": {"key": "timeDataGuardRoleChanged", "type": "str"}, + "time_disaster_recovery_role_changed": {"key": "timeDisasterRecoveryRoleChanged", "type": "str"}, + } + + def __init__( + self, + *, + lag_time_in_seconds: Optional[int] = None, + lifecycle_state: Optional[Union[str, "_models.AutonomousDatabaseLifecycleState"]] = None, + lifecycle_details: Optional[str] = None, + time_data_guard_role_changed: Optional[str] = None, + time_disaster_recovery_role_changed: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword lag_time_in_seconds: The amount of time, in seconds, that the data of the standby + database lags the data of the primary database. Can be used to determine the potential data + loss in the event of a failover. + :paramtype lag_time_in_seconds: int + :keyword lifecycle_state: The current state of the Autonomous Database. Known values are: + "Provisioning", "Available", "Stopping", "Stopped", "Starting", "Terminating", "Terminated", + "Unavailable", "RestoreInProgress", "RestoreFailed", "BackupInProgress", "ScaleInProgress", + "AvailableNeedsAttention", "Updating", "MaintenanceInProgress", "Restarting", "Recreating", + "RoleChangeInProgress", "Upgrading", "Inaccessible", and "Standby". + :paramtype lifecycle_state: str or + ~azure.mgmt.oracledatabase.models.AutonomousDatabaseLifecycleState + :keyword lifecycle_details: Additional information about the current lifecycle state. + :paramtype lifecycle_details: str + :keyword time_data_guard_role_changed: The date and time the Autonomous Data Guard role was + switched for the standby Autonomous Database. + :paramtype time_data_guard_role_changed: str + :keyword time_disaster_recovery_role_changed: The date and time the Disaster Recovery role was + switched for the standby Autonomous Database. + :paramtype time_disaster_recovery_role_changed: str + """ + super().__init__(**kwargs) + self.lag_time_in_seconds = lag_time_in_seconds + self.lifecycle_state = lifecycle_state + self.lifecycle_details = lifecycle_details + self.time_data_guard_role_changed = time_data_guard_role_changed + self.time_disaster_recovery_role_changed = time_disaster_recovery_role_changed + + +class AutonomousDatabaseUpdate(_serialization.Model): + """The type used for update operations of the AutonomousDatabase. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: The updatable properties of the AutonomousDatabase. + :vartype properties: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseUpdateProperties + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "AutonomousDatabaseUpdateProperties"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.AutonomousDatabaseUpdateProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: The updatable properties of the AutonomousDatabase. + :paramtype properties: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseUpdateProperties + """ + super().__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class AutonomousDatabaseUpdateProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """The updatable properties of the AutonomousDatabase. + + :ivar admin_password: Admin password. + :vartype admin_password: str + :ivar autonomous_maintenance_schedule_type: The maintenance schedule type of the Autonomous + Database Serverless. Known values are: "Early" and "Regular". + :vartype autonomous_maintenance_schedule_type: str or + ~azure.mgmt.oracledatabase.models.AutonomousMaintenanceScheduleType + :ivar compute_count: The compute amount (CPUs) available to the database. + :vartype compute_count: float + :ivar cpu_core_count: The number of CPU cores to be made available to the database. + :vartype cpu_core_count: int + :ivar customer_contacts: Customer Contacts. + :vartype customer_contacts: list[~azure.mgmt.oracledatabase.models.CustomerContact] + :ivar data_storage_size_in_tbs: The quantity of data in the database, in terabytes. + :vartype data_storage_size_in_tbs: int + :ivar data_storage_size_in_gbs: The size, in gigabytes, of the data volume that will be created + and attached to the database. + :vartype data_storage_size_in_gbs: int + :ivar display_name: The user-friendly name for the Autonomous Database. + :vartype display_name: str + :ivar is_auto_scaling_enabled: Indicates if auto scaling is enabled for the Autonomous Database + CPU core count. + :vartype is_auto_scaling_enabled: bool + :ivar is_auto_scaling_for_storage_enabled: Indicates if auto scaling is enabled for the + Autonomous Database storage. + :vartype is_auto_scaling_for_storage_enabled: bool + :ivar peer_db_id: The database OCID of the Disaster Recovery peer database, which is located in + a different region from the current peer database. + :vartype peer_db_id: str + :ivar is_local_data_guard_enabled: Indicates whether the Autonomous Database has local or + called in-region Data Guard enabled. + :vartype is_local_data_guard_enabled: bool + :ivar is_mtls_connection_required: Specifies if the Autonomous Database requires mTLS + connections. + :vartype is_mtls_connection_required: bool + :ivar license_model: The Oracle license model that applies to the Oracle Autonomous Database. + The default is LICENSE_INCLUDED. Known values are: "LicenseIncluded" and "BringYourOwnLicense". + :vartype license_model: str or ~azure.mgmt.oracledatabase.models.LicenseModel + :ivar scheduled_operations: The list of scheduled operations. + :vartype scheduled_operations: ~azure.mgmt.oracledatabase.models.ScheduledOperationsTypeUpdate + :ivar database_edition: The Oracle Database Edition that applies to the Autonomous databases. + Known values are: "StandardEdition" and "EnterpriseEdition". + :vartype database_edition: str or ~azure.mgmt.oracledatabase.models.DatabaseEditionType + :ivar 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. + :vartype local_adg_auto_failover_max_data_loss_limit: int + :ivar open_mode: Indicates the Autonomous Database mode. Known values are: "ReadOnly" and + "ReadWrite". + :vartype open_mode: str or ~azure.mgmt.oracledatabase.models.OpenModeType + :ivar permission_level: The Autonomous Database permission level. Known values are: + "Restricted" and "Unrestricted". + :vartype permission_level: str or ~azure.mgmt.oracledatabase.models.PermissionLevelType + :ivar role: The Data Guard role of the Autonomous Container Database or Autonomous Database, if + Autonomous Data Guard is enabled. Known values are: "Primary", "Standby", "DisabledStandby", + "BackupCopy", and "SnapshotStandby". + :vartype role: str or ~azure.mgmt.oracledatabase.models.RoleType + :ivar backup_retention_period_in_days: Retention period, in days, for long-term backups. + :vartype backup_retention_period_in_days: int + :ivar whitelisted_ips: The client IP access control list (ACL). This is an array of CIDR + notations and/or IP addresses. Values should be separate strings, separated by commas. Example: + ['1.1.1.1','1.1.1.0/24','1.1.2.25']. + :vartype whitelisted_ips: list[str] + """ + + _validation = { + "compute_count": {"maximum": 512, "minimum": 0.1}, + "cpu_core_count": {"maximum": 128, "minimum": 1}, + "data_storage_size_in_tbs": {"maximum": 384, "minimum": 1}, + "data_storage_size_in_gbs": {"maximum": 393216, "minimum": 20}, + "display_name": {"max_length": 255, "min_length": 1}, + "peer_db_id": {"max_length": 255, "min_length": 1}, + "local_adg_auto_failover_max_data_loss_limit": {"maximum": 3600, "minimum": 0}, + } + + _attribute_map = { + "admin_password": {"key": "adminPassword", "type": "str"}, + "autonomous_maintenance_schedule_type": {"key": "autonomousMaintenanceScheduleType", "type": "str"}, + "compute_count": {"key": "computeCount", "type": "float"}, + "cpu_core_count": {"key": "cpuCoreCount", "type": "int"}, + "customer_contacts": {"key": "customerContacts", "type": "[CustomerContact]"}, + "data_storage_size_in_tbs": {"key": "dataStorageSizeInTbs", "type": "int"}, + "data_storage_size_in_gbs": {"key": "dataStorageSizeInGbs", "type": "int"}, + "display_name": {"key": "displayName", "type": "str"}, + "is_auto_scaling_enabled": {"key": "isAutoScalingEnabled", "type": "bool"}, + "is_auto_scaling_for_storage_enabled": {"key": "isAutoScalingForStorageEnabled", "type": "bool"}, + "peer_db_id": {"key": "peerDbId", "type": "str"}, + "is_local_data_guard_enabled": {"key": "isLocalDataGuardEnabled", "type": "bool"}, + "is_mtls_connection_required": {"key": "isMtlsConnectionRequired", "type": "bool"}, + "license_model": {"key": "licenseModel", "type": "str"}, + "scheduled_operations": {"key": "scheduledOperations", "type": "ScheduledOperationsTypeUpdate"}, + "database_edition": {"key": "databaseEdition", "type": "str"}, + "local_adg_auto_failover_max_data_loss_limit": {"key": "localAdgAutoFailoverMaxDataLossLimit", "type": "int"}, + "open_mode": {"key": "openMode", "type": "str"}, + "permission_level": {"key": "permissionLevel", "type": "str"}, + "role": {"key": "role", "type": "str"}, + "backup_retention_period_in_days": {"key": "backupRetentionPeriodInDays", "type": "int"}, + "whitelisted_ips": {"key": "whitelistedIps", "type": "[str]"}, + } + + def __init__( + self, + *, + admin_password: Optional[str] = None, + autonomous_maintenance_schedule_type: Optional[Union[str, "_models.AutonomousMaintenanceScheduleType"]] = None, + compute_count: Optional[float] = None, + cpu_core_count: Optional[int] = None, + customer_contacts: Optional[List["_models.CustomerContact"]] = None, + data_storage_size_in_tbs: Optional[int] = None, + data_storage_size_in_gbs: Optional[int] = None, + display_name: Optional[str] = None, + is_auto_scaling_enabled: Optional[bool] = None, + is_auto_scaling_for_storage_enabled: Optional[bool] = None, + peer_db_id: Optional[str] = None, + is_local_data_guard_enabled: Optional[bool] = None, + is_mtls_connection_required: Optional[bool] = None, + license_model: Optional[Union[str, "_models.LicenseModel"]] = None, + scheduled_operations: Optional["_models.ScheduledOperationsTypeUpdate"] = None, + database_edition: Optional[Union[str, "_models.DatabaseEditionType"]] = None, + local_adg_auto_failover_max_data_loss_limit: Optional[int] = None, + open_mode: Optional[Union[str, "_models.OpenModeType"]] = None, + permission_level: Optional[Union[str, "_models.PermissionLevelType"]] = None, + role: Optional[Union[str, "_models.RoleType"]] = None, + backup_retention_period_in_days: Optional[int] = None, + whitelisted_ips: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword admin_password: Admin password. + :paramtype admin_password: str + :keyword autonomous_maintenance_schedule_type: The maintenance schedule type of the Autonomous + Database Serverless. Known values are: "Early" and "Regular". + :paramtype autonomous_maintenance_schedule_type: str or + ~azure.mgmt.oracledatabase.models.AutonomousMaintenanceScheduleType + :keyword compute_count: The compute amount (CPUs) available to the database. + :paramtype compute_count: float + :keyword cpu_core_count: The number of CPU cores to be made available to the database. + :paramtype cpu_core_count: int + :keyword customer_contacts: Customer Contacts. + :paramtype customer_contacts: list[~azure.mgmt.oracledatabase.models.CustomerContact] + :keyword data_storage_size_in_tbs: The quantity of data in the database, in terabytes. + :paramtype data_storage_size_in_tbs: int + :keyword data_storage_size_in_gbs: The size, in gigabytes, of the data volume that will be + created and attached to the database. + :paramtype data_storage_size_in_gbs: int + :keyword display_name: The user-friendly name for the Autonomous Database. + :paramtype display_name: str + :keyword is_auto_scaling_enabled: Indicates if auto scaling is enabled for the Autonomous + Database CPU core count. + :paramtype is_auto_scaling_enabled: bool + :keyword is_auto_scaling_for_storage_enabled: Indicates if auto scaling is enabled for the + Autonomous Database storage. + :paramtype is_auto_scaling_for_storage_enabled: bool + :keyword peer_db_id: The database OCID of the Disaster Recovery peer database, which is located + in a different region from the current peer database. + :paramtype peer_db_id: str + :keyword is_local_data_guard_enabled: Indicates whether the Autonomous Database has local or + called in-region Data Guard enabled. + :paramtype is_local_data_guard_enabled: bool + :keyword is_mtls_connection_required: Specifies if the Autonomous Database requires mTLS + connections. + :paramtype is_mtls_connection_required: bool + :keyword license_model: The Oracle license model that applies to the Oracle Autonomous + Database. The default is LICENSE_INCLUDED. Known values are: "LicenseIncluded" and + "BringYourOwnLicense". + :paramtype license_model: str or ~azure.mgmt.oracledatabase.models.LicenseModel + :keyword scheduled_operations: The list of scheduled operations. + :paramtype scheduled_operations: + ~azure.mgmt.oracledatabase.models.ScheduledOperationsTypeUpdate + :keyword database_edition: The Oracle Database Edition that applies to the Autonomous + databases. Known values are: "StandardEdition" and "EnterpriseEdition". + :paramtype database_edition: str or ~azure.mgmt.oracledatabase.models.DatabaseEditionType + :keyword 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. + :paramtype local_adg_auto_failover_max_data_loss_limit: int + :keyword open_mode: Indicates the Autonomous Database mode. Known values are: "ReadOnly" and + "ReadWrite". + :paramtype open_mode: str or ~azure.mgmt.oracledatabase.models.OpenModeType + :keyword permission_level: The Autonomous Database permission level. Known values are: + "Restricted" and "Unrestricted". + :paramtype permission_level: str or ~azure.mgmt.oracledatabase.models.PermissionLevelType + :keyword role: The Data Guard role of the Autonomous Container Database or Autonomous Database, + if Autonomous Data Guard is enabled. Known values are: "Primary", "Standby", "DisabledStandby", + "BackupCopy", and "SnapshotStandby". + :paramtype role: str or ~azure.mgmt.oracledatabase.models.RoleType + :keyword backup_retention_period_in_days: Retention period, in days, for long-term backups. + :paramtype backup_retention_period_in_days: int + :keyword whitelisted_ips: The client IP access control list (ACL). This is an array of CIDR + notations and/or IP addresses. Values should be separate strings, separated by commas. Example: + ['1.1.1.1','1.1.1.0/24','1.1.2.25']. + :paramtype whitelisted_ips: list[str] + """ + super().__init__(**kwargs) + self.admin_password = admin_password + self.autonomous_maintenance_schedule_type = autonomous_maintenance_schedule_type + self.compute_count = compute_count + self.cpu_core_count = cpu_core_count + self.customer_contacts = customer_contacts + self.data_storage_size_in_tbs = data_storage_size_in_tbs + self.data_storage_size_in_gbs = data_storage_size_in_gbs + self.display_name = display_name + self.is_auto_scaling_enabled = is_auto_scaling_enabled + self.is_auto_scaling_for_storage_enabled = is_auto_scaling_for_storage_enabled + self.peer_db_id = peer_db_id + self.is_local_data_guard_enabled = is_local_data_guard_enabled + self.is_mtls_connection_required = is_mtls_connection_required + self.license_model = license_model + self.scheduled_operations = scheduled_operations + self.database_edition = database_edition + self.local_adg_auto_failover_max_data_loss_limit = local_adg_auto_failover_max_data_loss_limit + self.open_mode = open_mode + self.permission_level = permission_level + self.role = role + self.backup_retention_period_in_days = backup_retention_period_in_days + self.whitelisted_ips = whitelisted_ips + + +class AutonomousDatabaseWalletFile(_serialization.Model): + """Autonomous Database Wallet File resource model. + + All required parameters must be populated in order to send to server. + + :ivar wallet_files: The base64 encoded wallet files. Required. + :vartype wallet_files: str + """ + + _validation = { + "wallet_files": {"required": True}, + } + + _attribute_map = { + "wallet_files": {"key": "walletFiles", "type": "str"}, + } + + def __init__(self, *, wallet_files: str, **kwargs: Any) -> None: + """ + :keyword wallet_files: The base64 encoded wallet files. Required. + :paramtype wallet_files: str + """ + super().__init__(**kwargs) + self.wallet_files = wallet_files + + +class AutonomousDbVersion(ProxyResource): + """AutonomousDbVersion resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.oracledatabase.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.oracledatabase.models.AutonomousDbVersionProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "AutonomousDbVersionProperties"}, + } + + def __init__(self, *, properties: Optional["_models.AutonomousDbVersionProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.oracledatabase.models.AutonomousDbVersionProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class AutonomousDbVersionListResult(_serialization.Model): + """The response of a AutonomousDbVersion list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: The AutonomousDbVersion items on this page. Required. + :vartype value: list[~azure.mgmt.oracledatabase.models.AutonomousDbVersion] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AutonomousDbVersion]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.AutonomousDbVersion"], **kwargs: Any) -> None: + """ + :keyword value: The AutonomousDbVersion items on this page. Required. + :paramtype value: list[~azure.mgmt.oracledatabase.models.AutonomousDbVersion] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class AutonomousDbVersionProperties(_serialization.Model): + """AutonomousDbVersion resource model. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar version: Supported Autonomous Db versions. Required. + :vartype version: str + :ivar db_workload: The Autonomous Database workload type. Known values are: "OLTP", "DW", + "AJD", and "APEX". + :vartype db_workload: str or ~azure.mgmt.oracledatabase.models.WorkloadType + :ivar is_default_for_free: True if this version of the Oracle Database software's default is + free. + :vartype is_default_for_free: bool + :ivar is_default_for_paid: True if this version of the Oracle Database software's default is + paid. + :vartype is_default_for_paid: bool + :ivar is_free_tier_enabled: True if this version of the Oracle Database software can be used + for Always-Free Autonomous Databases. + :vartype is_free_tier_enabled: bool + :ivar is_paid_enabled: True if this version of the Oracle Database software has payments + enabled. + :vartype is_paid_enabled: bool + """ + + _validation = { + "version": {"required": True, "readonly": True, "max_length": 255, "min_length": 1}, + "db_workload": {"readonly": True}, + "is_default_for_free": {"readonly": True}, + "is_default_for_paid": {"readonly": True}, + "is_free_tier_enabled": {"readonly": True}, + "is_paid_enabled": {"readonly": True}, + } + + _attribute_map = { + "version": {"key": "version", "type": "str"}, + "db_workload": {"key": "dbWorkload", "type": "str"}, + "is_default_for_free": {"key": "isDefaultForFree", "type": "bool"}, + "is_default_for_paid": {"key": "isDefaultForPaid", "type": "bool"}, + "is_free_tier_enabled": {"key": "isFreeTierEnabled", "type": "bool"}, + "is_paid_enabled": {"key": "isPaidEnabled", "type": "bool"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.version = None + self.db_workload = None + self.is_default_for_free = None + self.is_default_for_paid = None + self.is_free_tier_enabled = None + self.is_paid_enabled = None + + +class CloudAccountDetails(_serialization.Model): + """Cloud Account Details model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cloud_account_name: Cloud Account name. + :vartype cloud_account_name: str + :ivar cloud_account_home_region: Cloud Account Home region. + :vartype cloud_account_home_region: str + """ + + _validation = { + "cloud_account_name": {"readonly": True}, + "cloud_account_home_region": {"readonly": True}, + } + + _attribute_map = { + "cloud_account_name": {"key": "cloudAccountName", "type": "str"}, + "cloud_account_home_region": {"key": "cloudAccountHomeRegion", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.cloud_account_name = None + self.cloud_account_home_region = None + + +class CloudExadataInfrastructure(TrackedResource): + """CloudExadataInfrastructure resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.oracledatabase.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.oracledatabase.models.CloudExadataInfrastructureProperties + :ivar zones: CloudExadataInfrastructure zones. Required. + :vartype zones: list[str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "zones": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "CloudExadataInfrastructureProperties"}, + "zones": {"key": "zones", "type": "[str]"}, + } + + def __init__( + self, + *, + location: str, + zones: List[str], + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.CloudExadataInfrastructureProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.oracledatabase.models.CloudExadataInfrastructureProperties + :keyword zones: CloudExadataInfrastructure zones. Required. + :paramtype zones: list[str] + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + self.zones = zones + + +class CloudExadataInfrastructureListResult(_serialization.Model): + """The response of a CloudExadataInfrastructure list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: The CloudExadataInfrastructure items on this page. Required. + :vartype value: list[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[CloudExadataInfrastructure]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.CloudExadataInfrastructure"], **kwargs: Any) -> None: + """ + :keyword value: The CloudExadataInfrastructure items on this page. Required. + :paramtype value: list[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class CloudExadataInfrastructureProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """CloudExadataInfrastructure resource model. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar ocid: Exadata infra ocid. + :vartype ocid: str + :ivar compute_count: The number of compute servers for the cloud Exadata infrastructure. + :vartype compute_count: int + :ivar storage_count: The number of storage servers for the cloud Exadata infrastructure. + :vartype storage_count: int + :ivar total_storage_size_in_gbs: The total storage allocated to the cloud Exadata + infrastructure resource, in gigabytes (GB). + :vartype total_storage_size_in_gbs: int + :ivar available_storage_size_in_gbs: The available storage can be allocated to the cloud + Exadata infrastructure resource, in gigabytes (GB). + :vartype available_storage_size_in_gbs: int + :ivar time_created: The date and time the cloud Exadata infrastructure resource was created. + :vartype time_created: str + :ivar lifecycle_details: Additional information about the current lifecycle state. + :vartype lifecycle_details: str + :ivar maintenance_window: maintenanceWindow property. + :vartype maintenance_window: ~azure.mgmt.oracledatabase.models.MaintenanceWindow + :ivar estimated_patching_time: The estimated total time required in minutes for all patching + operations (database server, storage server, and network switch patching). + :vartype estimated_patching_time: ~azure.mgmt.oracledatabase.models.EstimatedPatchingTime + :ivar customer_contacts: The list of customer email addresses that receive information from + Oracle about the specified OCI Database service resource. Oracle uses these email addresses to + send notifications about planned and unplanned software maintenance updates, information about + system hardware, and other information needed by administrators. Up to 10 email addresses can + be added to the customer contacts for a cloud Exadata infrastructure instance. + :vartype customer_contacts: list[~azure.mgmt.oracledatabase.models.CustomerContact] + :ivar provisioning_state: CloudExadataInfrastructure provisioning state. Known values are: + "Succeeded", "Failed", "Canceled", and "Provisioning". + :vartype provisioning_state: str or + ~azure.mgmt.oracledatabase.models.AzureResourceProvisioningState + :ivar lifecycle_state: CloudExadataInfrastructure lifecycle state. Known values are: + "Provisioning", "Available", "Updating", "Terminating", "Terminated", "MaintenanceInProgress", + and "Failed". + :vartype lifecycle_state: str or + ~azure.mgmt.oracledatabase.models.CloudExadataInfrastructureLifecycleState + :ivar shape: The model name of the cloud Exadata infrastructure resource. Required. + :vartype shape: str + :ivar oci_url: HTTPS link to OCI resources exposed to Azure Customer via Azure Interface. + :vartype oci_url: str + :ivar cpu_count: The total number of CPU cores allocated. + :vartype cpu_count: int + :ivar max_cpu_count: The total number of CPU cores available. + :vartype max_cpu_count: int + :ivar memory_size_in_gbs: The memory allocated in GBs. + :vartype memory_size_in_gbs: int + :ivar max_memory_in_gbs: The total memory available in GBs. + :vartype max_memory_in_gbs: int + :ivar db_node_storage_size_in_gbs: The local node storage to be allocated in GBs. + :vartype db_node_storage_size_in_gbs: int + :ivar max_db_node_storage_size_in_gbs: The total local node storage available in GBs. + :vartype max_db_node_storage_size_in_gbs: int + :ivar data_storage_size_in_tbs: The quantity of data in the database, in terabytes. + :vartype data_storage_size_in_tbs: int + :ivar max_data_storage_in_tbs: The total available DATA disk group size. + :vartype max_data_storage_in_tbs: float + :ivar db_server_version: The software version of the database servers (dom0) in the Exadata + infrastructure. + :vartype db_server_version: str + :ivar storage_server_version: The software version of the storage servers (cells) in the + Exadata infrastructure. + :vartype storage_server_version: str + :ivar activated_storage_count: The requested number of additional storage servers activated for + the Exadata infrastructure. + :vartype activated_storage_count: int + :ivar additional_storage_count: The requested number of additional storage servers for the + Exadata infrastructure. + :vartype additional_storage_count: int + :ivar display_name: The name for the Exadata infrastructure. Required. + :vartype display_name: str + :ivar last_maintenance_run_id: The OCID of the last maintenance run. + :vartype last_maintenance_run_id: str + :ivar next_maintenance_run_id: The OCID of the next maintenance run. + :vartype next_maintenance_run_id: str + :ivar monthly_db_server_version: Monthly Db Server version. + :vartype monthly_db_server_version: str + :ivar monthly_storage_server_version: Monthly Storage Server version. + :vartype monthly_storage_server_version: str + """ + + _validation = { + "ocid": {"readonly": True, "max_length": 255, "min_length": 1}, + "total_storage_size_in_gbs": {"readonly": True}, + "available_storage_size_in_gbs": {"readonly": True}, + "time_created": {"readonly": True}, + "lifecycle_details": {"readonly": True}, + "estimated_patching_time": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "lifecycle_state": {"readonly": True}, + "shape": {"required": True}, + "oci_url": {"readonly": True}, + "cpu_count": {"readonly": True}, + "max_cpu_count": {"readonly": True}, + "memory_size_in_gbs": {"readonly": True}, + "max_memory_in_gbs": {"readonly": True}, + "db_node_storage_size_in_gbs": {"readonly": True}, + "max_db_node_storage_size_in_gbs": {"readonly": True}, + "data_storage_size_in_tbs": {"readonly": True}, + "max_data_storage_in_tbs": {"readonly": True}, + "db_server_version": {"readonly": True}, + "storage_server_version": {"readonly": True}, + "activated_storage_count": {"readonly": True}, + "additional_storage_count": {"readonly": True}, + "display_name": {"required": True, "max_length": 255, "min_length": 1}, + "last_maintenance_run_id": {"readonly": True, "max_length": 255, "min_length": 1}, + "next_maintenance_run_id": {"readonly": True, "max_length": 255, "min_length": 1}, + "monthly_db_server_version": {"readonly": True}, + "monthly_storage_server_version": {"readonly": True}, + } + + _attribute_map = { + "ocid": {"key": "ocid", "type": "str"}, + "compute_count": {"key": "computeCount", "type": "int"}, + "storage_count": {"key": "storageCount", "type": "int"}, + "total_storage_size_in_gbs": {"key": "totalStorageSizeInGbs", "type": "int"}, + "available_storage_size_in_gbs": {"key": "availableStorageSizeInGbs", "type": "int"}, + "time_created": {"key": "timeCreated", "type": "str"}, + "lifecycle_details": {"key": "lifecycleDetails", "type": "str"}, + "maintenance_window": {"key": "maintenanceWindow", "type": "MaintenanceWindow"}, + "estimated_patching_time": {"key": "estimatedPatchingTime", "type": "EstimatedPatchingTime"}, + "customer_contacts": {"key": "customerContacts", "type": "[CustomerContact]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "lifecycle_state": {"key": "lifecycleState", "type": "str"}, + "shape": {"key": "shape", "type": "str"}, + "oci_url": {"key": "ociUrl", "type": "str"}, + "cpu_count": {"key": "cpuCount", "type": "int"}, + "max_cpu_count": {"key": "maxCpuCount", "type": "int"}, + "memory_size_in_gbs": {"key": "memorySizeInGbs", "type": "int"}, + "max_memory_in_gbs": {"key": "maxMemoryInGbs", "type": "int"}, + "db_node_storage_size_in_gbs": {"key": "dbNodeStorageSizeInGbs", "type": "int"}, + "max_db_node_storage_size_in_gbs": {"key": "maxDbNodeStorageSizeInGbs", "type": "int"}, + "data_storage_size_in_tbs": {"key": "dataStorageSizeInTbs", "type": "int"}, + "max_data_storage_in_tbs": {"key": "maxDataStorageInTbs", "type": "float"}, + "db_server_version": {"key": "dbServerVersion", "type": "str"}, + "storage_server_version": {"key": "storageServerVersion", "type": "str"}, + "activated_storage_count": {"key": "activatedStorageCount", "type": "int"}, + "additional_storage_count": {"key": "additionalStorageCount", "type": "int"}, + "display_name": {"key": "displayName", "type": "str"}, + "last_maintenance_run_id": {"key": "lastMaintenanceRunId", "type": "str"}, + "next_maintenance_run_id": {"key": "nextMaintenanceRunId", "type": "str"}, + "monthly_db_server_version": {"key": "monthlyDbServerVersion", "type": "str"}, + "monthly_storage_server_version": {"key": "monthlyStorageServerVersion", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + shape: str, + display_name: str, + compute_count: Optional[int] = None, + storage_count: Optional[int] = None, + maintenance_window: Optional["_models.MaintenanceWindow"] = None, + customer_contacts: Optional[List["_models.CustomerContact"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword compute_count: The number of compute servers for the cloud Exadata infrastructure. + :paramtype compute_count: int + :keyword storage_count: The number of storage servers for the cloud Exadata infrastructure. + :paramtype storage_count: int + :keyword maintenance_window: maintenanceWindow property. + :paramtype maintenance_window: ~azure.mgmt.oracledatabase.models.MaintenanceWindow + :keyword customer_contacts: The list of customer email addresses that receive information from + Oracle about the specified OCI Database service resource. Oracle uses these email addresses to + send notifications about planned and unplanned software maintenance updates, information about + system hardware, and other information needed by administrators. Up to 10 email addresses can + be added to the customer contacts for a cloud Exadata infrastructure instance. + :paramtype customer_contacts: list[~azure.mgmt.oracledatabase.models.CustomerContact] + :keyword shape: The model name of the cloud Exadata infrastructure resource. Required. + :paramtype shape: str + :keyword display_name: The name for the Exadata infrastructure. Required. + :paramtype display_name: str + """ + super().__init__(**kwargs) + self.ocid = None + self.compute_count = compute_count + self.storage_count = storage_count + self.total_storage_size_in_gbs = None + self.available_storage_size_in_gbs = None + self.time_created = None + self.lifecycle_details = None + self.maintenance_window = maintenance_window + self.estimated_patching_time = None + self.customer_contacts = customer_contacts + self.provisioning_state = None + self.lifecycle_state = None + self.shape = shape + self.oci_url = None + self.cpu_count = None + self.max_cpu_count = None + self.memory_size_in_gbs = None + self.max_memory_in_gbs = None + self.db_node_storage_size_in_gbs = None + self.max_db_node_storage_size_in_gbs = None + self.data_storage_size_in_tbs = None + self.max_data_storage_in_tbs = None + self.db_server_version = None + self.storage_server_version = None + self.activated_storage_count = None + self.additional_storage_count = None + self.display_name = display_name + self.last_maintenance_run_id = None + self.next_maintenance_run_id = None + self.monthly_db_server_version = None + self.monthly_storage_server_version = None + + +class CloudExadataInfrastructureUpdate(_serialization.Model): + """The type used for update operations of the CloudExadataInfrastructure. + + :ivar zones: CloudExadataInfrastructure zones. + :vartype zones: list[str] + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: The updatable properties of the CloudExadataInfrastructure. + :vartype properties: + ~azure.mgmt.oracledatabase.models.CloudExadataInfrastructureUpdateProperties + """ + + _attribute_map = { + "zones": {"key": "zones", "type": "[str]"}, + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "CloudExadataInfrastructureUpdateProperties"}, + } + + def __init__( + self, + *, + zones: Optional[List[str]] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.CloudExadataInfrastructureUpdateProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword zones: CloudExadataInfrastructure zones. + :paramtype zones: list[str] + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: The updatable properties of the CloudExadataInfrastructure. + :paramtype properties: + ~azure.mgmt.oracledatabase.models.CloudExadataInfrastructureUpdateProperties + """ + super().__init__(**kwargs) + self.zones = zones + self.tags = tags + self.properties = properties + + +class CloudExadataInfrastructureUpdateProperties(_serialization.Model): # pylint: disable=name-too-long + """The updatable properties of the CloudExadataInfrastructure. + + :ivar compute_count: The number of compute servers for the cloud Exadata infrastructure. + :vartype compute_count: int + :ivar storage_count: The number of storage servers for the cloud Exadata infrastructure. + :vartype storage_count: int + :ivar maintenance_window: maintenanceWindow property. + :vartype maintenance_window: ~azure.mgmt.oracledatabase.models.MaintenanceWindow + :ivar customer_contacts: The list of customer email addresses that receive information from + Oracle about the specified OCI Database service resource. Oracle uses these email addresses to + send notifications about planned and unplanned software maintenance updates, information about + system hardware, and other information needed by administrators. Up to 10 email addresses can + be added to the customer contacts for a cloud Exadata infrastructure instance. + :vartype customer_contacts: list[~azure.mgmt.oracledatabase.models.CustomerContact] + :ivar display_name: The name for the Exadata infrastructure. + :vartype display_name: str + """ + + _validation = { + "display_name": {"max_length": 255, "min_length": 1}, + } + + _attribute_map = { + "compute_count": {"key": "computeCount", "type": "int"}, + "storage_count": {"key": "storageCount", "type": "int"}, + "maintenance_window": {"key": "maintenanceWindow", "type": "MaintenanceWindow"}, + "customer_contacts": {"key": "customerContacts", "type": "[CustomerContact]"}, + "display_name": {"key": "displayName", "type": "str"}, + } + + def __init__( + self, + *, + compute_count: Optional[int] = None, + storage_count: Optional[int] = None, + maintenance_window: Optional["_models.MaintenanceWindow"] = None, + customer_contacts: Optional[List["_models.CustomerContact"]] = None, + display_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword compute_count: The number of compute servers for the cloud Exadata infrastructure. + :paramtype compute_count: int + :keyword storage_count: The number of storage servers for the cloud Exadata infrastructure. + :paramtype storage_count: int + :keyword maintenance_window: maintenanceWindow property. + :paramtype maintenance_window: ~azure.mgmt.oracledatabase.models.MaintenanceWindow + :keyword customer_contacts: The list of customer email addresses that receive information from + Oracle about the specified OCI Database service resource. Oracle uses these email addresses to + send notifications about planned and unplanned software maintenance updates, information about + system hardware, and other information needed by administrators. Up to 10 email addresses can + be added to the customer contacts for a cloud Exadata infrastructure instance. + :paramtype customer_contacts: list[~azure.mgmt.oracledatabase.models.CustomerContact] + :keyword display_name: The name for the Exadata infrastructure. + :paramtype display_name: str + """ + super().__init__(**kwargs) + self.compute_count = compute_count + self.storage_count = storage_count + self.maintenance_window = maintenance_window + self.customer_contacts = customer_contacts + self.display_name = display_name + + +class CloudVmCluster(TrackedResource): + """CloudVmCluster resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.oracledatabase.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.oracledatabase.models.CloudVmClusterProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "CloudVmClusterProperties"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.CloudVmClusterProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.oracledatabase.models.CloudVmClusterProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class CloudVmClusterListResult(_serialization.Model): + """The response of a CloudVmCluster list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: The CloudVmCluster items on this page. Required. + :vartype value: list[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[CloudVmCluster]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.CloudVmCluster"], **kwargs: Any) -> None: + """ + :keyword value: The CloudVmCluster items on this page. Required. + :paramtype value: list[~azure.mgmt.oracledatabase.models.CloudVmCluster] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class CloudVmClusterProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """CloudVmCluster resource model. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar ocid: Cloud VM Cluster ocid. + :vartype ocid: str + :ivar listener_port: The port number configured for the listener on the cloud VM cluster. + :vartype listener_port: int + :ivar node_count: The number of nodes in the cloud VM cluster. + :vartype node_count: int + :ivar storage_size_in_gbs: The data disk group size to be allocated in GBs per VM. + :vartype storage_size_in_gbs: int + :ivar data_storage_size_in_tbs: The data disk group size to be allocated in TBs. + :vartype data_storage_size_in_tbs: float + :ivar db_node_storage_size_in_gbs: The local node storage to be allocated in GBs. + :vartype db_node_storage_size_in_gbs: int + :ivar memory_size_in_gbs: The memory to be allocated in GBs. + :vartype memory_size_in_gbs: int + :ivar time_created: The date and time that the cloud VM cluster was created. + :vartype time_created: ~datetime.datetime + :ivar lifecycle_details: Additional information about the current lifecycle state. + :vartype lifecycle_details: str + :ivar time_zone: The time zone of the cloud VM cluster. For details, see `Exadata + Infrastructure Time Zones `_. + :vartype time_zone: str + :ivar zone_id: The OCID of the zone the cloud VM cluster is associated with. + :vartype zone_id: str + :ivar hostname: The hostname for the cloud VM cluster. Required. + :vartype hostname: str + :ivar domain: The domain name for the cloud VM cluster. + :vartype domain: str + :ivar cpu_core_count: The number of CPU cores enabled on the cloud VM cluster. Required. + :vartype cpu_core_count: int + :ivar ocpu_count: The number of OCPU cores to enable on the cloud VM cluster. Only 1 decimal + place is allowed for the fractional part. + :vartype ocpu_count: float + :ivar cluster_name: The cluster name for cloud VM cluster. The cluster name must begin with an + alphabetic character, and may contain hyphens (-). Underscores (_) are not permitted. The + cluster name can be no longer than 11 characters and is not case sensitive. + :vartype cluster_name: str + :ivar 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 + `_ in the Exadata documentation for details + on the impact of the configuration settings on storage. + :vartype data_storage_percentage: int + :ivar 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. + :vartype is_local_backup_enabled: bool + :ivar cloud_exadata_infrastructure_id: Cloud Exadata Infrastructure ID. Required. + :vartype cloud_exadata_infrastructure_id: str + :ivar is_sparse_diskgroup_enabled: If true, sparse disk group is configured for the cloud VM + cluster. If false, sparse disk group is not created. + :vartype is_sparse_diskgroup_enabled: bool + :ivar system_version: Operating system version of the image. + :vartype system_version: str + :ivar ssh_public_keys: The public key portion of one or more key pairs used for SSH access to + the cloud VM cluster. Required. + :vartype ssh_public_keys: list[str] + :ivar license_model: The Oracle license model that applies to the cloud VM cluster. The default + is LICENSE_INCLUDED. Known values are: "LicenseIncluded" and "BringYourOwnLicense". + :vartype license_model: str or ~azure.mgmt.oracledatabase.models.LicenseModel + :ivar disk_redundancy: The type of redundancy configured for the cloud Vm cluster. NORMAL is + 2-way redundancy. HIGH is 3-way redundancy. Known values are: "High" and "Normal". + :vartype disk_redundancy: str or ~azure.mgmt.oracledatabase.models.DiskRedundancy + :ivar scan_ip_ids: The Single Client Access Name (SCAN) IP addresses associated with the cloud + VM cluster. SCAN IP addresses are typically used for load balancing and are not assigned to any + interface. Oracle Clusterware directs the requests to the appropriate nodes in the cluster. + **Note:** For a single-node DB system, this list is empty. + :vartype scan_ip_ids: list[str] + :ivar vip_ids: 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. + :vartype vip_ids: list[str] + :ivar scan_dns_name: The FQDN of the DNS record for the SCAN IP addresses that are associated + with the cloud VM cluster. + :vartype scan_dns_name: str + :ivar scan_listener_port_tcp: The TCP Single Client Access Name (SCAN) port. The default port + is 1521. + :vartype scan_listener_port_tcp: int + :ivar scan_listener_port_tcp_ssl: The TCPS Single Client Access Name (SCAN) port. The default + port is 2484. + :vartype scan_listener_port_tcp_ssl: int + :ivar scan_dns_record_id: The OCID of the DNS record for the SCAN IP addresses that are + associated with the cloud VM cluster. + :vartype scan_dns_record_id: str + :ivar shape: The model name of the Exadata hardware running the cloud VM cluster. + :vartype shape: str + :ivar provisioning_state: CloudVmCluster provisioning state. Known values are: "Succeeded", + "Failed", "Canceled", and "Provisioning". + :vartype provisioning_state: str or + ~azure.mgmt.oracledatabase.models.AzureResourceProvisioningState + :ivar lifecycle_state: CloudVmCluster lifecycle state. Known values are: "Provisioning", + "Available", "Updating", "Terminating", "Terminated", "MaintenanceInProgress", and "Failed". + :vartype lifecycle_state: str or ~azure.mgmt.oracledatabase.models.CloudVmClusterLifecycleState + :ivar vnet_id: VNET for network connectivity. Required. + :vartype vnet_id: str + :ivar gi_version: Oracle Grid Infrastructure (GI) software version. Required. + :vartype gi_version: str + :ivar oci_url: HTTPS link to OCI resources exposed to Azure Customer via Azure Interface. + :vartype oci_url: str + :ivar nsg_url: HTTPS link to OCI Network Security Group exposed to Azure Customer via the Azure + Interface. + :vartype nsg_url: str + :ivar subnet_id: Client subnet. Required. + :vartype subnet_id: str + :ivar backup_subnet_cidr: Client OCI backup subnet CIDR, default is 192.168.252.0/22. + :vartype backup_subnet_cidr: str + :ivar nsg_cidrs: CIDR blocks for additional NSG ingress rules. The VNET CIDRs used to provision + the VM Cluster will be added by default. + :vartype nsg_cidrs: list[~azure.mgmt.oracledatabase.models.NSGCidr] + :ivar data_collection_options: Indicates user preferences for the various diagnostic collection + options for the VM cluster/Cloud VM cluster/VMBM DBCS. + :vartype data_collection_options: ~azure.mgmt.oracledatabase.models.DataCollectionOptions + :ivar display_name: Display Name. Required. + :vartype display_name: str + :ivar compute_nodes: The list of compute servers to be added to the cloud VM cluster. + :vartype compute_nodes: list[str] + :ivar iorm_config_cache: iormConfigCache details for cloud VM cluster. + :vartype iorm_config_cache: ~azure.mgmt.oracledatabase.models.ExadataIormConfig + :ivar last_update_history_entry_id: The OCID of the last maintenance update history entry. + :vartype last_update_history_entry_id: str + :ivar db_servers: The list of DB servers. + :vartype db_servers: list[str] + :ivar compartment_id: Cluster compartmentId. + :vartype compartment_id: str + :ivar subnet_ocid: Cluster subnet ocid. + :vartype subnet_ocid: str + """ + + _validation = { + "ocid": {"readonly": True, "max_length": 255, "min_length": 1}, + "listener_port": {"readonly": True}, + "node_count": {"readonly": True}, + "time_created": {"readonly": True}, + "lifecycle_details": {"readonly": True}, + "time_zone": {"max_length": 255, "min_length": 1}, + "zone_id": {"max_length": 255, "min_length": 1}, + "hostname": {"required": True, "max_length": 23, "min_length": 1}, + "cpu_core_count": {"required": True}, + "cluster_name": {"max_length": 11, "min_length": 1}, + "cloud_exadata_infrastructure_id": {"required": True}, + "system_version": {"readonly": True, "max_length": 255, "min_length": 1}, + "ssh_public_keys": {"required": True}, + "disk_redundancy": {"readonly": True}, + "scan_ip_ids": {"readonly": True}, + "vip_ids": {"readonly": True}, + "scan_dns_name": {"readonly": True, "max_length": 72, "min_length": 1}, + "scan_dns_record_id": {"readonly": True, "max_length": 255, "min_length": 1}, + "shape": {"readonly": True, "max_length": 255, "min_length": 1}, + "provisioning_state": {"readonly": True}, + "lifecycle_state": {"readonly": True}, + "vnet_id": {"required": True}, + "gi_version": {"required": True}, + "oci_url": {"readonly": True}, + "nsg_url": {"readonly": True}, + "subnet_id": {"required": True}, + "backup_subnet_cidr": {"max_length": 32, "min_length": 1}, + "display_name": {"required": True, "max_length": 255, "min_length": 1}, + "iorm_config_cache": {"readonly": True}, + "last_update_history_entry_id": {"readonly": True, "max_length": 255, "min_length": 1}, + "compartment_id": {"readonly": True, "max_length": 255, "min_length": 1}, + "subnet_ocid": {"readonly": True, "max_length": 255, "min_length": 1}, + } + + _attribute_map = { + "ocid": {"key": "ocid", "type": "str"}, + "listener_port": {"key": "listenerPort", "type": "int"}, + "node_count": {"key": "nodeCount", "type": "int"}, + "storage_size_in_gbs": {"key": "storageSizeInGbs", "type": "int"}, + "data_storage_size_in_tbs": {"key": "dataStorageSizeInTbs", "type": "float"}, + "db_node_storage_size_in_gbs": {"key": "dbNodeStorageSizeInGbs", "type": "int"}, + "memory_size_in_gbs": {"key": "memorySizeInGbs", "type": "int"}, + "time_created": {"key": "timeCreated", "type": "iso-8601"}, + "lifecycle_details": {"key": "lifecycleDetails", "type": "str"}, + "time_zone": {"key": "timeZone", "type": "str"}, + "zone_id": {"key": "zoneId", "type": "str"}, + "hostname": {"key": "hostname", "type": "str"}, + "domain": {"key": "domain", "type": "str"}, + "cpu_core_count": {"key": "cpuCoreCount", "type": "int"}, + "ocpu_count": {"key": "ocpuCount", "type": "float"}, + "cluster_name": {"key": "clusterName", "type": "str"}, + "data_storage_percentage": {"key": "dataStoragePercentage", "type": "int"}, + "is_local_backup_enabled": {"key": "isLocalBackupEnabled", "type": "bool"}, + "cloud_exadata_infrastructure_id": {"key": "cloudExadataInfrastructureId", "type": "str"}, + "is_sparse_diskgroup_enabled": {"key": "isSparseDiskgroupEnabled", "type": "bool"}, + "system_version": {"key": "systemVersion", "type": "str"}, + "ssh_public_keys": {"key": "sshPublicKeys", "type": "[str]"}, + "license_model": {"key": "licenseModel", "type": "str"}, + "disk_redundancy": {"key": "diskRedundancy", "type": "str"}, + "scan_ip_ids": {"key": "scanIpIds", "type": "[str]"}, + "vip_ids": {"key": "vipIds", "type": "[str]"}, + "scan_dns_name": {"key": "scanDnsName", "type": "str"}, + "scan_listener_port_tcp": {"key": "scanListenerPortTcp", "type": "int"}, + "scan_listener_port_tcp_ssl": {"key": "scanListenerPortTcpSsl", "type": "int"}, + "scan_dns_record_id": {"key": "scanDnsRecordId", "type": "str"}, + "shape": {"key": "shape", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "lifecycle_state": {"key": "lifecycleState", "type": "str"}, + "vnet_id": {"key": "vnetId", "type": "str"}, + "gi_version": {"key": "giVersion", "type": "str"}, + "oci_url": {"key": "ociUrl", "type": "str"}, + "nsg_url": {"key": "nsgUrl", "type": "str"}, + "subnet_id": {"key": "subnetId", "type": "str"}, + "backup_subnet_cidr": {"key": "backupSubnetCidr", "type": "str"}, + "nsg_cidrs": {"key": "nsgCidrs", "type": "[NSGCidr]"}, + "data_collection_options": {"key": "dataCollectionOptions", "type": "DataCollectionOptions"}, + "display_name": {"key": "displayName", "type": "str"}, + "compute_nodes": {"key": "computeNodes", "type": "[str]"}, + "iorm_config_cache": {"key": "iormConfigCache", "type": "ExadataIormConfig"}, + "last_update_history_entry_id": {"key": "lastUpdateHistoryEntryId", "type": "str"}, + "db_servers": {"key": "dbServers", "type": "[str]"}, + "compartment_id": {"key": "compartmentId", "type": "str"}, + "subnet_ocid": {"key": "subnetOcid", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + hostname: str, + cpu_core_count: int, + cloud_exadata_infrastructure_id: str, + ssh_public_keys: List[str], + vnet_id: str, + gi_version: str, + subnet_id: str, + display_name: str, + storage_size_in_gbs: Optional[int] = None, + data_storage_size_in_tbs: Optional[float] = None, + db_node_storage_size_in_gbs: Optional[int] = None, + memory_size_in_gbs: Optional[int] = None, + time_zone: Optional[str] = None, + zone_id: Optional[str] = None, + domain: Optional[str] = None, + ocpu_count: Optional[float] = None, + cluster_name: Optional[str] = None, + data_storage_percentage: Optional[int] = None, + is_local_backup_enabled: bool = False, + is_sparse_diskgroup_enabled: bool = False, + license_model: Optional[Union[str, "_models.LicenseModel"]] = None, + scan_listener_port_tcp: Optional[int] = None, + scan_listener_port_tcp_ssl: Optional[int] = None, + backup_subnet_cidr: Optional[str] = None, + nsg_cidrs: Optional[List["_models.NSGCidr"]] = None, + data_collection_options: Optional["_models.DataCollectionOptions"] = None, + compute_nodes: Optional[List[str]] = None, + db_servers: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword storage_size_in_gbs: The data disk group size to be allocated in GBs per VM. + :paramtype storage_size_in_gbs: int + :keyword data_storage_size_in_tbs: The data disk group size to be allocated in TBs. + :paramtype data_storage_size_in_tbs: float + :keyword db_node_storage_size_in_gbs: The local node storage to be allocated in GBs. + :paramtype db_node_storage_size_in_gbs: int + :keyword memory_size_in_gbs: The memory to be allocated in GBs. + :paramtype memory_size_in_gbs: int + :keyword time_zone: The time zone of the cloud VM cluster. For details, see `Exadata + Infrastructure Time Zones `_. + :paramtype time_zone: str + :keyword zone_id: The OCID of the zone the cloud VM cluster is associated with. + :paramtype zone_id: str + :keyword hostname: The hostname for the cloud VM cluster. Required. + :paramtype hostname: str + :keyword domain: The domain name for the cloud VM cluster. + :paramtype domain: str + :keyword cpu_core_count: The number of CPU cores enabled on the cloud VM cluster. Required. + :paramtype cpu_core_count: int + :keyword ocpu_count: The number of OCPU cores to enable on the cloud VM cluster. Only 1 decimal + place is allowed for the fractional part. + :paramtype ocpu_count: float + :keyword cluster_name: The cluster name for cloud VM cluster. The cluster name must begin with + an alphabetic character, and may contain hyphens (-). Underscores (_) are not permitted. The + cluster name can be no longer than 11 characters and is not case sensitive. + :paramtype cluster_name: str + :keyword 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 + `_ in the Exadata documentation for details + on the impact of the configuration settings on storage. + :paramtype data_storage_percentage: int + :keyword 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. + :paramtype is_local_backup_enabled: bool + :keyword cloud_exadata_infrastructure_id: Cloud Exadata Infrastructure ID. Required. + :paramtype cloud_exadata_infrastructure_id: str + :keyword is_sparse_diskgroup_enabled: If true, sparse disk group is configured for the cloud VM + cluster. If false, sparse disk group is not created. + :paramtype is_sparse_diskgroup_enabled: bool + :keyword ssh_public_keys: The public key portion of one or more key pairs used for SSH access + to the cloud VM cluster. Required. + :paramtype ssh_public_keys: list[str] + :keyword license_model: The Oracle license model that applies to the cloud VM cluster. The + default is LICENSE_INCLUDED. Known values are: "LicenseIncluded" and "BringYourOwnLicense". + :paramtype license_model: str or ~azure.mgmt.oracledatabase.models.LicenseModel + :keyword scan_listener_port_tcp: The TCP Single Client Access Name (SCAN) port. The default + port is 1521. + :paramtype scan_listener_port_tcp: int + :keyword scan_listener_port_tcp_ssl: The TCPS Single Client Access Name (SCAN) port. The + default port is 2484. + :paramtype scan_listener_port_tcp_ssl: int + :keyword vnet_id: VNET for network connectivity. Required. + :paramtype vnet_id: str + :keyword gi_version: Oracle Grid Infrastructure (GI) software version. Required. + :paramtype gi_version: str + :keyword subnet_id: Client subnet. Required. + :paramtype subnet_id: str + :keyword backup_subnet_cidr: Client OCI backup subnet CIDR, default is 192.168.252.0/22. + :paramtype backup_subnet_cidr: str + :keyword nsg_cidrs: CIDR blocks for additional NSG ingress rules. The VNET CIDRs used to + provision the VM Cluster will be added by default. + :paramtype nsg_cidrs: list[~azure.mgmt.oracledatabase.models.NSGCidr] + :keyword data_collection_options: Indicates user preferences for the various diagnostic + collection options for the VM cluster/Cloud VM cluster/VMBM DBCS. + :paramtype data_collection_options: ~azure.mgmt.oracledatabase.models.DataCollectionOptions + :keyword display_name: Display Name. Required. + :paramtype display_name: str + :keyword compute_nodes: The list of compute servers to be added to the cloud VM cluster. + :paramtype compute_nodes: list[str] + :keyword db_servers: The list of DB servers. + :paramtype db_servers: list[str] + """ + super().__init__(**kwargs) + self.ocid = None + self.listener_port = None + self.node_count = None + self.storage_size_in_gbs = storage_size_in_gbs + self.data_storage_size_in_tbs = data_storage_size_in_tbs + self.db_node_storage_size_in_gbs = db_node_storage_size_in_gbs + self.memory_size_in_gbs = memory_size_in_gbs + self.time_created = None + self.lifecycle_details = None + self.time_zone = time_zone + self.zone_id = zone_id + self.hostname = hostname + self.domain = domain + self.cpu_core_count = cpu_core_count + self.ocpu_count = ocpu_count + self.cluster_name = cluster_name + self.data_storage_percentage = data_storage_percentage + self.is_local_backup_enabled = is_local_backup_enabled + self.cloud_exadata_infrastructure_id = cloud_exadata_infrastructure_id + self.is_sparse_diskgroup_enabled = is_sparse_diskgroup_enabled + self.system_version = None + self.ssh_public_keys = ssh_public_keys + self.license_model = license_model + self.disk_redundancy = None + self.scan_ip_ids = None + self.vip_ids = None + self.scan_dns_name = None + self.scan_listener_port_tcp = scan_listener_port_tcp + self.scan_listener_port_tcp_ssl = scan_listener_port_tcp_ssl + self.scan_dns_record_id = None + self.shape = None + self.provisioning_state = None + self.lifecycle_state = None + self.vnet_id = vnet_id + self.gi_version = gi_version + self.oci_url = None + self.nsg_url = None + self.subnet_id = subnet_id + self.backup_subnet_cidr = backup_subnet_cidr + self.nsg_cidrs = nsg_cidrs + self.data_collection_options = data_collection_options + self.display_name = display_name + self.compute_nodes = compute_nodes + self.iorm_config_cache = None + self.last_update_history_entry_id = None + self.db_servers = db_servers + self.compartment_id = None + self.subnet_ocid = None + + +class CloudVmClusterUpdate(_serialization.Model): + """The type used for update operations of the CloudVmCluster. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: The updatable properties of the CloudVmCluster. + :vartype properties: ~azure.mgmt.oracledatabase.models.CloudVmClusterUpdateProperties + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "CloudVmClusterUpdateProperties"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.CloudVmClusterUpdateProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: The updatable properties of the CloudVmCluster. + :paramtype properties: ~azure.mgmt.oracledatabase.models.CloudVmClusterUpdateProperties + """ + super().__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class CloudVmClusterUpdateProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """The updatable properties of the CloudVmCluster. + + :ivar storage_size_in_gbs: The data disk group size to be allocated in GBs per VM. + :vartype storage_size_in_gbs: int + :ivar data_storage_size_in_tbs: The data disk group size to be allocated in TBs. + :vartype data_storage_size_in_tbs: float + :ivar db_node_storage_size_in_gbs: The local node storage to be allocated in GBs. + :vartype db_node_storage_size_in_gbs: int + :ivar memory_size_in_gbs: The memory to be allocated in GBs. + :vartype memory_size_in_gbs: int + :ivar cpu_core_count: The number of CPU cores enabled on the cloud VM cluster. + :vartype cpu_core_count: int + :ivar ocpu_count: The number of OCPU cores to enable on the cloud VM cluster. Only 1 decimal + place is allowed for the fractional part. + :vartype ocpu_count: float + :ivar ssh_public_keys: The public key portion of one or more key pairs used for SSH access to + the cloud VM cluster. + :vartype ssh_public_keys: list[str] + :ivar license_model: The Oracle license model that applies to the cloud VM cluster. The default + is LICENSE_INCLUDED. Known values are: "LicenseIncluded" and "BringYourOwnLicense". + :vartype license_model: str or ~azure.mgmt.oracledatabase.models.LicenseModel + :ivar data_collection_options: Indicates user preferences for the various diagnostic collection + options for the VM cluster/Cloud VM cluster/VMBM DBCS. + :vartype data_collection_options: ~azure.mgmt.oracledatabase.models.DataCollectionOptions + :ivar display_name: Display Name. + :vartype display_name: str + :ivar compute_nodes: The list of compute servers to be added to the cloud VM cluster. + :vartype compute_nodes: list[str] + """ + + _validation = { + "display_name": {"max_length": 255, "min_length": 1}, + } + + _attribute_map = { + "storage_size_in_gbs": {"key": "storageSizeInGbs", "type": "int"}, + "data_storage_size_in_tbs": {"key": "dataStorageSizeInTbs", "type": "float"}, + "db_node_storage_size_in_gbs": {"key": "dbNodeStorageSizeInGbs", "type": "int"}, + "memory_size_in_gbs": {"key": "memorySizeInGbs", "type": "int"}, + "cpu_core_count": {"key": "cpuCoreCount", "type": "int"}, + "ocpu_count": {"key": "ocpuCount", "type": "float"}, + "ssh_public_keys": {"key": "sshPublicKeys", "type": "[str]"}, + "license_model": {"key": "licenseModel", "type": "str"}, + "data_collection_options": {"key": "dataCollectionOptions", "type": "DataCollectionOptions"}, + "display_name": {"key": "displayName", "type": "str"}, + "compute_nodes": {"key": "computeNodes", "type": "[str]"}, + } + + def __init__( + self, + *, + storage_size_in_gbs: Optional[int] = None, + data_storage_size_in_tbs: Optional[float] = None, + db_node_storage_size_in_gbs: Optional[int] = None, + memory_size_in_gbs: Optional[int] = None, + cpu_core_count: Optional[int] = None, + ocpu_count: Optional[float] = None, + ssh_public_keys: Optional[List[str]] = None, + license_model: Optional[Union[str, "_models.LicenseModel"]] = None, + data_collection_options: Optional["_models.DataCollectionOptions"] = None, + display_name: Optional[str] = None, + compute_nodes: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword storage_size_in_gbs: The data disk group size to be allocated in GBs per VM. + :paramtype storage_size_in_gbs: int + :keyword data_storage_size_in_tbs: The data disk group size to be allocated in TBs. + :paramtype data_storage_size_in_tbs: float + :keyword db_node_storage_size_in_gbs: The local node storage to be allocated in GBs. + :paramtype db_node_storage_size_in_gbs: int + :keyword memory_size_in_gbs: The memory to be allocated in GBs. + :paramtype memory_size_in_gbs: int + :keyword cpu_core_count: The number of CPU cores enabled on the cloud VM cluster. + :paramtype cpu_core_count: int + :keyword ocpu_count: The number of OCPU cores to enable on the cloud VM cluster. Only 1 decimal + place is allowed for the fractional part. + :paramtype ocpu_count: float + :keyword ssh_public_keys: The public key portion of one or more key pairs used for SSH access + to the cloud VM cluster. + :paramtype ssh_public_keys: list[str] + :keyword license_model: The Oracle license model that applies to the cloud VM cluster. The + default is LICENSE_INCLUDED. Known values are: "LicenseIncluded" and "BringYourOwnLicense". + :paramtype license_model: str or ~azure.mgmt.oracledatabase.models.LicenseModel + :keyword data_collection_options: Indicates user preferences for the various diagnostic + collection options for the VM cluster/Cloud VM cluster/VMBM DBCS. + :paramtype data_collection_options: ~azure.mgmt.oracledatabase.models.DataCollectionOptions + :keyword display_name: Display Name. + :paramtype display_name: str + :keyword compute_nodes: The list of compute servers to be added to the cloud VM cluster. + :paramtype compute_nodes: list[str] + """ + super().__init__(**kwargs) + self.storage_size_in_gbs = storage_size_in_gbs + self.data_storage_size_in_tbs = data_storage_size_in_tbs + self.db_node_storage_size_in_gbs = db_node_storage_size_in_gbs + self.memory_size_in_gbs = memory_size_in_gbs + self.cpu_core_count = cpu_core_count + self.ocpu_count = ocpu_count + self.ssh_public_keys = ssh_public_keys + self.license_model = license_model + self.data_collection_options = data_collection_options + self.display_name = display_name + self.compute_nodes = compute_nodes + + +class ConnectionStringType(_serialization.Model): + """Connection strings to connect to an Oracle Autonomous Database. + + :ivar all_connection_strings: Returns all connection strings that can be used to connect to the + Autonomous Database. + :vartype all_connection_strings: ~azure.mgmt.oracledatabase.models.AllConnectionStringType + :ivar dedicated: The database service provides the least level of resources to each SQL + statement, but supports the most number of concurrent SQL statements. + :vartype dedicated: str + :ivar high: The High database service provides the highest level of resources to each SQL + statement resulting in the highest performance, but supports the fewest number of concurrent + SQL statements. + :vartype high: str + :ivar low: The Low database service provides the least level of resources to each SQL + statement, but supports the most number of concurrent SQL statements. + :vartype low: str + :ivar medium: The Medium database service provides a lower level of resources to each SQL + statement potentially resulting a lower level of performance, but supports more concurrent SQL + statements. + :vartype medium: str + :ivar profiles: A list of connection string profiles to allow clients to group, filter and + select connection string values based on structured metadata. + :vartype profiles: list[~azure.mgmt.oracledatabase.models.ProfileType] + """ + + _validation = { + "dedicated": {"max_length": 255, "min_length": 10}, + "high": {"max_length": 255, "min_length": 10}, + "low": {"max_length": 255, "min_length": 10}, + "medium": {"max_length": 255, "min_length": 10}, + } + + _attribute_map = { + "all_connection_strings": {"key": "allConnectionStrings", "type": "AllConnectionStringType"}, + "dedicated": {"key": "dedicated", "type": "str"}, + "high": {"key": "high", "type": "str"}, + "low": {"key": "low", "type": "str"}, + "medium": {"key": "medium", "type": "str"}, + "profiles": {"key": "profiles", "type": "[ProfileType]"}, + } + + def __init__( + self, + *, + all_connection_strings: Optional["_models.AllConnectionStringType"] = None, + dedicated: Optional[str] = None, + high: Optional[str] = None, + low: Optional[str] = None, + medium: Optional[str] = None, + profiles: Optional[List["_models.ProfileType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword all_connection_strings: Returns all connection strings that can be used to connect to + the Autonomous Database. + :paramtype all_connection_strings: ~azure.mgmt.oracledatabase.models.AllConnectionStringType + :keyword dedicated: The database service provides the least level of resources to each SQL + statement, but supports the most number of concurrent SQL statements. + :paramtype dedicated: str + :keyword high: The High database service provides the highest level of resources to each SQL + statement resulting in the highest performance, but supports the fewest number of concurrent + SQL statements. + :paramtype high: str + :keyword low: The Low database service provides the least level of resources to each SQL + statement, but supports the most number of concurrent SQL statements. + :paramtype low: str + :keyword medium: The Medium database service provides a lower level of resources to each SQL + statement potentially resulting a lower level of performance, but supports more concurrent SQL + statements. + :paramtype medium: str + :keyword profiles: A list of connection string profiles to allow clients to group, filter and + select connection string values based on structured metadata. + :paramtype profiles: list[~azure.mgmt.oracledatabase.models.ProfileType] + """ + super().__init__(**kwargs) + self.all_connection_strings = all_connection_strings + self.dedicated = dedicated + self.high = high + self.low = low + self.medium = medium + self.profiles = profiles + + +class ConnectionUrlType(_serialization.Model): + """The URLs for accessing Oracle Application Express (APEX) and SQL Developer Web with a browser + from a Compute instance within your VCN or that has a direct connection to your VCN. + + :ivar apex_url: Oracle Application Express (APEX) URL. + :vartype apex_url: str + :ivar database_transforms_url: The URL of the Database Transforms for the Autonomous Database. + :vartype database_transforms_url: str + :ivar graph_studio_url: The URL of the Graph Studio for the Autonomous Database. + :vartype graph_studio_url: str + :ivar machine_learning_notebook_url: The URL of the Oracle Machine Learning (OML) Notebook for + the Autonomous Database. + :vartype machine_learning_notebook_url: str + :ivar mongo_db_url: The URL of the MongoDB API for the Autonomous Database. + :vartype mongo_db_url: str + :ivar ords_url: The Oracle REST Data Services (ORDS) URL of the Web Access for the Autonomous + Database. + :vartype ords_url: str + :ivar sql_dev_web_url: Oracle SQL Developer Web URL. + :vartype sql_dev_web_url: str + """ + + _validation = { + "apex_url": {"max_length": 512, "min_length": 10}, + "database_transforms_url": {"max_length": 512, "min_length": 10}, + "graph_studio_url": {"max_length": 512, "min_length": 10}, + "machine_learning_notebook_url": {"max_length": 512, "min_length": 10}, + "mongo_db_url": {"max_length": 512, "min_length": 10}, + "ords_url": {"max_length": 512, "min_length": 10}, + "sql_dev_web_url": {"max_length": 512, "min_length": 10}, + } + + _attribute_map = { + "apex_url": {"key": "apexUrl", "type": "str"}, + "database_transforms_url": {"key": "databaseTransformsUrl", "type": "str"}, + "graph_studio_url": {"key": "graphStudioUrl", "type": "str"}, + "machine_learning_notebook_url": {"key": "machineLearningNotebookUrl", "type": "str"}, + "mongo_db_url": {"key": "mongoDbUrl", "type": "str"}, + "ords_url": {"key": "ordsUrl", "type": "str"}, + "sql_dev_web_url": {"key": "sqlDevWebUrl", "type": "str"}, + } + + def __init__( + self, + *, + apex_url: Optional[str] = None, + database_transforms_url: Optional[str] = None, + graph_studio_url: Optional[str] = None, + machine_learning_notebook_url: Optional[str] = None, + mongo_db_url: Optional[str] = None, + ords_url: Optional[str] = None, + sql_dev_web_url: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword apex_url: Oracle Application Express (APEX) URL. + :paramtype apex_url: str + :keyword database_transforms_url: The URL of the Database Transforms for the Autonomous + Database. + :paramtype database_transforms_url: str + :keyword graph_studio_url: The URL of the Graph Studio for the Autonomous Database. + :paramtype graph_studio_url: str + :keyword machine_learning_notebook_url: The URL of the Oracle Machine Learning (OML) Notebook + for the Autonomous Database. + :paramtype machine_learning_notebook_url: str + :keyword mongo_db_url: The URL of the MongoDB API for the Autonomous Database. + :paramtype mongo_db_url: str + :keyword ords_url: The Oracle REST Data Services (ORDS) URL of the Web Access for the + Autonomous Database. + :paramtype ords_url: str + :keyword sql_dev_web_url: Oracle SQL Developer Web URL. + :paramtype sql_dev_web_url: str + """ + super().__init__(**kwargs) + self.apex_url = apex_url + self.database_transforms_url = database_transforms_url + self.graph_studio_url = graph_studio_url + self.machine_learning_notebook_url = machine_learning_notebook_url + self.mongo_db_url = mongo_db_url + self.ords_url = ords_url + self.sql_dev_web_url = sql_dev_web_url + + +class CustomerContact(_serialization.Model): + """CustomerContact resource properties. + + All required parameters must be populated in order to send to server. + + :ivar email: The email address used by Oracle to send notifications regarding databases and + infrastructure. Required. + :vartype email: str + """ + + _validation = { + "email": {"required": True, "max_length": 320, "min_length": 1}, + } + + _attribute_map = { + "email": {"key": "email", "type": "str"}, + } + + def __init__(self, *, email: str, **kwargs: Any) -> None: + """ + :keyword email: The email address used by Oracle to send notifications regarding databases and + infrastructure. Required. + :paramtype email: str + """ + super().__init__(**kwargs) + self.email = email + + +class DataCollectionOptions(_serialization.Model): + """DataCollectionOptions resource properties. + + :ivar is_diagnostics_events_enabled: Indicates whether diagnostic collection is enabled for the + VM cluster/Cloud VM cluster/VMBM DBCS. + :vartype is_diagnostics_events_enabled: bool + :ivar is_health_monitoring_enabled: Indicates whether health monitoring is enabled for the VM + cluster / Cloud VM cluster / VMBM DBCS. + :vartype is_health_monitoring_enabled: bool + :ivar is_incident_logs_enabled: Indicates whether incident logs and trace collection are + enabled for the VM cluster / Cloud VM cluster / VMBM DBCS. + :vartype is_incident_logs_enabled: bool + """ + + _attribute_map = { + "is_diagnostics_events_enabled": {"key": "isDiagnosticsEventsEnabled", "type": "bool"}, + "is_health_monitoring_enabled": {"key": "isHealthMonitoringEnabled", "type": "bool"}, + "is_incident_logs_enabled": {"key": "isIncidentLogsEnabled", "type": "bool"}, + } + + def __init__( + self, + *, + is_diagnostics_events_enabled: bool = False, + is_health_monitoring_enabled: bool = False, + is_incident_logs_enabled: bool = False, + **kwargs: Any + ) -> None: + """ + :keyword is_diagnostics_events_enabled: Indicates whether diagnostic collection is enabled for + the VM cluster/Cloud VM cluster/VMBM DBCS. + :paramtype is_diagnostics_events_enabled: bool + :keyword is_health_monitoring_enabled: Indicates whether health monitoring is enabled for the + VM cluster / Cloud VM cluster / VMBM DBCS. + :paramtype is_health_monitoring_enabled: bool + :keyword is_incident_logs_enabled: Indicates whether incident logs and trace collection are + enabled for the VM cluster / Cloud VM cluster / VMBM DBCS. + :paramtype is_incident_logs_enabled: bool + """ + super().__init__(**kwargs) + self.is_diagnostics_events_enabled = is_diagnostics_events_enabled + self.is_health_monitoring_enabled = is_health_monitoring_enabled + self.is_incident_logs_enabled = is_incident_logs_enabled + + +class DayOfWeek(_serialization.Model): + """DayOfWeek resource properties. + + All required parameters must be populated in order to send to server. + + :ivar name: Name of the day of the week. Required. Known values are: "Monday", "Tuesday", + "Wednesday", "Thursday", "Friday", "Saturday", and "Sunday". + :vartype name: str or ~azure.mgmt.oracledatabase.models.DayOfWeekName + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, name: Union[str, "_models.DayOfWeekName"], **kwargs: Any) -> None: + """ + :keyword name: Name of the day of the week. Required. Known values are: "Monday", "Tuesday", + "Wednesday", "Thursday", "Friday", "Saturday", and "Sunday". + :paramtype name: str or ~azure.mgmt.oracledatabase.models.DayOfWeekName + """ + super().__init__(**kwargs) + self.name = name + + +class DayOfWeekUpdate(_serialization.Model): + """DayOfWeek resource properties. + + :ivar name: Name of the day of the week. Known values are: "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday", and "Sunday". + :vartype name: str or ~azure.mgmt.oracledatabase.models.DayOfWeekName + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, name: Optional[Union[str, "_models.DayOfWeekName"]] = None, **kwargs: Any) -> None: + """ + :keyword name: Name of the day of the week. Known values are: "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday", and "Sunday". + :paramtype name: str or ~azure.mgmt.oracledatabase.models.DayOfWeekName + """ + super().__init__(**kwargs) + self.name = name + + +class DbIormConfig(_serialization.Model): + """DbIormConfig for cloud vm cluster. + + :ivar db_name: The database name. For the default DbPlan, the dbName is default. + :vartype db_name: str + :ivar flash_cache_limit: The flash cache limit for this database. This value is internally + configured based on the share value assigned to the database. + :vartype flash_cache_limit: str + :ivar share: The relative priority of this database. + :vartype share: int + """ + + _validation = { + "share": {"maximum": 32, "minimum": 1}, + } + + _attribute_map = { + "db_name": {"key": "dbName", "type": "str"}, + "flash_cache_limit": {"key": "flashCacheLimit", "type": "str"}, + "share": {"key": "share", "type": "int"}, + } + + def __init__( + self, + *, + db_name: Optional[str] = None, + flash_cache_limit: Optional[str] = None, + share: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword db_name: The database name. For the default DbPlan, the dbName is default. + :paramtype db_name: str + :keyword flash_cache_limit: The flash cache limit for this database. This value is internally + configured based on the share value assigned to the database. + :paramtype flash_cache_limit: str + :keyword share: The relative priority of this database. + :paramtype share: int + """ + super().__init__(**kwargs) + self.db_name = db_name + self.flash_cache_limit = flash_cache_limit + self.share = share + + +class DbNode(ProxyResource): + """The DbNode resource belonging to vmCluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.oracledatabase.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.oracledatabase.models.DbNodeProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "DbNodeProperties"}, + } + + def __init__(self, *, properties: Optional["_models.DbNodeProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.oracledatabase.models.DbNodeProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class DbNodeAction(_serialization.Model): + """DbNode action object. + + All required parameters must be populated in order to send to server. + + :ivar action: Db action. Required. Known values are: "Start", "Stop", "SoftReset", and "Reset". + :vartype action: str or ~azure.mgmt.oracledatabase.models.DbNodeActionEnum + """ + + _validation = { + "action": {"required": True}, + } + + _attribute_map = { + "action": {"key": "action", "type": "str"}, + } + + def __init__(self, *, action: Union[str, "_models.DbNodeActionEnum"], **kwargs: Any) -> None: + """ + :keyword action: Db action. Required. Known values are: "Start", "Stop", "SoftReset", and + "Reset". + :paramtype action: str or ~azure.mgmt.oracledatabase.models.DbNodeActionEnum + """ + super().__init__(**kwargs) + self.action = action + + +class DbNodeListResult(_serialization.Model): + """The response of a DbNode list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: The DbNode items on this page. Required. + :vartype value: list[~azure.mgmt.oracledatabase.models.DbNode] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DbNode]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.DbNode"], **kwargs: Any) -> None: + """ + :keyword value: The DbNode items on this page. Required. + :paramtype value: list[~azure.mgmt.oracledatabase.models.DbNode] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class DbNodeProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """The properties of DbNodeResource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar ocid: DbNode OCID. Required. + :vartype ocid: str + :ivar additional_details: Additional information about the planned maintenance. + :vartype additional_details: str + :ivar backup_ip_id: The OCID of the backup IP address associated with the database node. + :vartype backup_ip_id: str + :ivar backup_vnic2_id: The OCID of the second backup VNIC. + :vartype backup_vnic2_id: str + :ivar backup_vnic_id: The OCID of the backup VNIC. + :vartype backup_vnic_id: str + :ivar cpu_core_count: The number of CPU cores enabled on the Db node. + :vartype cpu_core_count: int + :ivar db_node_storage_size_in_gbs: The allocated local node storage in GBs on the Db node. + :vartype db_node_storage_size_in_gbs: int + :ivar db_server_id: The OCID of the Exacc Db server associated with the database node. + :vartype db_server_id: str + :ivar db_system_id: The OCID of the DB system. Required. + :vartype db_system_id: str + :ivar fault_domain: The name of the Fault Domain the instance is contained in. + :vartype fault_domain: str + :ivar host_ip_id: The OCID of the host IP address associated with the database node. + :vartype host_ip_id: str + :ivar hostname: The host name for the database node. + :vartype hostname: str + :ivar lifecycle_state: The current state of the database node. Known values are: + "Provisioning", "Available", "Updating", "Stopping", "Stopped", "Starting", "Terminating", + "Terminated", and "Failed". + :vartype lifecycle_state: str or ~azure.mgmt.oracledatabase.models.DbNodeProvisioningState + :ivar lifecycle_details: Lifecycle details of Db Node. + :vartype lifecycle_details: str + :ivar maintenance_type: The type of database node maintenance. "VmdbRebootMigration" + :vartype maintenance_type: str or ~azure.mgmt.oracledatabase.models.DbNodeMaintenanceType + :ivar memory_size_in_gbs: The allocated memory in GBs on the Db node. + :vartype memory_size_in_gbs: int + :ivar software_storage_size_in_gb: The size (in GB) of the block storage volume allocation for + the DB system. This attribute applies only for virtual machine DB systems. + :vartype software_storage_size_in_gb: int + :ivar time_created: The date and time that the database node was created. + :vartype time_created: ~datetime.datetime + :ivar time_maintenance_window_end: End date and time of maintenance window. + :vartype time_maintenance_window_end: ~datetime.datetime + :ivar time_maintenance_window_start: Start date and time of maintenance window. + :vartype time_maintenance_window_start: ~datetime.datetime + :ivar vnic2_id: The OCID of the second VNIC. + :vartype vnic2_id: str + :ivar vnic_id: The OCID of the VNIC. + :vartype vnic_id: str + :ivar provisioning_state: Azure resource provisioning state. Known values are: "Succeeded", + "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.oracledatabase.models.ResourceProvisioningState + """ + + _validation = { + "ocid": {"required": True, "readonly": True, "max_length": 255, "min_length": 1}, + "additional_details": {"readonly": True}, + "backup_ip_id": {"readonly": True, "max_length": 255, "min_length": 1}, + "backup_vnic2_id": {"readonly": True, "max_length": 255, "min_length": 1}, + "backup_vnic_id": {"readonly": True, "max_length": 255, "min_length": 1}, + "cpu_core_count": {"readonly": True}, + "db_node_storage_size_in_gbs": {"readonly": True}, + "db_server_id": {"readonly": True, "max_length": 255, "min_length": 1}, + "db_system_id": {"required": True, "readonly": True, "max_length": 255, "min_length": 1}, + "fault_domain": {"readonly": True, "max_length": 255, "min_length": 1}, + "host_ip_id": {"readonly": True, "max_length": 255, "min_length": 1}, + "hostname": {"readonly": True}, + "lifecycle_state": {"readonly": True}, + "lifecycle_details": {"readonly": True}, + "maintenance_type": {"readonly": True}, + "memory_size_in_gbs": {"readonly": True}, + "software_storage_size_in_gb": {"readonly": True}, + "time_created": {"readonly": True}, + "time_maintenance_window_end": {"readonly": True}, + "time_maintenance_window_start": {"readonly": True}, + "vnic2_id": {"readonly": True, "max_length": 255, "min_length": 1}, + "vnic_id": {"readonly": True, "max_length": 255, "min_length": 1}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "ocid": {"key": "ocid", "type": "str"}, + "additional_details": {"key": "additionalDetails", "type": "str"}, + "backup_ip_id": {"key": "backupIpId", "type": "str"}, + "backup_vnic2_id": {"key": "backupVnic2Id", "type": "str"}, + "backup_vnic_id": {"key": "backupVnicId", "type": "str"}, + "cpu_core_count": {"key": "cpuCoreCount", "type": "int"}, + "db_node_storage_size_in_gbs": {"key": "dbNodeStorageSizeInGbs", "type": "int"}, + "db_server_id": {"key": "dbServerId", "type": "str"}, + "db_system_id": {"key": "dbSystemId", "type": "str"}, + "fault_domain": {"key": "faultDomain", "type": "str"}, + "host_ip_id": {"key": "hostIpId", "type": "str"}, + "hostname": {"key": "hostname", "type": "str"}, + "lifecycle_state": {"key": "lifecycleState", "type": "str"}, + "lifecycle_details": {"key": "lifecycleDetails", "type": "str"}, + "maintenance_type": {"key": "maintenanceType", "type": "str"}, + "memory_size_in_gbs": {"key": "memorySizeInGbs", "type": "int"}, + "software_storage_size_in_gb": {"key": "softwareStorageSizeInGb", "type": "int"}, + "time_created": {"key": "timeCreated", "type": "iso-8601"}, + "time_maintenance_window_end": {"key": "timeMaintenanceWindowEnd", "type": "iso-8601"}, + "time_maintenance_window_start": {"key": "timeMaintenanceWindowStart", "type": "iso-8601"}, + "vnic2_id": {"key": "vnic2Id", "type": "str"}, + "vnic_id": {"key": "vnicId", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.ocid = None + self.additional_details = None + self.backup_ip_id = None + self.backup_vnic2_id = None + self.backup_vnic_id = None + self.cpu_core_count = None + self.db_node_storage_size_in_gbs = None + self.db_server_id = None + self.db_system_id = None + self.fault_domain = None + self.host_ip_id = None + self.hostname = None + self.lifecycle_state = None + self.lifecycle_details = None + self.maintenance_type = None + self.memory_size_in_gbs = None + self.software_storage_size_in_gb = None + self.time_created = None + self.time_maintenance_window_end = None + self.time_maintenance_window_start = None + self.vnic2_id = None + self.vnic_id = None + self.provisioning_state = None + + +class DbServer(ProxyResource): + """DbServer resource model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.oracledatabase.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.oracledatabase.models.DbServerProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "DbServerProperties"}, + } + + def __init__(self, *, properties: Optional["_models.DbServerProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.oracledatabase.models.DbServerProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class DbServerListResult(_serialization.Model): + """The response of a DbServer list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: The DbServer items on this page. Required. + :vartype value: list[~azure.mgmt.oracledatabase.models.DbServer] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DbServer]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.DbServer"], **kwargs: Any) -> None: + """ + :keyword value: The DbServer items on this page. Required. + :paramtype value: list[~azure.mgmt.oracledatabase.models.DbServer] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class DbServerPatchingDetails(_serialization.Model): + """DbServer Patching Properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar estimated_patch_duration: Estimated Patch Duration. + :vartype estimated_patch_duration: int + :ivar patching_status: Patching Status. Known values are: "Scheduled", "MaintenanceInProgress", + "Failed", and "Complete". + :vartype patching_status: str or ~azure.mgmt.oracledatabase.models.DbServerPatchingStatus + :ivar time_patching_ended: Time Patching Ended. + :vartype time_patching_ended: ~datetime.datetime + :ivar time_patching_started: Time Patching Started. + :vartype time_patching_started: ~datetime.datetime + """ + + _validation = { + "estimated_patch_duration": {"readonly": True, "maximum": 3000, "minimum": 1}, + "patching_status": {"readonly": True}, + "time_patching_ended": {"readonly": True}, + "time_patching_started": {"readonly": True}, + } + + _attribute_map = { + "estimated_patch_duration": {"key": "estimatedPatchDuration", "type": "int"}, + "patching_status": {"key": "patchingStatus", "type": "str"}, + "time_patching_ended": {"key": "timePatchingEnded", "type": "iso-8601"}, + "time_patching_started": {"key": "timePatchingStarted", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.estimated_patch_duration = None + self.patching_status = None + self.time_patching_ended = None + self.time_patching_started = None + + +class DbServerProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """DbServer resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar ocid: Db server name. + :vartype ocid: str + :ivar display_name: The name for the Db Server. + :vartype display_name: str + :ivar compartment_id: The OCID of the compartment. + :vartype compartment_id: str + :ivar exadata_infrastructure_id: The OCID of the Exadata infrastructure. + :vartype exadata_infrastructure_id: str + :ivar cpu_core_count: The number of CPU cores enabled on the Db server. + :vartype cpu_core_count: int + :ivar db_server_patching_details: dbServerPatching details of the Db server. + :vartype db_server_patching_details: ~azure.mgmt.oracledatabase.models.DbServerPatchingDetails + :ivar max_memory_in_gbs: The total memory available in GBs. + :vartype max_memory_in_gbs: int + :ivar db_node_storage_size_in_gbs: The allocated local node storage in GBs on the Db server. + :vartype db_node_storage_size_in_gbs: int + :ivar vm_cluster_ids: The OCID of the VM Clusters associated with the Db server. + :vartype vm_cluster_ids: list[str] + :ivar db_node_ids: The OCID of the Db nodes associated with the Db server. + :vartype db_node_ids: list[str] + :ivar lifecycle_details: Lifecycle details of dbServer. + :vartype lifecycle_details: str + :ivar lifecycle_state: DbServer provisioning state. Known values are: "Creating", "Available", + "Unavailable", "Deleting", "Deleted", and "MaintenanceInProgress". + :vartype lifecycle_state: str or ~azure.mgmt.oracledatabase.models.DbServerProvisioningState + :ivar max_cpu_count: The total number of CPU cores available. + :vartype max_cpu_count: int + :ivar autonomous_vm_cluster_ids: The list of OCIDs of the Autonomous VM Clusters associated + with the Db server. + :vartype autonomous_vm_cluster_ids: list[str] + :ivar autonomous_virtual_machine_ids: The list of OCIDs of the Autonomous Virtual Machines + associated with the Db server. + :vartype autonomous_virtual_machine_ids: list[str] + :ivar max_db_node_storage_in_gbs: The total max dbNode storage in GBs. + :vartype max_db_node_storage_in_gbs: int + :ivar memory_size_in_gbs: The total memory size in GBs. + :vartype memory_size_in_gbs: int + :ivar shape: The shape of the Db server. The shape determines the amount of CPU, storage, and + memory resources available. + :vartype shape: str + :ivar time_created: The date and time that the Db Server was created. + :vartype time_created: ~datetime.datetime + :ivar provisioning_state: Azure resource provisioning state. Known values are: "Succeeded", + "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.oracledatabase.models.ResourceProvisioningState + """ + + _validation = { + "ocid": {"readonly": True, "max_length": 255, "min_length": 1}, + "display_name": {"readonly": True, "max_length": 255, "min_length": 1}, + "compartment_id": {"readonly": True, "max_length": 255, "min_length": 1}, + "exadata_infrastructure_id": {"readonly": True, "max_length": 255, "min_length": 1}, + "cpu_core_count": {"readonly": True}, + "db_server_patching_details": {"readonly": True}, + "max_memory_in_gbs": {"readonly": True}, + "db_node_storage_size_in_gbs": {"readonly": True}, + "vm_cluster_ids": {"readonly": True}, + "db_node_ids": {"readonly": True}, + "lifecycle_details": {"readonly": True}, + "lifecycle_state": {"readonly": True}, + "max_cpu_count": {"readonly": True}, + "autonomous_vm_cluster_ids": {"readonly": True}, + "autonomous_virtual_machine_ids": {"readonly": True}, + "max_db_node_storage_in_gbs": {"readonly": True}, + "memory_size_in_gbs": {"readonly": True}, + "shape": {"readonly": True, "max_length": 255, "min_length": 1}, + "time_created": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "ocid": {"key": "ocid", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "compartment_id": {"key": "compartmentId", "type": "str"}, + "exadata_infrastructure_id": {"key": "exadataInfrastructureId", "type": "str"}, + "cpu_core_count": {"key": "cpuCoreCount", "type": "int"}, + "db_server_patching_details": {"key": "dbServerPatchingDetails", "type": "DbServerPatchingDetails"}, + "max_memory_in_gbs": {"key": "maxMemoryInGbs", "type": "int"}, + "db_node_storage_size_in_gbs": {"key": "dbNodeStorageSizeInGbs", "type": "int"}, + "vm_cluster_ids": {"key": "vmClusterIds", "type": "[str]"}, + "db_node_ids": {"key": "dbNodeIds", "type": "[str]"}, + "lifecycle_details": {"key": "lifecycleDetails", "type": "str"}, + "lifecycle_state": {"key": "lifecycleState", "type": "str"}, + "max_cpu_count": {"key": "maxCpuCount", "type": "int"}, + "autonomous_vm_cluster_ids": {"key": "autonomousVmClusterIds", "type": "[str]"}, + "autonomous_virtual_machine_ids": {"key": "autonomousVirtualMachineIds", "type": "[str]"}, + "max_db_node_storage_in_gbs": {"key": "maxDbNodeStorageInGbs", "type": "int"}, + "memory_size_in_gbs": {"key": "memorySizeInGbs", "type": "int"}, + "shape": {"key": "shape", "type": "str"}, + "time_created": {"key": "timeCreated", "type": "iso-8601"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.ocid = None + self.display_name = None + self.compartment_id = None + self.exadata_infrastructure_id = None + self.cpu_core_count = None + self.db_server_patching_details = None + self.max_memory_in_gbs = None + self.db_node_storage_size_in_gbs = None + self.vm_cluster_ids = None + self.db_node_ids = None + self.lifecycle_details = None + self.lifecycle_state = None + self.max_cpu_count = None + self.autonomous_vm_cluster_ids = None + self.autonomous_virtual_machine_ids = None + self.max_db_node_storage_in_gbs = None + self.memory_size_in_gbs = None + self.shape = None + self.time_created = None + self.provisioning_state = None + + +class DbSystemShape(ProxyResource): + """DbSystemShape resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.oracledatabase.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.oracledatabase.models.DbSystemShapeProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "DbSystemShapeProperties"}, + } + + def __init__(self, *, properties: Optional["_models.DbSystemShapeProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.oracledatabase.models.DbSystemShapeProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class DbSystemShapeListResult(_serialization.Model): + """The response of a DbSystemShape list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: The DbSystemShape items on this page. Required. + :vartype value: list[~azure.mgmt.oracledatabase.models.DbSystemShape] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DbSystemShape]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.DbSystemShape"], **kwargs: Any) -> None: + """ + :keyword value: The DbSystemShape items on this page. Required. + :paramtype value: list[~azure.mgmt.oracledatabase.models.DbSystemShape] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class DbSystemShapeProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """DbSystemShape resource model. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar shape_family: The family of the shape used for the DB system. + :vartype shape_family: str + :ivar available_core_count: The maximum number of CPU cores that can be enabled on the DB + system for this shape. Required. + :vartype available_core_count: int + :ivar minimum_core_count: The minimum number of CPU cores that can be enabled on the DB system + for this shape. + :vartype minimum_core_count: int + :ivar runtime_minimum_core_count: The runtime minimum number of CPU cores that can be enabled + on the DB system for this shape. + :vartype runtime_minimum_core_count: int + :ivar core_count_increment: The discrete number by which the CPU core count for this shape can + be increased or decreased. + :vartype core_count_increment: int + :ivar min_storage_count: The minimum number of Exadata storage servers available for the + Exadata infrastructure. + :vartype min_storage_count: int + :ivar max_storage_count: The maximum number of Exadata storage servers available for the + Exadata infrastructure. + :vartype max_storage_count: int + :ivar available_data_storage_per_server_in_tbs: The maximum data storage available per storage + server for this shape. Only applicable to ExaCC Elastic shapes. + :vartype available_data_storage_per_server_in_tbs: float + :ivar available_memory_per_node_in_gbs: The maximum memory available per database node for this + shape. Only applicable to ExaCC Elastic shapes. + :vartype available_memory_per_node_in_gbs: int + :ivar available_db_node_per_node_in_gbs: The maximum Db Node storage available per database + node for this shape. Only applicable to ExaCC Elastic shapes. + :vartype available_db_node_per_node_in_gbs: int + :ivar min_core_count_per_node: The minimum number of CPU cores that can be enabled per node for + this shape. + :vartype min_core_count_per_node: int + :ivar available_memory_in_gbs: The maximum memory that can be enabled for this shape. + :vartype available_memory_in_gbs: int + :ivar min_memory_per_node_in_gbs: The minimum memory that need be allocated per node for this + shape. + :vartype min_memory_per_node_in_gbs: int + :ivar available_db_node_storage_in_gbs: The maximum Db Node storage that can be enabled for + this shape. + :vartype available_db_node_storage_in_gbs: int + :ivar min_db_node_storage_per_node_in_gbs: The minimum Db Node storage that need be allocated + per node for this shape. + :vartype min_db_node_storage_per_node_in_gbs: int + :ivar available_data_storage_in_tbs: The maximum DATA storage that can be enabled for this + shape. + :vartype available_data_storage_in_tbs: int + :ivar min_data_storage_in_tbs: The minimum data storage that need be allocated for this shape. + :vartype min_data_storage_in_tbs: int + :ivar minimum_node_count: The minimum number of database nodes available for this shape. + :vartype minimum_node_count: int + :ivar maximum_node_count: The maximum number of database nodes available for this shape. + :vartype maximum_node_count: int + :ivar available_core_count_per_node: The maximum number of CPU cores per database node that can + be enabled for this shape. Only applicable to the flex Exadata shape and ExaCC Elastic shapes. + :vartype available_core_count_per_node: int + """ + + _validation = { + "shape_family": {"readonly": True, "max_length": 255, "min_length": 1}, + "available_core_count": {"required": True, "readonly": True}, + "minimum_core_count": {"readonly": True}, + "runtime_minimum_core_count": {"readonly": True}, + "core_count_increment": {"readonly": True}, + "min_storage_count": {"readonly": True}, + "max_storage_count": {"readonly": True}, + "available_data_storage_per_server_in_tbs": {"readonly": True}, + "available_memory_per_node_in_gbs": {"readonly": True}, + "available_db_node_per_node_in_gbs": {"readonly": True}, + "min_core_count_per_node": {"readonly": True}, + "available_memory_in_gbs": {"readonly": True}, + "min_memory_per_node_in_gbs": {"readonly": True}, + "available_db_node_storage_in_gbs": {"readonly": True}, + "min_db_node_storage_per_node_in_gbs": {"readonly": True}, + "available_data_storage_in_tbs": {"readonly": True}, + "min_data_storage_in_tbs": {"readonly": True}, + "minimum_node_count": {"readonly": True}, + "maximum_node_count": {"readonly": True}, + "available_core_count_per_node": {"readonly": True}, + } + + _attribute_map = { + "shape_family": {"key": "shapeFamily", "type": "str"}, + "available_core_count": {"key": "availableCoreCount", "type": "int"}, + "minimum_core_count": {"key": "minimumCoreCount", "type": "int"}, + "runtime_minimum_core_count": {"key": "runtimeMinimumCoreCount", "type": "int"}, + "core_count_increment": {"key": "coreCountIncrement", "type": "int"}, + "min_storage_count": {"key": "minStorageCount", "type": "int"}, + "max_storage_count": {"key": "maxStorageCount", "type": "int"}, + "available_data_storage_per_server_in_tbs": {"key": "availableDataStoragePerServerInTbs", "type": "float"}, + "available_memory_per_node_in_gbs": {"key": "availableMemoryPerNodeInGbs", "type": "int"}, + "available_db_node_per_node_in_gbs": {"key": "availableDbNodePerNodeInGbs", "type": "int"}, + "min_core_count_per_node": {"key": "minCoreCountPerNode", "type": "int"}, + "available_memory_in_gbs": {"key": "availableMemoryInGbs", "type": "int"}, + "min_memory_per_node_in_gbs": {"key": "minMemoryPerNodeInGbs", "type": "int"}, + "available_db_node_storage_in_gbs": {"key": "availableDbNodeStorageInGbs", "type": "int"}, + "min_db_node_storage_per_node_in_gbs": {"key": "minDbNodeStoragePerNodeInGbs", "type": "int"}, + "available_data_storage_in_tbs": {"key": "availableDataStorageInTbs", "type": "int"}, + "min_data_storage_in_tbs": {"key": "minDataStorageInTbs", "type": "int"}, + "minimum_node_count": {"key": "minimumNodeCount", "type": "int"}, + "maximum_node_count": {"key": "maximumNodeCount", "type": "int"}, + "available_core_count_per_node": {"key": "availableCoreCountPerNode", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.shape_family = None + self.available_core_count = None + self.minimum_core_count = None + self.runtime_minimum_core_count = None + self.core_count_increment = None + self.min_storage_count = None + self.max_storage_count = None + self.available_data_storage_per_server_in_tbs = None + self.available_memory_per_node_in_gbs = None + self.available_db_node_per_node_in_gbs = None + self.min_core_count_per_node = None + self.available_memory_in_gbs = None + self.min_memory_per_node_in_gbs = None + self.available_db_node_storage_in_gbs = None + self.min_db_node_storage_per_node_in_gbs = None + self.available_data_storage_in_tbs = None + self.min_data_storage_in_tbs = None + self.minimum_node_count = None + self.maximum_node_count = None + self.available_core_count_per_node = None + + +class DnsPrivateView(ProxyResource): + """DnsPrivateView resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.oracledatabase.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.oracledatabase.models.DnsPrivateViewProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "DnsPrivateViewProperties"}, + } + + def __init__(self, *, properties: Optional["_models.DnsPrivateViewProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.oracledatabase.models.DnsPrivateViewProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class DnsPrivateViewListResult(_serialization.Model): + """The response of a DnsPrivateView list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: The DnsPrivateView items on this page. Required. + :vartype value: list[~azure.mgmt.oracledatabase.models.DnsPrivateView] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DnsPrivateView]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.DnsPrivateView"], **kwargs: Any) -> None: + """ + :keyword value: The DnsPrivateView items on this page. Required. + :paramtype value: list[~azure.mgmt.oracledatabase.models.DnsPrivateView] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class DnsPrivateViewProperties(_serialization.Model): + """Views resource model. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar ocid: The OCID of the view. Required. + :vartype ocid: str + :ivar display_name: The display name of the view resource. + :vartype display_name: str + :ivar is_protected: A Boolean flag indicating whether or not parts of the resource are unable + to be explicitly managed. Required. + :vartype is_protected: bool + :ivar lifecycle_state: Views lifecycleState. Known values are: "Active", "Deleted", "Deleting", + and "Updating". + :vartype lifecycle_state: str or + ~azure.mgmt.oracledatabase.models.DnsPrivateViewsLifecycleState + :ivar self_property: The canonical absolute URL of the resource. Required. + :vartype self_property: str + :ivar time_created: views timeCreated. Required. + :vartype time_created: ~datetime.datetime + :ivar time_updated: views timeCreated. Required. + :vartype time_updated: ~datetime.datetime + :ivar provisioning_state: Azure resource provisioning state. Known values are: "Succeeded", + "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.oracledatabase.models.ResourceProvisioningState + """ + + _validation = { + "ocid": {"required": True, "readonly": True, "max_length": 255, "min_length": 1}, + "display_name": {"readonly": True}, + "is_protected": {"required": True, "readonly": True}, + "lifecycle_state": {"readonly": True}, + "self_property": {"required": True, "readonly": True}, + "time_created": {"required": True, "readonly": True}, + "time_updated": {"required": True, "readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "ocid": {"key": "ocid", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "is_protected": {"key": "isProtected", "type": "bool"}, + "lifecycle_state": {"key": "lifecycleState", "type": "str"}, + "self_property": {"key": "self", "type": "str"}, + "time_created": {"key": "timeCreated", "type": "iso-8601"}, + "time_updated": {"key": "timeUpdated", "type": "iso-8601"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.ocid = None + self.display_name = None + self.is_protected = None + self.lifecycle_state = None + self.self_property = None + self.time_created = None + self.time_updated = None + self.provisioning_state = None + + +class DnsPrivateZone(ProxyResource): + """DnsPrivateZone resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.oracledatabase.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.oracledatabase.models.DnsPrivateZoneProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "DnsPrivateZoneProperties"}, + } + + def __init__(self, *, properties: Optional["_models.DnsPrivateZoneProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.oracledatabase.models.DnsPrivateZoneProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class DnsPrivateZoneListResult(_serialization.Model): + """The response of a DnsPrivateZone list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: The DnsPrivateZone items on this page. Required. + :vartype value: list[~azure.mgmt.oracledatabase.models.DnsPrivateZone] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DnsPrivateZone]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.DnsPrivateZone"], **kwargs: Any) -> None: + """ + :keyword value: The DnsPrivateZone items on this page. Required. + :paramtype value: list[~azure.mgmt.oracledatabase.models.DnsPrivateZone] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class DnsPrivateZoneProperties(_serialization.Model): + """Zones resource model. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar ocid: The OCID of the Zone. Required. + :vartype ocid: str + :ivar is_protected: A Boolean flag indicating whether or not parts of the resource are unable + to be explicitly managed. Required. + :vartype is_protected: bool + :ivar lifecycle_state: Zones lifecycleState. Known values are: "Active", "Creating", "Deleted", + "Deleting", and "Updating". + :vartype lifecycle_state: str or + ~azure.mgmt.oracledatabase.models.DnsPrivateZonesLifecycleState + :ivar self_property: The canonical absolute URL of the resource. Required. + :vartype self_property: str + :ivar serial: The current serial of the zone. As seen in the zone's SOA record. Required. + :vartype serial: int + :ivar version: Version is the never-repeating, totally-orderable, version of the zone, from + which the serial field of the zone's SOA record is derived. Required. + :vartype version: str + :ivar view_id: The OCID of the private view containing the zone. This value will be null for + zones in the global DNS, which are publicly resolvable and not part of a private view. + :vartype view_id: str + :ivar zone_type: The type of the zone. Must be either PRIMARY or SECONDARY. SECONDARY is only + supported for GLOBAL zones. Required. Known values are: "Primary" and "Secondary". + :vartype zone_type: str or ~azure.mgmt.oracledatabase.models.ZoneType + :ivar time_created: Zones timeCreated. Required. + :vartype time_created: ~datetime.datetime + :ivar provisioning_state: Azure resource provisioning state. Known values are: "Succeeded", + "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.oracledatabase.models.ResourceProvisioningState + """ + + _validation = { + "ocid": {"required": True, "readonly": True, "max_length": 255, "min_length": 1}, + "is_protected": {"required": True, "readonly": True}, + "lifecycle_state": {"readonly": True}, + "self_property": {"required": True, "readonly": True}, + "serial": {"required": True, "readonly": True}, + "version": {"required": True, "readonly": True}, + "view_id": {"readonly": True, "max_length": 255, "min_length": 1}, + "zone_type": {"required": True, "readonly": True}, + "time_created": {"required": True, "readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "ocid": {"key": "ocid", "type": "str"}, + "is_protected": {"key": "isProtected", "type": "bool"}, + "lifecycle_state": {"key": "lifecycleState", "type": "str"}, + "self_property": {"key": "self", "type": "str"}, + "serial": {"key": "serial", "type": "int"}, + "version": {"key": "version", "type": "str"}, + "view_id": {"key": "viewId", "type": "str"}, + "zone_type": {"key": "zoneType", "type": "str"}, + "time_created": {"key": "timeCreated", "type": "iso-8601"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.ocid = None + self.is_protected = None + self.lifecycle_state = None + self.self_property = None + self.serial = None + self.version = None + self.view_id = None + self.zone_type = None + self.time_created = None + self.provisioning_state = None + + +class ErrorAdditionalInfo(_serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: JSON + """ + + _validation = { + "type": {"readonly": True}, + "info": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(_serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.oracledatabase.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.oracledatabase.models.ErrorAdditionalInfo] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDetail]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(_serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.oracledatabase.models.ErrorDetail + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.oracledatabase.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class EstimatedPatchingTime(_serialization.Model): + """The estimated total time required in minutes for all patching operations (database server, + storage server, and network switch patching). + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar estimated_db_server_patching_time: The estimated time required in minutes for database + server patching. + :vartype estimated_db_server_patching_time: int + :ivar estimated_network_switches_patching_time: The estimated time required in minutes for + network switch patching. + :vartype estimated_network_switches_patching_time: int + :ivar estimated_storage_server_patching_time: The estimated time required in minutes for + storage server patching. + :vartype estimated_storage_server_patching_time: int + :ivar total_estimated_patching_time: The estimated total time required in minutes for all + patching operations. + :vartype total_estimated_patching_time: int + """ + + _validation = { + "estimated_db_server_patching_time": {"readonly": True, "maximum": 3000, "minimum": 1}, + "estimated_network_switches_patching_time": {"readonly": True, "maximum": 3000, "minimum": 1}, + "estimated_storage_server_patching_time": {"readonly": True, "maximum": 3000, "minimum": 1}, + "total_estimated_patching_time": {"readonly": True, "maximum": 3000, "minimum": 1}, + } + + _attribute_map = { + "estimated_db_server_patching_time": {"key": "estimatedDbServerPatchingTime", "type": "int"}, + "estimated_network_switches_patching_time": {"key": "estimatedNetworkSwitchesPatchingTime", "type": "int"}, + "estimated_storage_server_patching_time": {"key": "estimatedStorageServerPatchingTime", "type": "int"}, + "total_estimated_patching_time": {"key": "totalEstimatedPatchingTime", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.estimated_db_server_patching_time = None + self.estimated_network_switches_patching_time = None + self.estimated_storage_server_patching_time = None + self.total_estimated_patching_time = None + + +class ExadataIormConfig(_serialization.Model): + """ExadataIormConfig for cloud vm cluster. + + :ivar db_plans: An array of IORM settings for all the database in the Exadata DB system. + :vartype db_plans: list[~azure.mgmt.oracledatabase.models.DbIormConfig] + :ivar lifecycle_details: Additional information about the current lifecycleState. + :vartype lifecycle_details: str + :ivar lifecycle_state: The current state of IORM configuration for the Exadata DB system. Known + values are: "BootStrapping", "Enabled", "Disabled", "Updating", and "Failed". + :vartype lifecycle_state: str or ~azure.mgmt.oracledatabase.models.IormLifecycleState + :ivar objective: The current value for the IORM objective. The default is AUTO. Known values + are: "LowLatency", "HighThroughput", "Balanced", "Auto", and "Basic". + :vartype objective: str or ~azure.mgmt.oracledatabase.models.Objective + """ + + _attribute_map = { + "db_plans": {"key": "dbPlans", "type": "[DbIormConfig]"}, + "lifecycle_details": {"key": "lifecycleDetails", "type": "str"}, + "lifecycle_state": {"key": "lifecycleState", "type": "str"}, + "objective": {"key": "objective", "type": "str"}, + } + + def __init__( + self, + *, + db_plans: Optional[List["_models.DbIormConfig"]] = None, + lifecycle_details: Optional[str] = None, + lifecycle_state: Optional[Union[str, "_models.IormLifecycleState"]] = None, + objective: Optional[Union[str, "_models.Objective"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword db_plans: An array of IORM settings for all the database in the Exadata DB system. + :paramtype db_plans: list[~azure.mgmt.oracledatabase.models.DbIormConfig] + :keyword lifecycle_details: Additional information about the current lifecycleState. + :paramtype lifecycle_details: str + :keyword lifecycle_state: The current state of IORM configuration for the Exadata DB system. + Known values are: "BootStrapping", "Enabled", "Disabled", "Updating", and "Failed". + :paramtype lifecycle_state: str or ~azure.mgmt.oracledatabase.models.IormLifecycleState + :keyword objective: The current value for the IORM objective. The default is AUTO. Known values + are: "LowLatency", "HighThroughput", "Balanced", "Auto", and "Basic". + :paramtype objective: str or ~azure.mgmt.oracledatabase.models.Objective + """ + super().__init__(**kwargs) + self.db_plans = db_plans + self.lifecycle_details = lifecycle_details + self.lifecycle_state = lifecycle_state + self.objective = objective + + +class GenerateAutonomousDatabaseWalletDetails(_serialization.Model): + """Autonomous Database Generate Wallet resource model. + + All required parameters must be populated in order to send to server. + + :ivar generate_type: The type of wallet to generate. Known values are: "Single" and "All". + :vartype generate_type: str or ~azure.mgmt.oracledatabase.models.GenerateType + :ivar is_regional: True when requesting regional connection strings in PDB connect info, + applicable to cross-region DG only. + :vartype is_regional: bool + :ivar password: The password to encrypt the keys inside the wallet. Required. + :vartype password: str + """ + + _validation = { + "password": {"required": True}, + } + + _attribute_map = { + "generate_type": {"key": "generateType", "type": "str"}, + "is_regional": {"key": "isRegional", "type": "bool"}, + "password": {"key": "password", "type": "str"}, + } + + def __init__( + self, + *, + password: str, + generate_type: Optional[Union[str, "_models.GenerateType"]] = None, + is_regional: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword generate_type: The type of wallet to generate. Known values are: "Single" and "All". + :paramtype generate_type: str or ~azure.mgmt.oracledatabase.models.GenerateType + :keyword is_regional: True when requesting regional connection strings in PDB connect info, + applicable to cross-region DG only. + :paramtype is_regional: bool + :keyword password: The password to encrypt the keys inside the wallet. Required. + :paramtype password: str + """ + super().__init__(**kwargs) + self.generate_type = generate_type + self.is_regional = is_regional + self.password = password + + +class GiVersion(ProxyResource): + """GiVersion resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.oracledatabase.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.oracledatabase.models.GiVersionProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "GiVersionProperties"}, + } + + def __init__(self, *, properties: Optional["_models.GiVersionProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.oracledatabase.models.GiVersionProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class GiVersionListResult(_serialization.Model): + """The response of a GiVersion list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: The GiVersion items on this page. Required. + :vartype value: list[~azure.mgmt.oracledatabase.models.GiVersion] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[GiVersion]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.GiVersion"], **kwargs: Any) -> None: + """ + :keyword value: The GiVersion items on this page. Required. + :paramtype value: list[~azure.mgmt.oracledatabase.models.GiVersion] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class GiVersionProperties(_serialization.Model): + """GiVersion resource model. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar version: A valid Oracle Grid Infrastructure (GI) software version. Required. + :vartype version: str + """ + + _validation = { + "version": {"required": True, "readonly": True, "max_length": 255, "min_length": 1}, + } + + _attribute_map = { + "version": {"key": "version", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.version = None + + +class MaintenanceWindow(_serialization.Model): + """MaintenanceWindow resource properties. + + :ivar preference: The maintenance window scheduling preference. Known values are: + "NoPreference" and "CustomPreference". + :vartype preference: str or ~azure.mgmt.oracledatabase.models.Preference + :ivar months: Months during the year when maintenance should be performed. + :vartype months: list[~azure.mgmt.oracledatabase.models.Month] + :ivar 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. + :vartype weeks_of_month: list[int] + :ivar days_of_week: Days during the week when maintenance should be performed. + :vartype days_of_week: list[~azure.mgmt.oracledatabase.models.DayOfWeek] + :ivar 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. + :vartype hours_of_day: list[int] + :ivar 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. + :vartype lead_time_in_weeks: int + :ivar patching_mode: Cloud Exadata infrastructure node patching method. Known values are: + "Rolling" and "NonRolling". + :vartype patching_mode: str or ~azure.mgmt.oracledatabase.models.PatchingMode + :ivar 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). + :vartype custom_action_timeout_in_mins: int + :ivar is_custom_action_timeout_enabled: If true, enables the configuration of a custom action + timeout (waiting period) between database server patching operations. + :vartype is_custom_action_timeout_enabled: bool + :ivar is_monthly_patching_enabled: is Monthly Patching Enabled. + :vartype is_monthly_patching_enabled: bool + """ + + _validation = { + "custom_action_timeout_in_mins": {"maximum": 120, "minimum": 0}, + } + + _attribute_map = { + "preference": {"key": "preference", "type": "str"}, + "months": {"key": "months", "type": "[Month]"}, + "weeks_of_month": {"key": "weeksOfMonth", "type": "[int]"}, + "days_of_week": {"key": "daysOfWeek", "type": "[DayOfWeek]"}, + "hours_of_day": {"key": "hoursOfDay", "type": "[int]"}, + "lead_time_in_weeks": {"key": "leadTimeInWeeks", "type": "int"}, + "patching_mode": {"key": "patchingMode", "type": "str"}, + "custom_action_timeout_in_mins": {"key": "customActionTimeoutInMins", "type": "int"}, + "is_custom_action_timeout_enabled": {"key": "isCustomActionTimeoutEnabled", "type": "bool"}, + "is_monthly_patching_enabled": {"key": "isMonthlyPatchingEnabled", "type": "bool"}, + } + + def __init__( + self, + *, + preference: Optional[Union[str, "_models.Preference"]] = None, + months: Optional[List["_models.Month"]] = None, + weeks_of_month: Optional[List[int]] = None, + days_of_week: Optional[List["_models.DayOfWeek"]] = None, + hours_of_day: Optional[List[int]] = None, + lead_time_in_weeks: Optional[int] = None, + patching_mode: Optional[Union[str, "_models.PatchingMode"]] = None, + custom_action_timeout_in_mins: Optional[int] = None, + is_custom_action_timeout_enabled: Optional[bool] = None, + is_monthly_patching_enabled: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword preference: The maintenance window scheduling preference. Known values are: + "NoPreference" and "CustomPreference". + :paramtype preference: str or ~azure.mgmt.oracledatabase.models.Preference + :keyword months: Months during the year when maintenance should be performed. + :paramtype months: list[~azure.mgmt.oracledatabase.models.Month] + :keyword 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. + :paramtype weeks_of_month: list[int] + :keyword days_of_week: Days during the week when maintenance should be performed. + :paramtype days_of_week: list[~azure.mgmt.oracledatabase.models.DayOfWeek] + :keyword 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. + :paramtype hours_of_day: list[int] + :keyword 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. + :paramtype lead_time_in_weeks: int + :keyword patching_mode: Cloud Exadata infrastructure node patching method. Known values are: + "Rolling" and "NonRolling". + :paramtype patching_mode: str or ~azure.mgmt.oracledatabase.models.PatchingMode + :keyword 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). + :paramtype custom_action_timeout_in_mins: int + :keyword is_custom_action_timeout_enabled: If true, enables the configuration of a custom + action timeout (waiting period) between database server patching operations. + :paramtype is_custom_action_timeout_enabled: bool + :keyword is_monthly_patching_enabled: is Monthly Patching Enabled. + :paramtype is_monthly_patching_enabled: bool + """ + super().__init__(**kwargs) + self.preference = preference + self.months = months + self.weeks_of_month = weeks_of_month + self.days_of_week = days_of_week + self.hours_of_day = hours_of_day + self.lead_time_in_weeks = lead_time_in_weeks + self.patching_mode = patching_mode + self.custom_action_timeout_in_mins = custom_action_timeout_in_mins + self.is_custom_action_timeout_enabled = is_custom_action_timeout_enabled + self.is_monthly_patching_enabled = is_monthly_patching_enabled + + +class Month(_serialization.Model): + """Month resource properties. + + All required parameters must be populated in order to send to server. + + :ivar name: Name of the month of the year. Required. Known values are: "January", "February", + "March", "April", "May", "June", "July", "August", "September", "October", "November", and + "December". + :vartype name: str or ~azure.mgmt.oracledatabase.models.MonthName + """ + + _validation = { + "name": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, name: Union[str, "_models.MonthName"], **kwargs: Any) -> None: + """ + :keyword name: Name of the month of the year. Required. Known values are: "January", + "February", "March", "April", "May", "June", "July", "August", "September", "October", + "November", and "December". + :paramtype name: str or ~azure.mgmt.oracledatabase.models.MonthName + """ + super().__init__(**kwargs) + self.name = name + + +class NSGCidr(_serialization.Model): + """A rule for allowing inbound (INGRESS) IP packets. + + All required parameters must be populated in order to send to server. + + :ivar source: Conceptually, this is the range of IP addresses that a packet coming into the + instance can come from. Required. + :vartype source: str + :ivar destination_port_range: Destination port range to specify particular destination ports + for TCP rules. + :vartype destination_port_range: ~azure.mgmt.oracledatabase.models.PortRange + """ + + _validation = { + "source": {"required": True, "max_length": 128, "min_length": 1}, + } + + _attribute_map = { + "source": {"key": "source", "type": "str"}, + "destination_port_range": {"key": "destinationPortRange", "type": "PortRange"}, + } + + def __init__( + self, *, source: str, destination_port_range: Optional["_models.PortRange"] = None, **kwargs: Any + ) -> None: + """ + :keyword source: Conceptually, this is the range of IP addresses that a packet coming into the + instance can come from. Required. + :paramtype source: str + :keyword destination_port_range: Destination port range to specify particular destination ports + for TCP rules. + :paramtype destination_port_range: ~azure.mgmt.oracledatabase.models.PortRange + """ + super().__init__(**kwargs) + self.source = source + self.destination_port_range = destination_port_range + + +class Operation(_serialization.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.oracledatabase.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + and "user,system". + :vartype origin: str or ~azure.mgmt.oracledatabase.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. "Internal" + :vartype action_type: str or ~azure.mgmt.oracledatabase.models.ActionType + """ + + _validation = { + "name": {"readonly": True}, + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + "action_type": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + "display": {"key": "display", "type": "OperationDisplay"}, + "origin": {"key": "origin", "type": "str"}, + "action_type": {"key": "actionType", "type": "str"}, + } + + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.oracledatabase.models.OperationDisplay + """ + super().__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None + + +class OperationDisplay(_serialization.Model): + """Localized display information for this particular operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + _validation = { + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationListResult(_serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link + to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.oracledatabase.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class OracleSubscription(ProxyResource): + """OracleSubscription resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.oracledatabase.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.oracledatabase.models.OracleSubscriptionProperties + :ivar plan: Details of the resource plan. + :vartype plan: ~azure.mgmt.oracledatabase.models.Plan + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "OracleSubscriptionProperties"}, + "plan": {"key": "plan", "type": "Plan"}, + } + + def __init__( + self, + *, + properties: Optional["_models.OracleSubscriptionProperties"] = None, + plan: Optional["_models.Plan"] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.oracledatabase.models.OracleSubscriptionProperties + :keyword plan: Details of the resource plan. + :paramtype plan: ~azure.mgmt.oracledatabase.models.Plan + """ + super().__init__(**kwargs) + self.properties = properties + self.plan = plan + + +class OracleSubscriptionListResult(_serialization.Model): + """The response of a OracleSubscription list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: The OracleSubscription items on this page. Required. + :vartype value: list[~azure.mgmt.oracledatabase.models.OracleSubscription] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[OracleSubscription]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.OracleSubscription"], **kwargs: Any) -> None: + """ + :keyword value: The OracleSubscription items on this page. Required. + :paramtype value: list[~azure.mgmt.oracledatabase.models.OracleSubscription] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class OracleSubscriptionProperties(_serialization.Model): + """Oracle Subscription resource model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: OracleSubscriptionProvisioningState provisioning state. Known values + are: "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.oracledatabase.models.OracleSubscriptionProvisioningState + :ivar saas_subscription_id: SAAS subscription ID generated by Marketplace. + :vartype saas_subscription_id: str + :ivar cloud_account_id: Cloud Account Id. + :vartype cloud_account_id: str + :ivar cloud_account_state: Cloud Account provisioning state. Known values are: "Pending", + "Provisioning", and "Available". + :vartype cloud_account_state: str or + ~azure.mgmt.oracledatabase.models.CloudAccountProvisioningState + :ivar term_unit: Term Unit. P1Y, P3Y, etc, see Durations + https://en.wikipedia.org/wiki/ISO_8601. + :vartype term_unit: str + :ivar product_code: Product code for the term unit. + :vartype product_code: str + :ivar intent: Intent for the update operation. Known values are: "Retain" and "Reset". + :vartype intent: str or ~azure.mgmt.oracledatabase.models.Intent + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "saas_subscription_id": {"readonly": True}, + "cloud_account_id": {"readonly": True, "max_length": 255, "min_length": 1}, + "cloud_account_state": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "saas_subscription_id": {"key": "saasSubscriptionId", "type": "str"}, + "cloud_account_id": {"key": "cloudAccountId", "type": "str"}, + "cloud_account_state": {"key": "cloudAccountState", "type": "str"}, + "term_unit": {"key": "termUnit", "type": "str"}, + "product_code": {"key": "productCode", "type": "str"}, + "intent": {"key": "intent", "type": "str"}, + } + + def __init__( + self, + *, + term_unit: Optional[str] = None, + product_code: Optional[str] = None, + intent: Optional[Union[str, "_models.Intent"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword term_unit: Term Unit. P1Y, P3Y, etc, see Durations + https://en.wikipedia.org/wiki/ISO_8601. + :paramtype term_unit: str + :keyword product_code: Product code for the term unit. + :paramtype product_code: str + :keyword intent: Intent for the update operation. Known values are: "Retain" and "Reset". + :paramtype intent: str or ~azure.mgmt.oracledatabase.models.Intent + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.saas_subscription_id = None + self.cloud_account_id = None + self.cloud_account_state = None + self.term_unit = term_unit + self.product_code = product_code + self.intent = intent + + +class OracleSubscriptionUpdate(_serialization.Model): + """The type used for update operations of the OracleSubscription. + + :ivar plan: Details of the resource plan. + :vartype plan: ~azure.mgmt.oracledatabase.models.ResourcePlanTypeUpdate + :ivar properties: The updatable properties of the OracleSubscription. + :vartype properties: ~azure.mgmt.oracledatabase.models.OracleSubscriptionUpdateProperties + """ + + _attribute_map = { + "plan": {"key": "plan", "type": "ResourcePlanTypeUpdate"}, + "properties": {"key": "properties", "type": "OracleSubscriptionUpdateProperties"}, + } + + def __init__( + self, + *, + plan: Optional["_models.ResourcePlanTypeUpdate"] = None, + properties: Optional["_models.OracleSubscriptionUpdateProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword plan: Details of the resource plan. + :paramtype plan: ~azure.mgmt.oracledatabase.models.ResourcePlanTypeUpdate + :keyword properties: The updatable properties of the OracleSubscription. + :paramtype properties: ~azure.mgmt.oracledatabase.models.OracleSubscriptionUpdateProperties + """ + super().__init__(**kwargs) + self.plan = plan + self.properties = properties + + +class OracleSubscriptionUpdateProperties(_serialization.Model): + """The updatable properties of the OracleSubscription. + + :ivar product_code: Product code for the term unit. + :vartype product_code: str + :ivar intent: Intent for the update operation. Known values are: "Retain" and "Reset". + :vartype intent: str or ~azure.mgmt.oracledatabase.models.Intent + """ + + _attribute_map = { + "product_code": {"key": "productCode", "type": "str"}, + "intent": {"key": "intent", "type": "str"}, + } + + def __init__( + self, + *, + product_code: Optional[str] = None, + intent: Optional[Union[str, "_models.Intent"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword product_code: Product code for the term unit. + :paramtype product_code: str + :keyword intent: Intent for the update operation. Known values are: "Retain" and "Reset". + :paramtype intent: str or ~azure.mgmt.oracledatabase.models.Intent + """ + super().__init__(**kwargs) + self.product_code = product_code + self.intent = intent + + +class PeerDbDetails(_serialization.Model): + """PeerDb Details. + + :ivar peer_db_id: The database OCID of the Disaster Recovery peer database, which is located in + a different region from the current peer database. + :vartype peer_db_id: str + """ + + _validation = { + "peer_db_id": {"max_length": 255, "min_length": 1}, + } + + _attribute_map = { + "peer_db_id": {"key": "peerDbId", "type": "str"}, + } + + def __init__(self, *, peer_db_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword peer_db_id: The database OCID of the Disaster Recovery peer database, which is located + in a different region from the current peer database. + :paramtype peer_db_id: str + """ + super().__init__(**kwargs) + self.peer_db_id = peer_db_id + + +class Plan(_serialization.Model): + """Plan for the resource. + + All required parameters must be populated in order to send to server. + + :ivar name: A user defined name of the 3rd Party Artifact that is being procured. Required. + :vartype name: str + :ivar publisher: The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic. + Required. + :vartype publisher: str + :ivar product: The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to + the OfferID specified for the artifact at the time of Data Market onboarding. Required. + :vartype product: str + :ivar promotion_code: A publisher provided promotion code as provisioned in Data Market for the + said product/artifact. + :vartype promotion_code: str + :ivar version: The version of the desired product/artifact. + :vartype version: str + """ + + _validation = { + "name": {"required": True}, + "publisher": {"required": True}, + "product": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, + "product": {"key": "product", "type": "str"}, + "promotion_code": {"key": "promotionCode", "type": "str"}, + "version": {"key": "version", "type": "str"}, + } + + def __init__( + self, + *, + name: str, + publisher: str, + product: str, + promotion_code: Optional[str] = None, + version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: A user defined name of the 3rd Party Artifact that is being procured. Required. + :paramtype name: str + :keyword publisher: The publisher of the 3rd Party Artifact that is being bought. E.g. + NewRelic. Required. + :paramtype publisher: str + :keyword product: The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to + the OfferID specified for the artifact at the time of Data Market onboarding. Required. + :paramtype product: str + :keyword promotion_code: A publisher provided promotion code as provisioned in Data Market for + the said product/artifact. + :paramtype promotion_code: str + :keyword version: The version of the desired product/artifact. + :paramtype version: str + """ + super().__init__(**kwargs) + self.name = name + self.publisher = publisher + self.product = product + self.promotion_code = promotion_code + self.version = version + + +class PortRange(_serialization.Model): + """Port Range to specify particular destination ports for TCP rules. + + All required parameters must be populated in order to send to server. + + :ivar min: The minimum port number, which must not be greater than the maximum port number. + Required. + :vartype min: int + :ivar max: The maximum port number, which must not be less than the minimum port number. To + specify a single port number, set both the min and max to the same value. Required. + :vartype max: int + """ + + _validation = { + "min": {"required": True, "maximum": 65535, "minimum": 1}, + "max": {"required": True, "maximum": 65535, "minimum": 1}, + } + + _attribute_map = { + "min": {"key": "min", "type": "int"}, + "max": {"key": "max", "type": "int"}, + } + + def __init__( + self, + *, + min: int, # pylint: disable=redefined-builtin + max: int, # pylint: disable=redefined-builtin + **kwargs: Any + ) -> None: + """ + :keyword min: The minimum port number, which must not be greater than the maximum port number. + Required. + :paramtype min: int + :keyword max: The maximum port number, which must not be less than the minimum port number. To + specify a single port number, set both the min and max to the same value. Required. + :paramtype max: int + """ + super().__init__(**kwargs) + self.min = min + self.max = max + + +class PrivateIpAddressesFilter(_serialization.Model): + """Private Ip Addresses filter. + + All required parameters must be populated in order to send to server. + + :ivar subnet_id: Subnet OCID. Required. + :vartype subnet_id: str + :ivar vnic_id: VCN OCID. Required. + :vartype vnic_id: str + """ + + _validation = { + "subnet_id": {"required": True, "max_length": 255, "min_length": 1}, + "vnic_id": {"required": True, "max_length": 255, "min_length": 1}, + } + + _attribute_map = { + "subnet_id": {"key": "subnetId", "type": "str"}, + "vnic_id": {"key": "vnicId", "type": "str"}, + } + + def __init__(self, *, subnet_id: str, vnic_id: str, **kwargs: Any) -> None: + """ + :keyword subnet_id: Subnet OCID. Required. + :paramtype subnet_id: str + :keyword vnic_id: VCN OCID. Required. + :paramtype vnic_id: str + """ + super().__init__(**kwargs) + self.subnet_id = subnet_id + self.vnic_id = vnic_id + + +class PrivateIpAddressProperties(_serialization.Model): + """PrivateIpAddress resource properties. + + All required parameters must be populated in order to send to server. + + :ivar display_name: PrivateIpAddresses displayName. Required. + :vartype display_name: str + :ivar hostname_label: PrivateIpAddresses hostnameLabel. Required. + :vartype hostname_label: str + :ivar ocid: PrivateIpAddresses Id. Required. + :vartype ocid: str + :ivar ip_address: PrivateIpAddresses ipAddress. Required. + :vartype ip_address: str + :ivar subnet_id: PrivateIpAddresses subnetId. Required. + :vartype subnet_id: str + """ + + _validation = { + "display_name": {"required": True}, + "hostname_label": {"required": True}, + "ocid": {"required": True, "max_length": 255, "min_length": 1}, + "ip_address": {"required": True}, + "subnet_id": {"required": True, "max_length": 255, "min_length": 1}, + } + + _attribute_map = { + "display_name": {"key": "displayName", "type": "str"}, + "hostname_label": {"key": "hostnameLabel", "type": "str"}, + "ocid": {"key": "ocid", "type": "str"}, + "ip_address": {"key": "ipAddress", "type": "str"}, + "subnet_id": {"key": "subnetId", "type": "str"}, + } + + def __init__( + self, *, display_name: str, hostname_label: str, ocid: str, ip_address: str, subnet_id: str, **kwargs: Any + ) -> None: + """ + :keyword display_name: PrivateIpAddresses displayName. Required. + :paramtype display_name: str + :keyword hostname_label: PrivateIpAddresses hostnameLabel. Required. + :paramtype hostname_label: str + :keyword ocid: PrivateIpAddresses Id. Required. + :paramtype ocid: str + :keyword ip_address: PrivateIpAddresses ipAddress. Required. + :paramtype ip_address: str + :keyword subnet_id: PrivateIpAddresses subnetId. Required. + :paramtype subnet_id: str + """ + super().__init__(**kwargs) + self.display_name = display_name + self.hostname_label = hostname_label + self.ocid = ocid + self.ip_address = ip_address + self.subnet_id = subnet_id + + +class ProfileType(_serialization.Model): + """The connection string profile to allow clients to group, filter and select connection string + values based on structured metadata. + + All required parameters must be populated in order to send to server. + + :ivar consumer_group: Consumer group used by the connection. Known values are: "High", + "Medium", "Low", "Tp", and "Tpurgent". + :vartype consumer_group: str or ~azure.mgmt.oracledatabase.models.ConsumerGroup + :ivar display_name: A user-friendly name for the connection. Required. + :vartype display_name: str + :ivar host_format: Host format used in connection string. Required. Known values are: "Fqdn" + and "Ip". + :vartype host_format: str or ~azure.mgmt.oracledatabase.models.HostFormatType + :ivar is_regional: True for a regional connection string, applicable to cross-region DG only. + :vartype is_regional: bool + :ivar protocol: Protocol used by the connection. Required. Known values are: "TCP" and "TCPS". + :vartype protocol: str or ~azure.mgmt.oracledatabase.models.ProtocolType + :ivar session_mode: Specifies whether the listener performs a direct hand-off of the session, + or redirects the session. Required. Known values are: "Direct" and "Redirect". + :vartype session_mode: str or ~azure.mgmt.oracledatabase.models.SessionModeType + :ivar syntax_format: Specifies whether the connection string is using the long (LONG), Easy + Connect (EZCONNECT), or Easy Connect Plus (EZCONNECTPLUS) format. Required. Known values are: + "Long", "Ezconnect", and "Ezconnectplus". + :vartype syntax_format: str or ~azure.mgmt.oracledatabase.models.SyntaxFormatType + :ivar tls_authentication: Specifies whether the TLS handshake is using one-way (SERVER) or + mutual (MUTUAL) authentication. Known values are: "Server" and "Mutual". + :vartype tls_authentication: str or ~azure.mgmt.oracledatabase.models.TlsAuthenticationType + :ivar value: Connection string value. Required. + :vartype value: str + """ + + _validation = { + "display_name": {"required": True, "max_length": 255, "min_length": 1}, + "host_format": {"required": True}, + "protocol": {"required": True}, + "session_mode": {"required": True}, + "syntax_format": {"required": True}, + "value": {"required": True}, + } + + _attribute_map = { + "consumer_group": {"key": "consumerGroup", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "host_format": {"key": "hostFormat", "type": "str"}, + "is_regional": {"key": "isRegional", "type": "bool"}, + "protocol": {"key": "protocol", "type": "str"}, + "session_mode": {"key": "sessionMode", "type": "str"}, + "syntax_format": {"key": "syntaxFormat", "type": "str"}, + "tls_authentication": {"key": "tlsAuthentication", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__( + self, + *, + display_name: str, + host_format: Union[str, "_models.HostFormatType"], + protocol: Union[str, "_models.ProtocolType"], + session_mode: Union[str, "_models.SessionModeType"], + syntax_format: Union[str, "_models.SyntaxFormatType"], + value: str, + consumer_group: Optional[Union[str, "_models.ConsumerGroup"]] = None, + is_regional: Optional[bool] = None, + tls_authentication: Optional[Union[str, "_models.TlsAuthenticationType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword consumer_group: Consumer group used by the connection. Known values are: "High", + "Medium", "Low", "Tp", and "Tpurgent". + :paramtype consumer_group: str or ~azure.mgmt.oracledatabase.models.ConsumerGroup + :keyword display_name: A user-friendly name for the connection. Required. + :paramtype display_name: str + :keyword host_format: Host format used in connection string. Required. Known values are: "Fqdn" + and "Ip". + :paramtype host_format: str or ~azure.mgmt.oracledatabase.models.HostFormatType + :keyword is_regional: True for a regional connection string, applicable to cross-region DG + only. + :paramtype is_regional: bool + :keyword protocol: Protocol used by the connection. Required. Known values are: "TCP" and + "TCPS". + :paramtype protocol: str or ~azure.mgmt.oracledatabase.models.ProtocolType + :keyword session_mode: Specifies whether the listener performs a direct hand-off of the + session, or redirects the session. Required. Known values are: "Direct" and "Redirect". + :paramtype session_mode: str or ~azure.mgmt.oracledatabase.models.SessionModeType + :keyword syntax_format: Specifies whether the connection string is using the long (LONG), Easy + Connect (EZCONNECT), or Easy Connect Plus (EZCONNECTPLUS) format. Required. Known values are: + "Long", "Ezconnect", and "Ezconnectplus". + :paramtype syntax_format: str or ~azure.mgmt.oracledatabase.models.SyntaxFormatType + :keyword tls_authentication: Specifies whether the TLS handshake is using one-way (SERVER) or + mutual (MUTUAL) authentication. Known values are: "Server" and "Mutual". + :paramtype tls_authentication: str or ~azure.mgmt.oracledatabase.models.TlsAuthenticationType + :keyword value: Connection string value. Required. + :paramtype value: str + """ + super().__init__(**kwargs) + self.consumer_group = consumer_group + self.display_name = display_name + self.host_format = host_format + self.is_regional = is_regional + self.protocol = protocol + self.session_mode = session_mode + self.syntax_format = syntax_format + self.tls_authentication = tls_authentication + self.value = value + + +class ResourcePlanTypeUpdate(_serialization.Model): + """ResourcePlanTypeUpdate model definition. + + :ivar name: A user defined name of the 3rd Party Artifact that is being procured. + :vartype name: str + :ivar publisher: The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic. + :vartype publisher: str + :ivar product: The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to + the OfferID specified for the artifact at the time of Data Market onboarding. + :vartype product: str + :ivar promotion_code: A publisher provided promotion code as provisioned in Data Market for the + said product/artifact. + :vartype promotion_code: str + :ivar version: The version of the desired product/artifact. + :vartype version: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, + "product": {"key": "product", "type": "str"}, + "promotion_code": {"key": "promotionCode", "type": "str"}, + "version": {"key": "version", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + publisher: Optional[str] = None, + product: Optional[str] = None, + promotion_code: Optional[str] = None, + version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: A user defined name of the 3rd Party Artifact that is being procured. + :paramtype name: str + :keyword publisher: The publisher of the 3rd Party Artifact that is being bought. E.g. + NewRelic. + :paramtype publisher: str + :keyword product: The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to + the OfferID specified for the artifact at the time of Data Market onboarding. + :paramtype product: str + :keyword promotion_code: A publisher provided promotion code as provisioned in Data Market for + the said product/artifact. + :paramtype promotion_code: str + :keyword version: The version of the desired product/artifact. + :paramtype version: str + """ + super().__init__(**kwargs) + self.name = name + self.publisher = publisher + self.product = product + self.promotion_code = promotion_code + self.version = version + + +class SaasSubscriptionDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes + """SaaS Subscription Details model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Purchased SaaS subscription ID. + :vartype id: str + :ivar subscription_name: SaaS subscription name. + :vartype subscription_name: str + :ivar time_created: Creation Date and Time. + :vartype time_created: ~datetime.datetime + :ivar offer_id: Purchased offer ID. + :vartype offer_id: str + :ivar plan_id: Purchased offer's plan ID. + :vartype plan_id: str + :ivar saas_subscription_status: Indicates the status of the Subscription. + :vartype saas_subscription_status: str + :ivar publisher_id: Publisher ID. + :vartype publisher_id: str + :ivar purchaser_email_id: Purchaser Email ID. + :vartype purchaser_email_id: str + :ivar purchaser_tenant_id: Purchaser Tenant ID. + :vartype purchaser_tenant_id: str + :ivar term_unit: Purchase Term Unit. + :vartype term_unit: str + :ivar is_auto_renew: AutoRenew flag. + :vartype is_auto_renew: bool + :ivar is_free_trial: FreeTrial flag. + :vartype is_free_trial: bool + """ + + _validation = { + "id": {"readonly": True}, + "subscription_name": {"readonly": True}, + "time_created": {"readonly": True}, + "offer_id": {"readonly": True}, + "plan_id": {"readonly": True}, + "saas_subscription_status": {"readonly": True}, + "publisher_id": {"readonly": True}, + "purchaser_email_id": {"readonly": True}, + "purchaser_tenant_id": {"readonly": True}, + "term_unit": {"readonly": True}, + "is_auto_renew": {"readonly": True}, + "is_free_trial": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "subscription_name": {"key": "subscriptionName", "type": "str"}, + "time_created": {"key": "timeCreated", "type": "iso-8601"}, + "offer_id": {"key": "offerId", "type": "str"}, + "plan_id": {"key": "planId", "type": "str"}, + "saas_subscription_status": {"key": "saasSubscriptionStatus", "type": "str"}, + "publisher_id": {"key": "publisherId", "type": "str"}, + "purchaser_email_id": {"key": "purchaserEmailId", "type": "str"}, + "purchaser_tenant_id": {"key": "purchaserTenantId", "type": "str"}, + "term_unit": {"key": "termUnit", "type": "str"}, + "is_auto_renew": {"key": "isAutoRenew", "type": "bool"}, + "is_free_trial": {"key": "isFreeTrial", "type": "bool"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.subscription_name = None + self.time_created = None + self.offer_id = None + self.plan_id = None + self.saas_subscription_status = None + self.publisher_id = None + self.purchaser_email_id = None + self.purchaser_tenant_id = None + self.term_unit = None + self.is_auto_renew = None + self.is_free_trial = None + + +class ScheduledOperationsType(_serialization.Model): + """The list of scheduled operations. + + All required parameters must be populated in order to send to server. + + :ivar day_of_week: Day of week. Required. + :vartype day_of_week: ~azure.mgmt.oracledatabase.models.DayOfWeek + :ivar scheduled_start_time: auto start time. value must be of ISO-8601 format HH:mm. + :vartype scheduled_start_time: str + :ivar scheduled_stop_time: auto stop time. value must be of ISO-8601 format HH:mm. + :vartype scheduled_stop_time: str + """ + + _validation = { + "day_of_week": {"required": True}, + "scheduled_start_time": {"max_length": 50, "min_length": 1}, + "scheduled_stop_time": {"max_length": 50, "min_length": 1}, + } + + _attribute_map = { + "day_of_week": {"key": "dayOfWeek", "type": "DayOfWeek"}, + "scheduled_start_time": {"key": "scheduledStartTime", "type": "str"}, + "scheduled_stop_time": {"key": "scheduledStopTime", "type": "str"}, + } + + def __init__( + self, + *, + day_of_week: "_models.DayOfWeek", + scheduled_start_time: Optional[str] = None, + scheduled_stop_time: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword day_of_week: Day of week. Required. + :paramtype day_of_week: ~azure.mgmt.oracledatabase.models.DayOfWeek + :keyword scheduled_start_time: auto start time. value must be of ISO-8601 format HH:mm. + :paramtype scheduled_start_time: str + :keyword scheduled_stop_time: auto stop time. value must be of ISO-8601 format HH:mm. + :paramtype scheduled_stop_time: str + """ + super().__init__(**kwargs) + self.day_of_week = day_of_week + self.scheduled_start_time = scheduled_start_time + self.scheduled_stop_time = scheduled_stop_time + + +class ScheduledOperationsTypeUpdate(_serialization.Model): + """The list of scheduled operations. + + :ivar day_of_week: Day of week. + :vartype day_of_week: ~azure.mgmt.oracledatabase.models.DayOfWeekUpdate + :ivar scheduled_start_time: auto start time. value must be of ISO-8601 format HH:mm. + :vartype scheduled_start_time: str + :ivar scheduled_stop_time: auto stop time. value must be of ISO-8601 format HH:mm. + :vartype scheduled_stop_time: str + """ + + _validation = { + "scheduled_start_time": {"max_length": 50, "min_length": 1}, + "scheduled_stop_time": {"max_length": 50, "min_length": 1}, + } + + _attribute_map = { + "day_of_week": {"key": "dayOfWeek", "type": "DayOfWeekUpdate"}, + "scheduled_start_time": {"key": "scheduledStartTime", "type": "str"}, + "scheduled_stop_time": {"key": "scheduledStopTime", "type": "str"}, + } + + def __init__( + self, + *, + day_of_week: Optional["_models.DayOfWeekUpdate"] = None, + scheduled_start_time: Optional[str] = None, + scheduled_stop_time: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword day_of_week: Day of week. + :paramtype day_of_week: ~azure.mgmt.oracledatabase.models.DayOfWeekUpdate + :keyword scheduled_start_time: auto start time. value must be of ISO-8601 format HH:mm. + :paramtype scheduled_start_time: str + :keyword scheduled_stop_time: auto stop time. value must be of ISO-8601 format HH:mm. + :paramtype scheduled_stop_time: str + """ + super().__init__(**kwargs) + self.day_of_week = day_of_week + self.scheduled_start_time = scheduled_start_time + self.scheduled_stop_time = scheduled_stop_time + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.oracledatabase.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.oracledatabase.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or ~azure.mgmt.oracledatabase.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.oracledatabase.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class ValidationError(_serialization.Model): + """validation error. + + All required parameters must be populated in order to send to server. + + :ivar code: error code. Required. + :vartype code: str + :ivar message: error message. Required. + :vartype message: str + """ + + _validation = { + "code": {"required": True}, + "message": {"required": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, *, code: str, message: str, **kwargs: Any) -> None: + """ + :keyword code: error code. Required. + :paramtype code: str + :keyword message: error message. Required. + :paramtype message: str + """ + super().__init__(**kwargs) + self.code = code + self.message = message + + +class ValidationResult(_serialization.Model): + """validation result. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar status: validation status. Required. Known values are: "Succeeded" and "Failed". + :vartype status: str or ~azure.mgmt.oracledatabase.models.ValidationStatus + :ivar error: validation error. Required. + :vartype error: ~azure.mgmt.oracledatabase.models.ValidationError + """ + + _validation = { + "status": {"required": True, "readonly": True}, + "error": {"required": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "error": {"key": "error", "type": "ValidationError"}, + } + + def __init__(self, *, error: "_models.ValidationError", **kwargs: Any) -> None: + """ + :keyword error: validation error. Required. + :paramtype error: ~azure.mgmt.oracledatabase.models.ValidationError + """ + super().__init__(**kwargs) + self.status = None + self.error = error + + +class VirtualNetworkAddress(ProxyResource): + """Virtual IP resource belonging to a vm cluster resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.oracledatabase.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.oracledatabase.models.VirtualNetworkAddressProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "VirtualNetworkAddressProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.VirtualNetworkAddressProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.oracledatabase.models.VirtualNetworkAddressProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class VirtualNetworkAddressListResult(_serialization.Model): + """The response of a VirtualNetworkAddress list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: The VirtualNetworkAddress items on this page. Required. + :vartype value: list[~azure.mgmt.oracledatabase.models.VirtualNetworkAddress] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[VirtualNetworkAddress]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.VirtualNetworkAddress"], **kwargs: Any) -> None: + """ + :keyword value: The VirtualNetworkAddress items on this page. Required. + :paramtype value: list[~azure.mgmt.oracledatabase.models.VirtualNetworkAddress] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class VirtualNetworkAddressProperties(_serialization.Model): + """virtualNetworkAddress resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar ip_address: Virtual network Address address. + :vartype ip_address: str + :ivar vm_ocid: Virtual Machine OCID. + :vartype vm_ocid: str + :ivar ocid: Application VIP OCID. + :vartype ocid: str + :ivar domain: Virtual network address fully qualified domain name. + :vartype domain: str + :ivar lifecycle_details: Additional information about the current lifecycle state of the + application virtual IP (VIP) address. + :vartype lifecycle_details: str + :ivar provisioning_state: Azure resource provisioning state. Known values are: "Succeeded", + "Failed", "Canceled", and "Provisioning". + :vartype provisioning_state: str or + ~azure.mgmt.oracledatabase.models.AzureResourceProvisioningState + :ivar lifecycle_state: virtual network address lifecycle state. Known values are: + "Provisioning", "Available", "Terminating", "Terminated", and "Failed". + :vartype lifecycle_state: str or + ~azure.mgmt.oracledatabase.models.VirtualNetworkAddressLifecycleState + :ivar time_assigned: The date and time when the create operation for the application virtual IP + (VIP) address completed. + :vartype time_assigned: ~datetime.datetime + """ + + _validation = { + "vm_ocid": {"max_length": 255, "min_length": 1}, + "ocid": {"readonly": True, "max_length": 255, "min_length": 1}, + "domain": {"readonly": True}, + "lifecycle_details": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "lifecycle_state": {"readonly": True}, + "time_assigned": {"readonly": True}, + } + + _attribute_map = { + "ip_address": {"key": "ipAddress", "type": "str"}, + "vm_ocid": {"key": "vmOcid", "type": "str"}, + "ocid": {"key": "ocid", "type": "str"}, + "domain": {"key": "domain", "type": "str"}, + "lifecycle_details": {"key": "lifecycleDetails", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "lifecycle_state": {"key": "lifecycleState", "type": "str"}, + "time_assigned": {"key": "timeAssigned", "type": "iso-8601"}, + } + + def __init__(self, *, ip_address: Optional[str] = None, vm_ocid: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword ip_address: Virtual network Address address. + :paramtype ip_address: str + :keyword vm_ocid: Virtual Machine OCID. + :paramtype vm_ocid: str + """ + super().__init__(**kwargs) + self.ip_address = ip_address + self.vm_ocid = vm_ocid + self.ocid = None + self.domain = None + self.lifecycle_details = None + self.provisioning_state = None + self.lifecycle_state = None + self.time_assigned = None diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/models/_oracle_database_mgmt_client_enums.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/models/_oracle_database_mgmt_client_enums.py new file mode 100644 index 000000000000..5ef782836153 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/models/_oracle_database_mgmt_client_enums.py @@ -0,0 +1,704 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" + + INTERNAL = "Internal" + + +class AutonomousDatabaseBackupLifecycleState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AutonomousDatabaseBackupLifecycleState enum.""" + + CREATING = "Creating" + ACTIVE = "Active" + DELETING = "Deleting" + FAILED = "Failed" + UPDATING = "Updating" + + +class AutonomousDatabaseBackupType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AutonomousDatabaseBackupType enum.""" + + INCREMENTAL = "Incremental" + FULL = "Full" + LONG_TERM = "LongTerm" + + +class AutonomousDatabaseLifecycleState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AutonomousDatabaseLifecycleState enum.""" + + PROVISIONING = "Provisioning" + """PROVISIONING value""" + AVAILABLE = "Available" + """AVAILABLE value""" + STOPPING = "Stopping" + """STOPPING value""" + STOPPED = "Stopped" + """STOPPED value""" + STARTING = "Starting" + """STARTING value""" + TERMINATING = "Terminating" + """TERMINATING value""" + TERMINATED = "Terminated" + """TERMINATED value""" + UNAVAILABLE = "Unavailable" + """UNAVAILABLE value""" + RESTORE_IN_PROGRESS = "RestoreInProgress" + """RESTORE_IN_PROGRESS value""" + RESTORE_FAILED = "RestoreFailed" + """RESTORE_FAILED value""" + BACKUP_IN_PROGRESS = "BackupInProgress" + """BACKUP_IN_PROGRESS value""" + SCALE_IN_PROGRESS = "ScaleInProgress" + """SCALE_IN_PROGRESS value""" + AVAILABLE_NEEDS_ATTENTION = "AvailableNeedsAttention" + """AVAILABLE_NEEDS_ATTENTION value""" + UPDATING = "Updating" + """UPDATING value""" + MAINTENANCE_IN_PROGRESS = "MaintenanceInProgress" + """MAINTENANCE_IN_PROGRESS value""" + RESTARTING = "Restarting" + """RESTARTING value""" + RECREATING = "Recreating" + """RECREATING value""" + ROLE_CHANGE_IN_PROGRESS = "RoleChangeInProgress" + """ROLE_CHANGE_IN_PROGRESS value""" + UPGRADING = "Upgrading" + """UPGRADING value""" + INACCESSIBLE = "Inaccessible" + """INACCESSIBLE value""" + STANDBY = "Standby" + """STANDBY value""" + + +class AutonomousMaintenanceScheduleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AutonomousMaintenanceScheduleType enum.""" + + EARLY = "Early" + """EARLY value""" + REGULAR = "Regular" + """REGULAR value""" + + +class AzureResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Azure Resource Provisioning State enum.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" + PROVISIONING = "Provisioning" + """Provisioning value""" + + +class CloneType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CloneType enum.""" + + FULL = "Full" + """FULL value""" + METADATA = "Metadata" + """METADATA value""" + + +class CloudAccountProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CloudAccountProvisioningState enum.""" + + PENDING = "Pending" + """Pending value""" + PROVISIONING = "Provisioning" + """Provisioning value""" + AVAILABLE = "Available" + """Available value""" + + +class CloudExadataInfrastructureLifecycleState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CloudExadataInfrastructureLifecycleState enum.""" + + PROVISIONING = "Provisioning" + """PROVISIONING value""" + AVAILABLE = "Available" + """AVAILABLE value""" + UPDATING = "Updating" + """UPDATING value""" + TERMINATING = "Terminating" + """TERMINATING value""" + TERMINATED = "Terminated" + """TERMINATED value""" + MAINTENANCE_IN_PROGRESS = "MaintenanceInProgress" + """MAINTENANCE_IN_PROGRESS value""" + FAILED = "Failed" + """FAILED value""" + + +class CloudVmClusterLifecycleState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CloudVmClusterLifecycleState enum.""" + + PROVISIONING = "Provisioning" + """PROVISIONING value""" + AVAILABLE = "Available" + """AVAILABLE value""" + UPDATING = "Updating" + """UPDATING value""" + TERMINATING = "Terminating" + """TERMINATING value""" + TERMINATED = "Terminated" + """TERMINATED value""" + MAINTENANCE_IN_PROGRESS = "MaintenanceInProgress" + """MAINTENANCE_IN_PROGRESS value""" + FAILED = "Failed" + """FAILED value""" + + +class ComputeModel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ComputeModel enum.""" + + ECPU = "ECPU" + """ECPU value""" + OCPU = "OCPU" + """OCPU value""" + + +class ConsumerGroup(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ConsumerGroup enum.""" + + HIGH = "High" + """HIGH value""" + MEDIUM = "Medium" + """MEDIUM value""" + LOW = "Low" + """LOW value""" + TP = "Tp" + """TP value""" + TPURGENT = "Tpurgent" + """TPURGENT value""" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class DatabaseEditionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DatabaseEditionType enum.""" + + STANDARD_EDITION = "StandardEdition" + """STANDARD_EDITION value""" + ENTERPRISE_EDITION = "EnterpriseEdition" + """ENTERPRISE_EDITION value""" + + +class DataBaseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DataBaseType enum.""" + + REGULAR = "Regular" + """REGULAR value""" + CLONE = "Clone" + """CLONE value""" + + +class DataSafeStatusType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DataSafeStatusType enum.""" + + REGISTERING = "Registering" + """REGISTERING value""" + REGISTERED = "Registered" + """REGISTERED value""" + DEREGISTERING = "Deregistering" + """DEREGISTERING value""" + NOT_REGISTERED = "NotRegistered" + """NOT_REGISTERED value""" + FAILED = "Failed" + """FAILED value""" + + +class DayOfWeekName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DayOfWeekName enum.""" + + MONDAY = "Monday" + """Monday value""" + TUESDAY = "Tuesday" + """Tuesday value""" + WEDNESDAY = "Wednesday" + """Wednesday value""" + THURSDAY = "Thursday" + """Thursday value""" + FRIDAY = "Friday" + """Friday value""" + SATURDAY = "Saturday" + """Saturday value""" + SUNDAY = "Sunday" + """Sunday value""" + + +class DbNodeActionEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DbNode action enum.""" + + START = "Start" + """Start DbNode""" + STOP = "Stop" + """Stop DbNode""" + SOFT_RESET = "SoftReset" + """Soft reset DbNode""" + RESET = "Reset" + """Reset DbNode""" + + +class DbNodeMaintenanceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of database node maintenance.""" + + VMDB_REBOOT_MIGRATION = "VmdbRebootMigration" + """Provisioning value""" + + +class DbNodeProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DnNode provisioning state enum.""" + + PROVISIONING = "Provisioning" + """PROVISIONING value""" + AVAILABLE = "Available" + """AVAILABLE value""" + UPDATING = "Updating" + """UPDATING value""" + STOPPING = "Stopping" + """STOPPING value""" + STOPPED = "Stopped" + """STOPPED value""" + STARTING = "Starting" + """STARTING value""" + TERMINATING = "Terminating" + """TERMINATING value""" + TERMINATED = "Terminated" + """TERMINATED value""" + FAILED = "Failed" + """FAILED value""" + + +class DbServerPatchingStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Db Server patching status enum.""" + + SCHEDULED = "Scheduled" + """SCHEDULED value""" + MAINTENANCE_IN_PROGRESS = "MaintenanceInProgress" + """MAINTENANCE_IN_PROGRESS value""" + FAILED = "Failed" + """FAILED value""" + COMPLETE = "Complete" + """COMPLETE value""" + + +class DbServerProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DbServerProvisioningState enum.""" + + CREATING = "Creating" + """CREATING value""" + AVAILABLE = "Available" + """AVAILABLE value""" + UNAVAILABLE = "Unavailable" + """UNAVAILABLE value""" + DELETING = "Deleting" + """DELETING value""" + DELETED = "Deleted" + """DELETED value""" + MAINTENANCE_IN_PROGRESS = "MaintenanceInProgress" + """MAINTENANCE_IN_PROGRESS value""" + + +class DisasterRecoveryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DisasterRecoveryType enum.""" + + ADG = "Adg" + """ADG value""" + BACKUP_BASED = "BackupBased" + """BACKUP_BASED value""" + + +class DiskRedundancy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DiskRedundancy enum.""" + + HIGH = "High" + """High value""" + NORMAL = "Normal" + """Normal value""" + + +class DnsPrivateViewsLifecycleState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DnsPrivateViews lifecycle state enum.""" + + ACTIVE = "Active" + """Active value""" + DELETED = "Deleted" + """Deleted value""" + DELETING = "Deleting" + """Deleting value""" + UPDATING = "Updating" + """Updating value""" + + +class DnsPrivateZonesLifecycleState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DnsPrivateZones lifecycle state enum.""" + + ACTIVE = "Active" + """Active value""" + CREATING = "Creating" + """Creating value""" + DELETED = "Deleted" + """Deleted value""" + DELETING = "Deleting" + """Deleting value""" + UPDATING = "Updating" + """Updating value""" + + +class GenerateType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """GenerateType enum.""" + + SINGLE = "Single" + """SINGLE value""" + ALL = "All" + """ALL value""" + + +class HostFormatType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """HostFormatType enum.""" + + FQDN = "Fqdn" + """FQDN value""" + IP = "Ip" + """IP value""" + + +class Intent(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Intent enum.""" + + RETAIN = "Retain" + """Retain value""" + RESET = "Reset" + """Reset value""" + + +class IormLifecycleState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """IORMLifecycleState enum.""" + + BOOT_STRAPPING = "BootStrapping" + """BOOTSTRAPPING value""" + ENABLED = "Enabled" + """ENABLED value""" + DISABLED = "Disabled" + """DISABLED value""" + UPDATING = "Updating" + """UPDATING value""" + FAILED = "Failed" + """FAILED value""" + + +class LicenseModel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """LicenseModel enum.""" + + LICENSE_INCLUDED = "LicenseIncluded" + """LicenseIncluded value""" + BRING_YOUR_OWN_LICENSE = "BringYourOwnLicense" + """BringYourOwnLicense value""" + + +class MonthName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MonthName enum.""" + + JANUARY = "January" + """January value""" + FEBRUARY = "February" + """February value""" + MARCH = "March" + """March value""" + APRIL = "April" + """April value""" + MAY = "May" + """May value""" + JUNE = "June" + """June value""" + JULY = "July" + """July value""" + AUGUST = "August" + """August value""" + SEPTEMBER = "September" + """September value""" + OCTOBER = "October" + """October value""" + NOVEMBER = "November" + """November value""" + DECEMBER = "December" + """December value""" + + +class Objective(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Objective enum.""" + + LOW_LATENCY = "LowLatency" + """LOW_LATENCY value""" + HIGH_THROUGHPUT = "HighThroughput" + """HIGH_THROUGHPUT value""" + BALANCED = "Balanced" + """BALANCED value""" + AUTO = "Auto" + """AUTO value""" + BASIC = "Basic" + """BASIC value""" + + +class OpenModeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """OpenModeType enum.""" + + READ_ONLY = "ReadOnly" + """READ_ONLY value""" + READ_WRITE = "ReadWrite" + """READ_WRITE value""" + + +class OperationsInsightsStatusType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """OperationsInsightsStatusType enum.""" + + ENABLING = "Enabling" + """ENABLING value""" + ENABLED = "Enabled" + """ENABLED value""" + DISABLING = "Disabling" + """DISABLING value""" + NOT_ENABLED = "NotEnabled" + """NOT_ENABLED value""" + FAILED_ENABLING = "FailedEnabling" + """FAILED_ENABLING value""" + FAILED_DISABLING = "FailedDisabling" + """FAILED_DISABLING value""" + + +class OracleSubscriptionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """OracleSubscriptionProvisioningState enum.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" + + +class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system". + """ + + USER = "user" + SYSTEM = "system" + USER_SYSTEM = "user,system" + + +class PatchingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """PatchingMode enum.""" + + ROLLING = "Rolling" + """Rolling value""" + NON_ROLLING = "NonRolling" + """Non Rolling value""" + + +class PermissionLevelType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """PermissionLevelType enum.""" + + RESTRICTED = "Restricted" + """RESTRICTED value""" + UNRESTRICTED = "Unrestricted" + """UNRESTRICTED value""" + + +class Preference(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Preference enum.""" + + NO_PREFERENCE = "NoPreference" + """NoPreference value""" + CUSTOM_PREFERENCE = "CustomPreference" + """CustomPreference value""" + + +class ProtocolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ProtocolType enum.""" + + TCP = "TCP" + """TCP value""" + TCPS = "TCPS" + """TCPS value""" + + +class RefreshableModelType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RefreshableModelType enum.""" + + AUTOMATIC = "Automatic" + """AUTOMATIC value""" + MANUAL = "Manual" + """MANUAL value""" + + +class RefreshableStatusType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RefreshableStatusType enum.""" + + REFRESHING = "Refreshing" + """REFRESHING value""" + NOT_REFRESHING = "NotRefreshing" + """NOT_REFRESHING value""" + + +class ResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of a resource type.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" + + +class RoleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RoleType enum.""" + + PRIMARY = "Primary" + """PRIMARY value""" + STANDBY = "Standby" + """STANDBY value""" + DISABLED_STANDBY = "DisabledStandby" + """DISABLED_STANDBY value""" + BACKUP_COPY = "BackupCopy" + """BACKUP_COPY value""" + SNAPSHOT_STANDBY = "SnapshotStandby" + """SNAPSHOT_STANDBY value""" + + +class SessionModeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SessionModeType enum.""" + + DIRECT = "Direct" + """DIRECT value""" + REDIRECT = "Redirect" + """REDIRECT value""" + + +class SourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SourceType enum.""" + + NONE = "None" + """NONE value""" + DATABASE = "Database" + """DATABASE value""" + BACKUP_FROM_ID = "BackupFromId" + """BACKUP_FROM_ID value""" + BACKUP_FROM_TIMESTAMP = "BackupFromTimestamp" + """BACKUP_FROM_TIMESTAMP value""" + CLONE_TO_REFRESHABLE = "CloneToRefreshable" + """CLONE_TO_REFRESHABLE value""" + CROSS_REGION_DATAGUARD = "CrossRegionDataguard" + """CROSS_REGION_DATAGUARD value""" + CROSS_REGION_DISASTER_RECOVERY = "CrossRegionDisasterRecovery" + """CROSS_REGION_DISASTER_RECOVERY value""" + + +class SyntaxFormatType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SyntaxFormatType enum.""" + + LONG = "Long" + """LONG value""" + EZCONNECT = "Ezconnect" + """EZCONNECT value""" + EZCONNECTPLUS = "Ezconnectplus" + """EZCONNECTPLUS value""" + + +class TlsAuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """TlsAuthenticationType enum.""" + + SERVER = "Server" + """SERVER value""" + MUTUAL = "Mutual" + """MUTUAL value""" + + +class UpdateAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """UpdateAction enum.""" + + ROLLING_APPLY = "RollingApply" + """ROLLING_APPLY value""" + NON_ROLLING_APPLY = "NonRollingApply" + """NON_ROLLING_APPLY value""" + PRE_CHECK = "PreCheck" + """PRECHECK value""" + ROLL_BACK = "RollBack" + """ROLLBACK value""" + + +class ValidationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """validation status.""" + + SUCCEEDED = "Succeeded" + """Succeeded value""" + FAILED = "Failed" + """Failed value""" + + +class Versions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Versions for API.""" + + V20230901 = "2023-09-01-preview" + """2023-09-01-preview""" + V_INTERNAL_API = "internal" + """internal api - RPaaS to ORP""" + + +class VirtualNetworkAddressLifecycleState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """VirtualNetworkAddressLifecycleState enum.""" + + PROVISIONING = "Provisioning" + """Provisioning value""" + AVAILABLE = "Available" + """Available value""" + TERMINATING = "Terminating" + """Terminating value""" + TERMINATED = "Terminated" + """Terminated value""" + FAILED = "Failed" + """Failed value""" + + +class WorkloadType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """WorkloadType enum.""" + + OLTP = "OLTP" + """OLTP - indicates an Autonomous Transaction Processing database""" + DW = "DW" + """DW - indicates an Autonomous Data Warehouse database""" + AJD = "AJD" + """AJD - indicates an Autonomous JSON Database""" + APEX = "APEX" + """APEX - indicates an Autonomous Database with the Oracle APEX Application Development workload + type.""" + + +class ZoneType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ZoneType enum.""" + + PRIMARY = "Primary" + """Primary value""" + SECONDARY = "Secondary" + """Secondary value""" diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/models/_patch.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/__init__.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/__init__.py new file mode 100644 index 000000000000..31a80b7db934 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/__init__.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._autonomous_databases_operations import AutonomousDatabasesOperations +from ._cloud_exadata_infrastructures_operations import CloudExadataInfrastructuresOperations +from ._cloud_vm_clusters_operations import CloudVmClustersOperations +from ._autonomous_database_character_sets_operations import AutonomousDatabaseCharacterSetsOperations +from ._autonomous_database_national_character_sets_operations import AutonomousDatabaseNationalCharacterSetsOperations +from ._autonomous_database_versions_operations import AutonomousDatabaseVersionsOperations +from ._db_system_shapes_operations import DbSystemShapesOperations +from ._dns_private_views_operations import DnsPrivateViewsOperations +from ._dns_private_zones_operations import DnsPrivateZonesOperations +from ._gi_versions_operations import GiVersionsOperations +from ._oracle_subscriptions_operations import OracleSubscriptionsOperations +from ._autonomous_database_backups_operations import AutonomousDatabaseBackupsOperations +from ._db_servers_operations import DbServersOperations +from ._db_nodes_operations import DbNodesOperations +from ._virtual_network_addresses_operations import VirtualNetworkAddressesOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "Operations", + "AutonomousDatabasesOperations", + "CloudExadataInfrastructuresOperations", + "CloudVmClustersOperations", + "AutonomousDatabaseCharacterSetsOperations", + "AutonomousDatabaseNationalCharacterSetsOperations", + "AutonomousDatabaseVersionsOperations", + "DbSystemShapesOperations", + "DnsPrivateViewsOperations", + "DnsPrivateZonesOperations", + "GiVersionsOperations", + "OracleSubscriptionsOperations", + "AutonomousDatabaseBackupsOperations", + "DbServersOperations", + "DbNodesOperations", + "VirtualNetworkAddressesOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_autonomous_database_backups_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_autonomous_database_backups_operations.py new file mode 100644 index 000000000000..6567faddd872 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_autonomous_database_backups_operations.py @@ -0,0 +1,931 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_autonomous_database_request( # pylint: disable=name-too-long + resource_group_name: str, autonomousdatabasename: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/autonomousDatabaseBackups", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "autonomousdatabasename": _SERIALIZER.url( + "autonomousdatabasename", autonomousdatabasename, "str", max_length=30, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, autonomousdatabasename: str, adbbackupid: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/autonomousDatabaseBackups/{adbbackupid}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "autonomousdatabasename": _SERIALIZER.url( + "autonomousdatabasename", autonomousdatabasename, "str", max_length=30, min_length=1 + ), + "adbbackupid": _SERIALIZER.url("adbbackupid", adbbackupid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, autonomousdatabasename: str, adbbackupid: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/autonomousDatabaseBackups/{adbbackupid}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "autonomousdatabasename": _SERIALIZER.url( + "autonomousdatabasename", autonomousdatabasename, "str", max_length=30, min_length=1 + ), + "adbbackupid": _SERIALIZER.url("adbbackupid", adbbackupid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, autonomousdatabasename: str, adbbackupid: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/autonomousDatabaseBackups/{adbbackupid}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "autonomousdatabasename": _SERIALIZER.url( + "autonomousdatabasename", autonomousdatabasename, "str", max_length=30, min_length=1 + ), + "adbbackupid": _SERIALIZER.url("adbbackupid", adbbackupid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, autonomousdatabasename: str, adbbackupid: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/autonomousDatabaseBackups/{adbbackupid}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "autonomousdatabasename": _SERIALIZER.url( + "autonomousdatabasename", autonomousdatabasename, "str", max_length=30, min_length=1 + ), + "adbbackupid": _SERIALIZER.url("adbbackupid", adbbackupid, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class AutonomousDatabaseBackupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`autonomous_database_backups` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_autonomous_database( + self, resource_group_name: str, autonomousdatabasename: str, **kwargs: Any + ) -> Iterable["_models.AutonomousDatabaseBackup"]: + """List AutonomousDatabaseBackup resources by AutonomousDatabase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :return: An iterator like instance of either AutonomousDatabaseBackup or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AutonomousDatabaseBackupListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_autonomous_database_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AutonomousDatabaseBackupListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, autonomousdatabasename: str, adbbackupid: str, **kwargs: Any + ) -> _models.AutonomousDatabaseBackup: + """Get a AutonomousDatabaseBackup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param adbbackupid: AutonomousDatabaseBackup id. Required. + :type adbbackupid: str + :return: AutonomousDatabaseBackup or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AutonomousDatabaseBackup] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AutonomousDatabaseBackup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + adbbackupid: str, + resource: Union[_models.AutonomousDatabaseBackup, IO[bytes]], + **kwargs: Any + ) -> _models.AutonomousDatabaseBackup: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutonomousDatabaseBackup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "AutonomousDatabaseBackup") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("AutonomousDatabaseBackup", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("AutonomousDatabaseBackup", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + adbbackupid: str, + resource: _models.AutonomousDatabaseBackup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabaseBackup]: + """Create a AutonomousDatabaseBackup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param adbbackupid: AutonomousDatabaseBackup id. Required. + :type adbbackupid: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AutonomousDatabaseBackup or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + adbbackupid: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabaseBackup]: + """Create a AutonomousDatabaseBackup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param adbbackupid: AutonomousDatabaseBackup id. Required. + :type adbbackupid: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AutonomousDatabaseBackup or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + adbbackupid: str, + resource: Union[_models.AutonomousDatabaseBackup, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabaseBackup]: + """Create a AutonomousDatabaseBackup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param adbbackupid: AutonomousDatabaseBackup id. Required. + :type adbbackupid: str + :param resource: Resource create parameters. Is either a AutonomousDatabaseBackup type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup or IO[bytes] + :return: An instance of LROPoller that returns either AutonomousDatabaseBackup or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutonomousDatabaseBackup] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AutonomousDatabaseBackup", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.AutonomousDatabaseBackup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AutonomousDatabaseBackup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + adbbackupid: str, + properties: Union[_models.AutonomousDatabaseBackupUpdate, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.AutonomousDatabaseBackup]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.AutonomousDatabaseBackup]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "AutonomousDatabaseBackupUpdate") + + _request = build_update_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("AutonomousDatabaseBackup", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + adbbackupid: str, + properties: _models.AutonomousDatabaseBackupUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabaseBackup]: + """Update a AutonomousDatabaseBackup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param adbbackupid: AutonomousDatabaseBackup id. Required. + :type adbbackupid: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackupUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AutonomousDatabaseBackup or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + adbbackupid: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabaseBackup]: + """Update a AutonomousDatabaseBackup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param adbbackupid: AutonomousDatabaseBackup id. Required. + :type adbbackupid: str + :param properties: The resource properties to be updated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AutonomousDatabaseBackup or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + adbbackupid: str, + properties: Union[_models.AutonomousDatabaseBackupUpdate, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabaseBackup]: + """Update a AutonomousDatabaseBackup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param adbbackupid: AutonomousDatabaseBackup id. Required. + :type adbbackupid: str + :param properties: The resource properties to be updated. Is either a + AutonomousDatabaseBackupUpdate type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackupUpdate or IO[bytes] + :return: An instance of LROPoller that returns either AutonomousDatabaseBackup or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabaseBackup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutonomousDatabaseBackup] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AutonomousDatabaseBackup", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.AutonomousDatabaseBackup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AutonomousDatabaseBackup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, autonomousdatabasename: str, adbbackupid: str, **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, autonomousdatabasename: str, adbbackupid: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a AutonomousDatabaseBackup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param adbbackupid: AutonomousDatabaseBackup id. Required. + :type adbbackupid: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + adbbackupid=adbbackupid, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_autonomous_database_character_sets_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_autonomous_database_character_sets_operations.py new file mode 100644 index 000000000000..19aa6bb94c7c --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_autonomous_database_character_sets_operations.py @@ -0,0 +1,256 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_location_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDatabaseCharacterSets", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(location: str, adbscharsetname: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDatabaseCharacterSets/{adbscharsetname}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "adbscharsetname": _SERIALIZER.url("adbscharsetname", adbscharsetname, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class AutonomousDatabaseCharacterSetsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`autonomous_database_character_sets` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.AutonomousDatabaseCharacterSet"]: + """List AutonomousDatabaseCharacterSet resources by Location. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of either AutonomousDatabaseCharacterSet or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDatabaseCharacterSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AutonomousDatabaseCharacterSetListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AutonomousDatabaseCharacterSetListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, location: str, adbscharsetname: str, **kwargs: Any) -> _models.AutonomousDatabaseCharacterSet: + """Get a AutonomousDatabaseCharacterSet. + + :param location: The name of the Azure region. Required. + :type location: str + :param adbscharsetname: AutonomousDatabaseCharacterSet name. Required. + :type adbscharsetname: str + :return: AutonomousDatabaseCharacterSet or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseCharacterSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AutonomousDatabaseCharacterSet] = kwargs.pop("cls", None) + + _request = build_get_request( + location=location, + adbscharsetname=adbscharsetname, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AutonomousDatabaseCharacterSet", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_autonomous_database_national_character_sets_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_autonomous_database_national_character_sets_operations.py new file mode 100644 index 000000000000..7298ad440004 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_autonomous_database_national_character_sets_operations.py @@ -0,0 +1,260 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_location_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDatabaseNationalCharacterSets", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(location: str, adbsncharsetname: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDatabaseNationalCharacterSets/{adbsncharsetname}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "adbsncharsetname": _SERIALIZER.url("adbsncharsetname", adbsncharsetname, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class AutonomousDatabaseNationalCharacterSetsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`autonomous_database_national_character_sets` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_location( + self, location: str, **kwargs: Any + ) -> Iterable["_models.AutonomousDatabaseNationalCharacterSet"]: + """List AutonomousDatabaseNationalCharacterSet resources by Location. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of either AutonomousDatabaseNationalCharacterSet or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDatabaseNationalCharacterSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AutonomousDatabaseNationalCharacterSetListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AutonomousDatabaseNationalCharacterSetListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, location: str, adbsncharsetname: str, **kwargs: Any + ) -> _models.AutonomousDatabaseNationalCharacterSet: + """Get a AutonomousDatabaseNationalCharacterSet. + + :param location: The name of the Azure region. Required. + :type location: str + :param adbsncharsetname: AutonomousDatabaseNationalCharacterSets name. Required. + :type adbsncharsetname: str + :return: AutonomousDatabaseNationalCharacterSet or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseNationalCharacterSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AutonomousDatabaseNationalCharacterSet] = kwargs.pop("cls", None) + + _request = build_get_request( + location=location, + adbsncharsetname=adbsncharsetname, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AutonomousDatabaseNationalCharacterSet", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_autonomous_database_versions_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_autonomous_database_versions_operations.py new file mode 100644 index 000000000000..488d5520a378 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_autonomous_database_versions_operations.py @@ -0,0 +1,254 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_location_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDbVersions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(location: str, autonomousdbversionsname: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDbVersions/{autonomousdbversionsname}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "autonomousdbversionsname": _SERIALIZER.url("autonomousdbversionsname", autonomousdbversionsname, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class AutonomousDatabaseVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`autonomous_database_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.AutonomousDbVersion"]: + """List AutonomousDbVersion resources by Location. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of either AutonomousDbVersion or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDbVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AutonomousDbVersionListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AutonomousDbVersionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, location: str, autonomousdbversionsname: str, **kwargs: Any) -> _models.AutonomousDbVersion: + """Get a AutonomousDbVersion. + + :param location: The name of the Azure region. Required. + :type location: str + :param autonomousdbversionsname: AutonomousDbVersion name. Required. + :type autonomousdbversionsname: str + :return: AutonomousDbVersion or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDbVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AutonomousDbVersion] = kwargs.pop("cls", None) + + _request = build_get_request( + location=location, + autonomousdbversionsname=autonomousdbversionsname, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AutonomousDbVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_autonomous_databases_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_autonomous_databases_operations.py new file mode 100644 index 000000000000..b264bf2eeca4 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_autonomous_databases_operations.py @@ -0,0 +1,1616 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Oracle.Database/autonomousDatabases") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, autonomousdatabasename: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "autonomousdatabasename": _SERIALIZER.url( + "autonomousdatabasename", autonomousdatabasename, "str", max_length=30, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, autonomousdatabasename: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "autonomousdatabasename": _SERIALIZER.url( + "autonomousdatabasename", autonomousdatabasename, "str", max_length=30, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, autonomousdatabasename: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "autonomousdatabasename": _SERIALIZER.url( + "autonomousdatabasename", autonomousdatabasename, "str", max_length=30, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, autonomousdatabasename: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "autonomousdatabasename": _SERIALIZER.url( + "autonomousdatabasename", autonomousdatabasename, "str", max_length=30, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_failover_request( + resource_group_name: str, autonomousdatabasename: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/failover", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "autonomousdatabasename": _SERIALIZER.url( + "autonomousdatabasename", autonomousdatabasename, "str", max_length=30, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_generate_wallet_request( + resource_group_name: str, autonomousdatabasename: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/generateWallet", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "autonomousdatabasename": _SERIALIZER.url( + "autonomousdatabasename", autonomousdatabasename, "str", max_length=30, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_switchover_request( + resource_group_name: str, autonomousdatabasename: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/switchover", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "autonomousdatabasename": _SERIALIZER.url( + "autonomousdatabasename", autonomousdatabasename, "str", max_length=30, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class AutonomousDatabasesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`autonomous_databases` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.AutonomousDatabase"]: + """List AutonomousDatabase resources by subscription ID. + + :return: An iterator like instance of either AutonomousDatabase or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AutonomousDatabaseListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AutonomousDatabaseListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.AutonomousDatabase"]: + """List AutonomousDatabase resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either AutonomousDatabase or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AutonomousDatabaseListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AutonomousDatabaseListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, autonomousdatabasename: str, **kwargs: Any) -> _models.AutonomousDatabase: + """Get a AutonomousDatabase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :return: AutonomousDatabase or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabase + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AutonomousDatabase] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AutonomousDatabase", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + resource: Union[_models.AutonomousDatabase, IO[bytes]], + **kwargs: Any + ) -> _models.AutonomousDatabase: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutonomousDatabase] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "AutonomousDatabase") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("AutonomousDatabase", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("AutonomousDatabase", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + resource: _models.AutonomousDatabase, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabase]: + """Create a AutonomousDatabase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.oracledatabase.models.AutonomousDatabase + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabase]: + """Create a AutonomousDatabase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + resource: Union[_models.AutonomousDatabase, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabase]: + """Create a AutonomousDatabase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param resource: Resource create parameters. Is either a AutonomousDatabase type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.oracledatabase.models.AutonomousDatabase or IO[bytes] + :return: An instance of LROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutonomousDatabase] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AutonomousDatabase", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.AutonomousDatabase].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AutonomousDatabase]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + properties: Union[_models.AutonomousDatabaseUpdate, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.AutonomousDatabase]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.AutonomousDatabase]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "AutonomousDatabaseUpdate") + + _request = build_update_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("AutonomousDatabase", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + properties: _models.AutonomousDatabaseUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabase]: + """Update a AutonomousDatabase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabase]: + """Update a AutonomousDatabase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param properties: The resource properties to be updated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + autonomousdatabasename: str, + properties: Union[_models.AutonomousDatabaseUpdate, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabase]: + """Update a AutonomousDatabase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param properties: The resource properties to be updated. Is either a AutonomousDatabaseUpdate + type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseUpdate or IO[bytes] + :return: An instance of LROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutonomousDatabase] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AutonomousDatabase", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.AutonomousDatabase].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AutonomousDatabase]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, autonomousdatabasename: str, **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, autonomousdatabasename: str, **kwargs: Any) -> LROPoller[None]: + """Delete a AutonomousDatabase. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _failover_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: Union[_models.PeerDbDetails, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.AutonomousDatabase]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.AutonomousDatabase]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "PeerDbDetails") + + _request = build_failover_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("AutonomousDatabase", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_failover( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: _models.PeerDbDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabase]: + """Perform failover action on Autonomous Database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.oracledatabase.models.PeerDbDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_failover( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabase]: + """Perform failover action on Autonomous Database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_failover( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: Union[_models.PeerDbDetails, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabase]: + """Perform failover action on Autonomous Database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param body: The content of the action request. Is either a PeerDbDetails type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.oracledatabase.models.PeerDbDetails or IO[bytes] + :return: An instance of LROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutonomousDatabase] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._failover_initial( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AutonomousDatabase", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.AutonomousDatabase].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AutonomousDatabase]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def generate_wallet( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: _models.GenerateAutonomousDatabaseWalletDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AutonomousDatabaseWalletFile: + """Generate wallet action on Autonomous Database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.oracledatabase.models.GenerateAutonomousDatabaseWalletDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AutonomousDatabaseWalletFile or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseWalletFile + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def generate_wallet( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AutonomousDatabaseWalletFile: + """Generate wallet action on Autonomous Database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AutonomousDatabaseWalletFile or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseWalletFile + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def generate_wallet( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: Union[_models.GenerateAutonomousDatabaseWalletDetails, IO[bytes]], + **kwargs: Any + ) -> _models.AutonomousDatabaseWalletFile: + """Generate wallet action on Autonomous Database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param body: The content of the action request. Is either a + GenerateAutonomousDatabaseWalletDetails type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.oracledatabase.models.GenerateAutonomousDatabaseWalletDetails or + IO[bytes] + :return: AutonomousDatabaseWalletFile or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.AutonomousDatabaseWalletFile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutonomousDatabaseWalletFile] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "GenerateAutonomousDatabaseWalletDetails") + + _request = build_generate_wallet_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AutonomousDatabaseWalletFile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _switchover_initial( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: Union[_models.PeerDbDetails, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.AutonomousDatabase]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.AutonomousDatabase]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "PeerDbDetails") + + _request = build_switchover_request( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("AutonomousDatabase", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_switchover( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: _models.PeerDbDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabase]: + """Perform switchover action on Autonomous Database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.oracledatabase.models.PeerDbDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_switchover( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabase]: + """Perform switchover action on Autonomous Database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_switchover( + self, + resource_group_name: str, + autonomousdatabasename: str, + body: Union[_models.PeerDbDetails, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.AutonomousDatabase]: + """Perform switchover action on Autonomous Database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param autonomousdatabasename: The database name. Required. + :type autonomousdatabasename: str + :param body: The content of the action request. Is either a PeerDbDetails type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.oracledatabase.models.PeerDbDetails or IO[bytes] + :return: An instance of LROPoller that returns either AutonomousDatabase or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.AutonomousDatabase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AutonomousDatabase] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._switchover_initial( + resource_group_name=resource_group_name, + autonomousdatabasename=autonomousdatabasename, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AutonomousDatabase", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.AutonomousDatabase].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AutonomousDatabase]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_cloud_exadata_infrastructures_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_cloud_exadata_infrastructures_operations.py new file mode 100644 index 000000000000..8fa4b861f198 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_cloud_exadata_infrastructures_operations.py @@ -0,0 +1,1145 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Oracle.Database/cloudExadataInfrastructures" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, cloudexadatainfrastructurename: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudexadatainfrastructurename": _SERIALIZER.url( + "cloudexadatainfrastructurename", cloudexadatainfrastructurename, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, cloudexadatainfrastructurename: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudexadatainfrastructurename": _SERIALIZER.url( + "cloudexadatainfrastructurename", cloudexadatainfrastructurename, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, cloudexadatainfrastructurename: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudexadatainfrastructurename": _SERIALIZER.url( + "cloudexadatainfrastructurename", cloudexadatainfrastructurename, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, cloudexadatainfrastructurename: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudexadatainfrastructurename": _SERIALIZER.url( + "cloudexadatainfrastructurename", cloudexadatainfrastructurename, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_add_storage_capacity_request( + resource_group_name: str, cloudexadatainfrastructurename: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}/addStorageCapacity", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudexadatainfrastructurename": _SERIALIZER.url( + "cloudexadatainfrastructurename", cloudexadatainfrastructurename, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class CloudExadataInfrastructuresOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`cloud_exadata_infrastructures` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.CloudExadataInfrastructure"]: + """List CloudExadataInfrastructure resources by subscription ID. + + :return: An iterator like instance of either CloudExadataInfrastructure or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CloudExadataInfrastructureListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CloudExadataInfrastructureListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.CloudExadataInfrastructure"]: + """List CloudExadataInfrastructure resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either CloudExadataInfrastructure or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CloudExadataInfrastructureListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CloudExadataInfrastructureListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, cloudexadatainfrastructurename: str, **kwargs: Any + ) -> _models.CloudExadataInfrastructure: + """Get a CloudExadataInfrastructure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudexadatainfrastructurename: CloudExadataInfrastructure name. Required. + :type cloudexadatainfrastructurename: str + :return: CloudExadataInfrastructure or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CloudExadataInfrastructure] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CloudExadataInfrastructure", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + cloudexadatainfrastructurename: str, + resource: Union[_models.CloudExadataInfrastructure, IO[bytes]], + **kwargs: Any + ) -> _models.CloudExadataInfrastructure: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CloudExadataInfrastructure] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "CloudExadataInfrastructure") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CloudExadataInfrastructure", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("CloudExadataInfrastructure", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cloudexadatainfrastructurename: str, + resource: _models.CloudExadataInfrastructure, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CloudExadataInfrastructure]: + """Create a CloudExadataInfrastructure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudexadatainfrastructurename: CloudExadataInfrastructure name. Required. + :type cloudexadatainfrastructurename: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CloudExadataInfrastructure or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cloudexadatainfrastructurename: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CloudExadataInfrastructure]: + """Create a CloudExadataInfrastructure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudexadatainfrastructurename: CloudExadataInfrastructure name. Required. + :type cloudexadatainfrastructurename: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CloudExadataInfrastructure or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + cloudexadatainfrastructurename: str, + resource: Union[_models.CloudExadataInfrastructure, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CloudExadataInfrastructure]: + """Create a CloudExadataInfrastructure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudexadatainfrastructurename: CloudExadataInfrastructure name. Required. + :type cloudexadatainfrastructurename: str + :param resource: Resource create parameters. Is either a CloudExadataInfrastructure type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure or IO[bytes] + :return: An instance of LROPoller that returns either CloudExadataInfrastructure or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CloudExadataInfrastructure] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CloudExadataInfrastructure", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CloudExadataInfrastructure].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CloudExadataInfrastructure]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + cloudexadatainfrastructurename: str, + properties: Union[_models.CloudExadataInfrastructureUpdate, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.CloudExadataInfrastructure]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.CloudExadataInfrastructure]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "CloudExadataInfrastructureUpdate") + + _request = build_update_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CloudExadataInfrastructure", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + cloudexadatainfrastructurename: str, + properties: _models.CloudExadataInfrastructureUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CloudExadataInfrastructure]: + """Update a CloudExadataInfrastructure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudexadatainfrastructurename: CloudExadataInfrastructure name. Required. + :type cloudexadatainfrastructurename: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.oracledatabase.models.CloudExadataInfrastructureUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CloudExadataInfrastructure or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cloudexadatainfrastructurename: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CloudExadataInfrastructure]: + """Update a CloudExadataInfrastructure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudexadatainfrastructurename: CloudExadataInfrastructure name. Required. + :type cloudexadatainfrastructurename: str + :param properties: The resource properties to be updated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CloudExadataInfrastructure or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + cloudexadatainfrastructurename: str, + properties: Union[_models.CloudExadataInfrastructureUpdate, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CloudExadataInfrastructure]: + """Update a CloudExadataInfrastructure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudexadatainfrastructurename: CloudExadataInfrastructure name. Required. + :type cloudexadatainfrastructurename: str + :param properties: The resource properties to be updated. Is either a + CloudExadataInfrastructureUpdate type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.oracledatabase.models.CloudExadataInfrastructureUpdate or + IO[bytes] + :return: An instance of LROPoller that returns either CloudExadataInfrastructure or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CloudExadataInfrastructure] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CloudExadataInfrastructure", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CloudExadataInfrastructure].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CloudExadataInfrastructure]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cloudexadatainfrastructurename: str, **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, cloudexadatainfrastructurename: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a CloudExadataInfrastructure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudexadatainfrastructurename: CloudExadataInfrastructure name. Required. + :type cloudexadatainfrastructurename: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _add_storage_capacity_initial( + self, resource_group_name: str, cloudexadatainfrastructurename: str, **kwargs: Any + ) -> Optional[_models.CloudExadataInfrastructure]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.CloudExadataInfrastructure]] = kwargs.pop("cls", None) + + _request = build_add_storage_capacity_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CloudExadataInfrastructure", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_add_storage_capacity( + self, resource_group_name: str, cloudexadatainfrastructurename: str, **kwargs: Any + ) -> LROPoller[_models.CloudExadataInfrastructure]: + """Perform add storage capacity on exadata infra. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudexadatainfrastructurename: CloudExadataInfrastructure name. Required. + :type cloudexadatainfrastructurename: str + :return: An instance of LROPoller that returns either CloudExadataInfrastructure or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudExadataInfrastructure] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CloudExadataInfrastructure] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._add_storage_capacity_initial( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CloudExadataInfrastructure", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CloudExadataInfrastructure].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CloudExadataInfrastructure]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_cloud_vm_clusters_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_cloud_vm_clusters_operations.py new file mode 100644 index 000000000000..fb55291904a9 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_cloud_vm_clusters_operations.py @@ -0,0 +1,1601 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Oracle.Database/cloudVmClusters") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, cloudvmclustername: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudvmclustername": _SERIALIZER.url("cloudvmclustername", cloudvmclustername, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, cloudvmclustername: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudvmclustername": _SERIALIZER.url("cloudvmclustername", cloudvmclustername, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, cloudvmclustername: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudvmclustername": _SERIALIZER.url("cloudvmclustername", cloudvmclustername, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, cloudvmclustername: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudvmclustername": _SERIALIZER.url("cloudvmclustername", cloudvmclustername, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_add_vms_request( + resource_group_name: str, cloudvmclustername: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/addVms", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudvmclustername": _SERIALIZER.url("cloudvmclustername", cloudvmclustername, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_private_ip_addresses_request( + resource_group_name: str, cloudvmclustername: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/listPrivateIpAddresses", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudvmclustername": _SERIALIZER.url("cloudvmclustername", cloudvmclustername, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_remove_vms_request( + resource_group_name: str, cloudvmclustername: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/removeVms", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudvmclustername": _SERIALIZER.url("cloudvmclustername", cloudvmclustername, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class CloudVmClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`cloud_vm_clusters` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.CloudVmCluster"]: + """List CloudVmCluster resources by subscription ID. + + :return: An iterator like instance of either CloudVmCluster or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CloudVmClusterListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CloudVmClusterListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.CloudVmCluster"]: + """List CloudVmCluster resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either CloudVmCluster or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CloudVmClusterListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CloudVmClusterListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, cloudvmclustername: str, **kwargs: Any) -> _models.CloudVmCluster: + """Get a CloudVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :return: CloudVmCluster or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.CloudVmCluster + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CloudVmCluster] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CloudVmCluster", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + resource: Union[_models.CloudVmCluster, IO[bytes]], + **kwargs: Any + ) -> _models.CloudVmCluster: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CloudVmCluster] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "CloudVmCluster") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CloudVmCluster", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("CloudVmCluster", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cloudvmclustername: str, + resource: _models.CloudVmCluster, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CloudVmCluster]: + """Create a CloudVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.oracledatabase.models.CloudVmCluster + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cloudvmclustername: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CloudVmCluster]: + """Create a CloudVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + cloudvmclustername: str, + resource: Union[_models.CloudVmCluster, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CloudVmCluster]: + """Create a CloudVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param resource: Resource create parameters. Is either a CloudVmCluster type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.oracledatabase.models.CloudVmCluster or IO[bytes] + :return: An instance of LROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CloudVmCluster] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CloudVmCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CloudVmCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CloudVmCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + properties: Union[_models.CloudVmClusterUpdate, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.CloudVmCluster]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.CloudVmCluster]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "CloudVmClusterUpdate") + + _request = build_update_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CloudVmCluster", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + cloudvmclustername: str, + properties: _models.CloudVmClusterUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CloudVmCluster]: + """Update a CloudVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.oracledatabase.models.CloudVmClusterUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cloudvmclustername: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CloudVmCluster]: + """Update a CloudVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param properties: The resource properties to be updated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + cloudvmclustername: str, + properties: Union[_models.CloudVmClusterUpdate, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CloudVmCluster]: + """Update a CloudVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param properties: The resource properties to be updated. Is either a CloudVmClusterUpdate type + or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.oracledatabase.models.CloudVmClusterUpdate or IO[bytes] + :return: An instance of LROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CloudVmCluster] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CloudVmCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CloudVmCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CloudVmCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cloudvmclustername: str, **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, cloudvmclustername: str, **kwargs: Any) -> LROPoller[None]: + """Delete a CloudVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _add_vms_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + body: Union[_models.AddRemoveDbNode, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.CloudVmCluster]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.CloudVmCluster]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "AddRemoveDbNode") + + _request = build_add_vms_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CloudVmCluster", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_add_vms( + self, + resource_group_name: str, + cloudvmclustername: str, + body: _models.AddRemoveDbNode, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CloudVmCluster]: + """Add VMs to the VM Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.oracledatabase.models.AddRemoveDbNode + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_add_vms( + self, + resource_group_name: str, + cloudvmclustername: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CloudVmCluster]: + """Add VMs to the VM Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_add_vms( + self, + resource_group_name: str, + cloudvmclustername: str, + body: Union[_models.AddRemoveDbNode, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CloudVmCluster]: + """Add VMs to the VM Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param body: The content of the action request. Is either a AddRemoveDbNode type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.oracledatabase.models.AddRemoveDbNode or IO[bytes] + :return: An instance of LROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CloudVmCluster] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._add_vms_initial( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CloudVmCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CloudVmCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CloudVmCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def list_private_ip_addresses( + self, + resource_group_name: str, + cloudvmclustername: str, + body: _models.PrivateIpAddressesFilter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> List[_models.PrivateIpAddressProperties]: + """List Private IP Addresses by the provided filter. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.oracledatabase.models.PrivateIpAddressesFilter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: list of PrivateIpAddressProperties or the result of cls(response) + :rtype: list[~azure.mgmt.oracledatabase.models.PrivateIpAddressProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list_private_ip_addresses( + self, + resource_group_name: str, + cloudvmclustername: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> List[_models.PrivateIpAddressProperties]: + """List Private IP Addresses by the provided filter. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: list of PrivateIpAddressProperties or the result of cls(response) + :rtype: list[~azure.mgmt.oracledatabase.models.PrivateIpAddressProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list_private_ip_addresses( + self, + resource_group_name: str, + cloudvmclustername: str, + body: Union[_models.PrivateIpAddressesFilter, IO[bytes]], + **kwargs: Any + ) -> List[_models.PrivateIpAddressProperties]: + """List Private IP Addresses by the provided filter. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param body: The content of the action request. Is either a PrivateIpAddressesFilter type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.oracledatabase.models.PrivateIpAddressesFilter or IO[bytes] + :return: list of PrivateIpAddressProperties or the result of cls(response) + :rtype: list[~azure.mgmt.oracledatabase.models.PrivateIpAddressProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[List[_models.PrivateIpAddressProperties]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "PrivateIpAddressesFilter") + + _request = build_list_private_ip_addresses_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("[PrivateIpAddressProperties]", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _remove_vms_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + body: Union[_models.AddRemoveDbNode, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.CloudVmCluster]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.CloudVmCluster]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "AddRemoveDbNode") + + _request = build_remove_vms_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CloudVmCluster", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_remove_vms( + self, + resource_group_name: str, + cloudvmclustername: str, + body: _models.AddRemoveDbNode, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CloudVmCluster]: + """Remove VMs from the VM Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.oracledatabase.models.AddRemoveDbNode + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_remove_vms( + self, + resource_group_name: str, + cloudvmclustername: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CloudVmCluster]: + """Remove VMs from the VM Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_remove_vms( + self, + resource_group_name: str, + cloudvmclustername: str, + body: Union[_models.AddRemoveDbNode, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CloudVmCluster]: + """Remove VMs from the VM Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param body: The content of the action request. Is either a AddRemoveDbNode type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.oracledatabase.models.AddRemoveDbNode or IO[bytes] + :return: An instance of LROPoller that returns either CloudVmCluster or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudVmCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CloudVmCluster] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._remove_vms_initial( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CloudVmCluster", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CloudVmCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CloudVmCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_db_nodes_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_db_nodes_operations.py new file mode 100644 index 000000000000..17c130a167f0 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_db_nodes_operations.py @@ -0,0 +1,520 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_cloud_vm_cluster_request( + resource_group_name: str, cloudvmclustername: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/dbNodes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudvmclustername": _SERIALIZER.url("cloudvmclustername", cloudvmclustername, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, cloudvmclustername: str, dbnodeocid: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/dbNodes/{dbnodeocid}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudvmclustername": _SERIALIZER.url("cloudvmclustername", cloudvmclustername, "str"), + "dbnodeocid": _SERIALIZER.url("dbnodeocid", dbnodeocid, "str", max_length=255, min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_action_request( + resource_group_name: str, cloudvmclustername: str, dbnodeocid: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/dbNodes/{dbnodeocid}/action", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudvmclustername": _SERIALIZER.url("cloudvmclustername", cloudvmclustername, "str"), + "dbnodeocid": _SERIALIZER.url("dbnodeocid", dbnodeocid, "str", max_length=255, min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class DbNodesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`db_nodes` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_cloud_vm_cluster( + self, resource_group_name: str, cloudvmclustername: str, **kwargs: Any + ) -> Iterable["_models.DbNode"]: + """List DbNode resources by CloudVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :return: An iterator like instance of either DbNode or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.DbNode] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DbNodeListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_cloud_vm_cluster_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DbNodeListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, cloudvmclustername: str, dbnodeocid: str, **kwargs: Any) -> _models.DbNode: + """Get a DbNode. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param dbnodeocid: DbNode OCID. Required. + :type dbnodeocid: str + :return: DbNode or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.DbNode + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DbNode] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + dbnodeocid=dbnodeocid, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DbNode", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _action_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + dbnodeocid: str, + body: Union[_models.DbNodeAction, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.DbNode]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.DbNode]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "DbNodeAction") + + _request = build_action_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + dbnodeocid=dbnodeocid, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("DbNode", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_action( + self, + resource_group_name: str, + cloudvmclustername: str, + dbnodeocid: str, + body: _models.DbNodeAction, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DbNode]: + """VM actions on DbNode of VM Cluster by the provided filter. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param dbnodeocid: DbNode OCID. Required. + :type dbnodeocid: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.oracledatabase.models.DbNodeAction + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DbNode or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.DbNode] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_action( + self, + resource_group_name: str, + cloudvmclustername: str, + dbnodeocid: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DbNode]: + """VM actions on DbNode of VM Cluster by the provided filter. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param dbnodeocid: DbNode OCID. Required. + :type dbnodeocid: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DbNode or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.DbNode] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_action( + self, + resource_group_name: str, + cloudvmclustername: str, + dbnodeocid: str, + body: Union[_models.DbNodeAction, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DbNode]: + """VM actions on DbNode of VM Cluster by the provided filter. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param dbnodeocid: DbNode OCID. Required. + :type dbnodeocid: str + :param body: The content of the action request. Is either a DbNodeAction type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.oracledatabase.models.DbNodeAction or IO[bytes] + :return: An instance of LROPoller that returns either DbNode or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.DbNode] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DbNode] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._action_initial( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + dbnodeocid=dbnodeocid, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DbNode", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DbNode].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DbNode]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_db_servers_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_db_servers_operations.py new file mode 100644 index 000000000000..4aad9ac057d5 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_db_servers_operations.py @@ -0,0 +1,284 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_cloud_exadata_infrastructure_request( # pylint: disable=name-too-long + resource_group_name: str, cloudexadatainfrastructurename: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}/dbServers", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudexadatainfrastructurename": _SERIALIZER.url( + "cloudexadatainfrastructurename", cloudexadatainfrastructurename, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + cloudexadatainfrastructurename: str, + dbserverocid: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}/dbServers/{dbserverocid}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudexadatainfrastructurename": _SERIALIZER.url( + "cloudexadatainfrastructurename", cloudexadatainfrastructurename, "str" + ), + "dbserverocid": _SERIALIZER.url("dbserverocid", dbserverocid, "str", max_length=255, min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class DbServersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`db_servers` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_cloud_exadata_infrastructure( + self, resource_group_name: str, cloudexadatainfrastructurename: str, **kwargs: Any + ) -> Iterable["_models.DbServer"]: + """List DbServer resources by CloudExadataInfrastructure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudexadatainfrastructurename: CloudExadataInfrastructure name. Required. + :type cloudexadatainfrastructurename: str + :return: An iterator like instance of either DbServer or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.DbServer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DbServerListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_cloud_exadata_infrastructure_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DbServerListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, cloudexadatainfrastructurename: str, dbserverocid: str, **kwargs: Any + ) -> _models.DbServer: + """Get a DbServer. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudexadatainfrastructurename: CloudExadataInfrastructure name. Required. + :type cloudexadatainfrastructurename: str + :param dbserverocid: DbServer OCID. Required. + :type dbserverocid: str + :return: DbServer or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.DbServer + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DbServer] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + cloudexadatainfrastructurename=cloudexadatainfrastructurename, + dbserverocid=dbserverocid, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DbServer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_db_system_shapes_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_db_system_shapes_operations.py new file mode 100644 index 000000000000..81e2582f1612 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_db_system_shapes_operations.py @@ -0,0 +1,253 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_location_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dbSystemShapes" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(location: str, dbsystemshapename: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dbSystemShapes/{dbsystemshapename}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "dbsystemshapename": _SERIALIZER.url("dbsystemshapename", dbsystemshapename, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class DbSystemShapesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`db_system_shapes` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.DbSystemShape"]: + """List DbSystemShape resources by Location. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of either DbSystemShape or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.DbSystemShape] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DbSystemShapeListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DbSystemShapeListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, location: str, dbsystemshapename: str, **kwargs: Any) -> _models.DbSystemShape: + """Get a DbSystemShape. + + :param location: The name of the Azure region. Required. + :type location: str + :param dbsystemshapename: DbSystemShape name. Required. + :type dbsystemshapename: str + :return: DbSystemShape or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.DbSystemShape + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DbSystemShape] = kwargs.pop("cls", None) + + _request = build_get_request( + location=location, + dbsystemshapename=dbsystemshapename, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DbSystemShape", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_dns_private_views_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_dns_private_views_operations.py new file mode 100644 index 000000000000..4fc52bc5db23 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_dns_private_views_operations.py @@ -0,0 +1,255 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_location_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dnsPrivateViews" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(location: str, dnsprivateviewocid: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dnsPrivateViews/{dnsprivateviewocid}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "dnsprivateviewocid": _SERIALIZER.url( + "dnsprivateviewocid", dnsprivateviewocid, "str", max_length=255, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class DnsPrivateViewsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`dns_private_views` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.DnsPrivateView"]: + """List DnsPrivateView resources by Location. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of either DnsPrivateView or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.DnsPrivateView] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DnsPrivateViewListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DnsPrivateViewListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, location: str, dnsprivateviewocid: str, **kwargs: Any) -> _models.DnsPrivateView: + """Get a DnsPrivateView. + + :param location: The name of the Azure region. Required. + :type location: str + :param dnsprivateviewocid: DnsPrivateView OCID. Required. + :type dnsprivateviewocid: str + :return: DnsPrivateView or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.DnsPrivateView + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DnsPrivateView] = kwargs.pop("cls", None) + + _request = build_get_request( + location=location, + dnsprivateviewocid=dnsprivateviewocid, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DnsPrivateView", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_dns_private_zones_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_dns_private_zones_operations.py new file mode 100644 index 000000000000..f8929e0d5995 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_dns_private_zones_operations.py @@ -0,0 +1,253 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_location_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dnsPrivateZones" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(location: str, dnsprivatezonename: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dnsPrivateZones/{dnsprivatezonename}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "dnsprivatezonename": _SERIALIZER.url("dnsprivatezonename", dnsprivatezonename, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class DnsPrivateZonesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`dns_private_zones` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.DnsPrivateZone"]: + """List DnsPrivateZone resources by Location. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of either DnsPrivateZone or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.DnsPrivateZone] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DnsPrivateZoneListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DnsPrivateZoneListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, location: str, dnsprivatezonename: str, **kwargs: Any) -> _models.DnsPrivateZone: + """Get a DnsPrivateZone. + + :param location: The name of the Azure region. Required. + :type location: str + :param dnsprivatezonename: DnsPrivateZone name. Required. + :type dnsprivatezonename: str + :return: DnsPrivateZone or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.DnsPrivateZone + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DnsPrivateZone] = kwargs.pop("cls", None) + + _request = build_get_request( + location=location, + dnsprivatezonename=dnsprivatezonename, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DnsPrivateZone", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_gi_versions_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_gi_versions_operations.py new file mode 100644 index 000000000000..59c9bb1dac19 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_gi_versions_operations.py @@ -0,0 +1,253 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_location_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/giVersions" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(location: str, giversionname: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/giVersions/{giversionname}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "giversionname": _SERIALIZER.url("giversionname", giversionname, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class GiVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`gi_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.GiVersion"]: + """List GiVersion resources by Location. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of either GiVersion or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.GiVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GiVersionListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("GiVersionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, location: str, giversionname: str, **kwargs: Any) -> _models.GiVersion: + """Get a GiVersion. + + :param location: The name of the Azure region. Required. + :type location: str + :param giversionname: GiVersion name. Required. + :type giversionname: str + :return: GiVersion or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.GiVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GiVersion] = kwargs.pop("cls", None) + + _request = build_get_request( + location=location, + giversionname=giversionname, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("GiVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_operations.py new file mode 100644 index 000000000000..d0393d4668d0 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_operations.py @@ -0,0 +1,156 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Oracle.Database/operations") + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: + """List the operations for the provider. + + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_oracle_subscriptions_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_oracle_subscriptions_operations.py new file mode 100644 index 000000000000..6007510c47d1 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_oracle_subscriptions_operations.py @@ -0,0 +1,1106 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_activation_links_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default/listActivationLinks", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_cloud_account_details_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default/listCloudAccountDetails", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_saas_subscription_details_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default/listSaasSubscriptionDetails", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class OracleSubscriptionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`oracle_subscriptions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.OracleSubscription"]: + """List OracleSubscription resources by subscription ID. + + :return: An iterator like instance of either OracleSubscription or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OracleSubscriptionListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OracleSubscriptionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, **kwargs: Any) -> _models.OracleSubscription: + """Get a OracleSubscription. + + :return: OracleSubscription or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.OracleSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OracleSubscription] = kwargs.pop("cls", None) + + _request = build_get_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OracleSubscription", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, resource: Union[_models.OracleSubscription, IO[bytes]], **kwargs: Any + ) -> _models.OracleSubscription: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OracleSubscription] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "OracleSubscription") + + _request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OracleSubscription", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("OracleSubscription", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, resource: _models.OracleSubscription, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.OracleSubscription]: + """Create a OracleSubscription. + + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.oracledatabase.models.OracleSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either OracleSubscription or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.OracleSubscription]: + """Create a OracleSubscription. + + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either OracleSubscription or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource: Union[_models.OracleSubscription, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.OracleSubscription]: + """Create a OracleSubscription. + + :param resource: Resource create parameters. Is either a OracleSubscription type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.oracledatabase.models.OracleSubscription or IO[bytes] + :return: An instance of LROPoller that returns either OracleSubscription or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OracleSubscription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OracleSubscription", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OracleSubscription].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OracleSubscription]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, properties: Union[_models.OracleSubscriptionUpdate, IO[bytes]], **kwargs: Any + ) -> Optional[_models.OracleSubscription]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.OracleSubscription]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "OracleSubscriptionUpdate") + + _request = build_update_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("OracleSubscription", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, properties: _models.OracleSubscriptionUpdate, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.OracleSubscription]: + """Update a OracleSubscription. + + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.oracledatabase.models.OracleSubscriptionUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either OracleSubscription or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.OracleSubscription]: + """Update a OracleSubscription. + + :param properties: The resource properties to be updated. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either OracleSubscription or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, properties: Union[_models.OracleSubscriptionUpdate, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.OracleSubscription]: + """Update a OracleSubscription. + + :param properties: The resource properties to be updated. Is either a OracleSubscriptionUpdate + type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.oracledatabase.models.OracleSubscriptionUpdate or IO[bytes] + :return: An instance of LROPoller that returns either OracleSubscription or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.OracleSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OracleSubscription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + properties=properties, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OracleSubscription", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OracleSubscription].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OracleSubscription]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace + def begin_delete(self, **kwargs: Any) -> LROPoller[None]: + """Delete a OracleSubscription. + + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + api_version=api_version, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _list_activation_links_initial(self, **kwargs: Any) -> Optional[_models.ActivationLinks]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.ActivationLinks]] = kwargs.pop("cls", None) + + _request = build_list_activation_links_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ActivationLinks", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_list_activation_links(self, **kwargs: Any) -> LROPoller[_models.ActivationLinks]: + """List Activation Links. + + :return: An instance of LROPoller that returns either ActivationLinks or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.ActivationLinks] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ActivationLinks] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._list_activation_links_initial( + api_version=api_version, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ActivationLinks", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ActivationLinks].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ActivationLinks]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _list_cloud_account_details_initial(self, **kwargs: Any) -> Optional[_models.CloudAccountDetails]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.CloudAccountDetails]] = kwargs.pop("cls", None) + + _request = build_list_cloud_account_details_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CloudAccountDetails", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_list_cloud_account_details(self, **kwargs: Any) -> LROPoller[_models.CloudAccountDetails]: + """List Cloud Account Details. + + :return: An instance of LROPoller that returns either CloudAccountDetails or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.CloudAccountDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CloudAccountDetails] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._list_cloud_account_details_initial( + api_version=api_version, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CloudAccountDetails", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CloudAccountDetails].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CloudAccountDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _list_saas_subscription_details_initial(self, **kwargs: Any) -> Optional[_models.SaasSubscriptionDetails]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.SaasSubscriptionDetails]] = kwargs.pop("cls", None) + + _request = build_list_saas_subscription_details_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("SaasSubscriptionDetails", pipeline_response) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_list_saas_subscription_details(self, **kwargs: Any) -> LROPoller[_models.SaasSubscriptionDetails]: + """List Saas Subscription Details. + + :return: An instance of LROPoller that returns either SaasSubscriptionDetails or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.SaasSubscriptionDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SaasSubscriptionDetails] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._list_saas_subscription_details_initial( + api_version=api_version, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SaasSubscriptionDetails", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.SaasSubscriptionDetails].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.SaasSubscriptionDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_patch.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_virtual_network_addresses_operations.py b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_virtual_network_addresses_operations.py new file mode 100644 index 000000000000..ea91059be521 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/operations/_virtual_network_addresses_operations.py @@ -0,0 +1,686 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_cloud_vm_cluster_request( + resource_group_name: str, cloudvmclustername: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/virtualNetworkAddresses", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudvmclustername": _SERIALIZER.url("cloudvmclustername", cloudvmclustername, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + cloudvmclustername: str, + virtualnetworkaddressname: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/virtualNetworkAddresses/{virtualnetworkaddressname}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudvmclustername": _SERIALIZER.url("cloudvmclustername", cloudvmclustername, "str"), + "virtualnetworkaddressname": _SERIALIZER.url( + "virtualnetworkaddressname", virtualnetworkaddressname, "str", max_length=63, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + cloudvmclustername: str, + virtualnetworkaddressname: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/virtualNetworkAddresses/{virtualnetworkaddressname}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudvmclustername": _SERIALIZER.url("cloudvmclustername", cloudvmclustername, "str"), + "virtualnetworkaddressname": _SERIALIZER.url( + "virtualnetworkaddressname", virtualnetworkaddressname, "str", max_length=63, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + cloudvmclustername: str, + virtualnetworkaddressname: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/virtualNetworkAddresses/{virtualnetworkaddressname}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "cloudvmclustername": _SERIALIZER.url("cloudvmclustername", cloudvmclustername, "str"), + "virtualnetworkaddressname": _SERIALIZER.url( + "virtualnetworkaddressname", virtualnetworkaddressname, "str", max_length=63, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class VirtualNetworkAddressesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.oracledatabase.OracleDatabaseMgmtClient`'s + :attr:`virtual_network_addresses` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_cloud_vm_cluster( + self, resource_group_name: str, cloudvmclustername: str, **kwargs: Any + ) -> Iterable["_models.VirtualNetworkAddress"]: + """List VirtualNetworkAddress resources by CloudVmCluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :return: An iterator like instance of either VirtualNetworkAddress or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.oracledatabase.models.VirtualNetworkAddress] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualNetworkAddressListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_cloud_vm_cluster_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualNetworkAddressListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, cloudvmclustername: str, virtualnetworkaddressname: str, **kwargs: Any + ) -> _models.VirtualNetworkAddress: + """Get a VirtualNetworkAddress. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param virtualnetworkaddressname: Virtual IP address hostname. Required. + :type virtualnetworkaddressname: str + :return: VirtualNetworkAddress or the result of cls(response) + :rtype: ~azure.mgmt.oracledatabase.models.VirtualNetworkAddress + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualNetworkAddress] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + virtualnetworkaddressname=virtualnetworkaddressname, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualNetworkAddress", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + cloudvmclustername: str, + virtualnetworkaddressname: str, + resource: Union[_models.VirtualNetworkAddress, IO[bytes]], + **kwargs: Any + ) -> _models.VirtualNetworkAddress: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkAddress] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "VirtualNetworkAddress") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + virtualnetworkaddressname=virtualnetworkaddressname, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("VirtualNetworkAddress", pipeline_response) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("VirtualNetworkAddress", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cloudvmclustername: str, + virtualnetworkaddressname: str, + resource: _models.VirtualNetworkAddress, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkAddress]: + """Create a VirtualNetworkAddress. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param virtualnetworkaddressname: Virtual IP address hostname. Required. + :type virtualnetworkaddressname: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.oracledatabase.models.VirtualNetworkAddress + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either VirtualNetworkAddress or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.VirtualNetworkAddress] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cloudvmclustername: str, + virtualnetworkaddressname: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkAddress]: + """Create a VirtualNetworkAddress. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param virtualnetworkaddressname: Virtual IP address hostname. Required. + :type virtualnetworkaddressname: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either VirtualNetworkAddress or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.VirtualNetworkAddress] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + cloudvmclustername: str, + virtualnetworkaddressname: str, + resource: Union[_models.VirtualNetworkAddress, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.VirtualNetworkAddress]: + """Create a VirtualNetworkAddress. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param virtualnetworkaddressname: Virtual IP address hostname. Required. + :type virtualnetworkaddressname: str + :param resource: Resource create parameters. Is either a VirtualNetworkAddress type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.oracledatabase.models.VirtualNetworkAddress or IO[bytes] + :return: An instance of LROPoller that returns either VirtualNetworkAddress or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.oracledatabase.models.VirtualNetworkAddress] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualNetworkAddress] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + virtualnetworkaddressname=virtualnetworkaddressname, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualNetworkAddress", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.VirtualNetworkAddress].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.VirtualNetworkAddress]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cloudvmclustername: str, virtualnetworkaddressname: str, **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + virtualnetworkaddressname=virtualnetworkaddressname, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, cloudvmclustername: str, virtualnetworkaddressname: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a VirtualNetworkAddress. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cloudvmclustername: CloudVmCluster name. Required. + :type cloudvmclustername: str + :param virtualnetworkaddressname: Virtual IP address hostname. Required. + :type virtualnetworkaddressname: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + cloudvmclustername=cloudvmclustername, + virtualnetworkaddressname=virtualnetworkaddressname, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/py.typed b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/azure/mgmt/oracledatabase/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/dev_requirements.txt b/sdk/Oracle/azure-mgmt-oracledatabase/dev_requirements.txt new file mode 100644 index 000000000000..ed9904af8228 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/dev_requirements.txt @@ -0,0 +1,3 @@ +-e ../../../tools/azure-sdk-tools +../../identity/azure-identity +../../resources/azure-mgmt-resource \ No newline at end of file diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_backup_create.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_backup_create.py new file mode 100644 index 000000000000..9c67af1e81dd --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_backup_create.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python autonomous_database_backup_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.autonomous_database_backups.begin_create_or_update( + resource_group_name="rg000", + autonomousdatabasename="databasedb1", + adbbackupid="1711644130", + resource={ + "properties": { + "autonomousDatabaseId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1", + "displayName": "Nightly Backup", + "retentionPeriodInDays": 365, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/autonomousDatabaseBackup_create.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_backup_delete.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_backup_delete.py new file mode 100644 index 000000000000..91a5801e6e0f --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_backup_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python autonomous_database_backup_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.autonomous_database_backups.begin_delete( + resource_group_name="rg000", + autonomousdatabasename="databasedb1", + adbbackupid="1711644130", + ).result() + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/autonomousDatabaseBackup_delete.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_backup_get.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_backup_get.py new file mode 100644 index 000000000000..f5594e994119 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_backup_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python autonomous_database_backup_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.autonomous_database_backups.get( + resource_group_name="rg000", + autonomousdatabasename="databasedb1", + adbbackupid="1711644130", + ) + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/autonomousDatabaseBackup_get.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_backup_list_by_parent.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_backup_list_by_parent.py new file mode 100644 index 000000000000..c753000b50a0 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_backup_list_by_parent.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python autonomous_database_backup_list_by_parent.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.autonomous_database_backups.list_by_autonomous_database( + resource_group_name="rg000", + autonomousdatabasename="databasedb1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/autonomousDatabaseBackup_listByParent.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_character_set_get.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_character_set_get.py new file mode 100644 index 000000000000..a4f2e90bf42b --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_character_set_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python autonomous_database_character_set_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.autonomous_database_character_sets.get( + location="eastus", + adbscharsetname="DATABASE", + ) + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/autonomousDatabaseCharacterSet_get.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_character_set_list_by_location.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_character_set_list_by_location.py new file mode 100644 index 000000000000..35d7a16cc085 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_character_set_list_by_location.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python autonomous_database_character_set_list_by_location.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.autonomous_database_character_sets.list_by_location( + location="eastus", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/autonomousDatabaseCharacterSet_listByLocation.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_clone_create.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_clone_create.py new file mode 100644 index 000000000000..bd1622c6e650 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_clone_create.py @@ -0,0 +1,62 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python autonomous_database_clone_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.autonomous_databases.begin_create_or_update( + resource_group_name="rg000", + autonomousdatabasename="databasedb1", + resource={ + "location": "eastus", + "properties": { + "adminPassword": "", + "characterSet": "AL32UTF8", + "cloneType": "Full", + "computeCount": 2, + "computeModel": "ECPU", + "dataBaseType": "Clone", + "dataStorageSizeInTbs": 1, + "displayName": "example_autonomous_databasedb1_clone", + "ncharacterSet": "AL16UTF16", + "sourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1", + "subnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1", + "vnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1", + }, + "tags": {"tagK1": "tagV1"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/autonomousDatabaseClone_create.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_create.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_create.py new file mode 100644 index 000000000000..dd1cd4cfa1bf --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_create.py @@ -0,0 +1,61 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python autonomous_database_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.autonomous_databases.begin_create_or_update( + resource_group_name="rg000", + autonomousdatabasename="databasedb1", + resource={ + "location": "eastus", + "properties": { + "adminPassword": "", + "characterSet": "AL32UTF8", + "computeCount": 2, + "computeModel": "ECPU", + "dataBaseType": "Regular", + "dataStorageSizeInTbs": 1, + "dbVersion": "18.4.0.0", + "displayName": "example_autonomous_databasedb1", + "ncharacterSet": "AL16UTF16", + "subnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1", + "vnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1", + }, + "tags": {"tagK1": "tagV1"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/autonomousDatabase_create.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_delete.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_delete.py new file mode 100644 index 000000000000..2e02887cb93f --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python autonomous_database_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.autonomous_databases.begin_delete( + resource_group_name="rg000", + autonomousdatabasename="databasedb1", + ).result() + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/autonomousDatabase_delete.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_failover.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_failover.py new file mode 100644 index 000000000000..554cbf9d23f8 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_failover.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python autonomous_database_failover.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.autonomous_databases.begin_failover( + resource_group_name="rg000", + autonomousdatabasename="databasedb1", + body={"peerDbId": "peerDbId"}, + ).result() + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/autonomousDatabase_failover.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_generate_wallet.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_generate_wallet.py new file mode 100644 index 000000000000..12ec36e8ea49 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_generate_wallet.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python autonomous_database_generate_wallet.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.autonomous_databases.generate_wallet( + resource_group_name="rg000", + autonomousdatabasename="databasedb1", + body={"generateType": "Single", "isRegional": False, "password": "ExamplePassword12345"}, + ) + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/autonomousDatabase_generateWallet.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_get.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_get.py new file mode 100644 index 000000000000..8eec05da4df6 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python autonomous_database_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.autonomous_databases.get( + resource_group_name="rg000", + autonomousdatabasename="databasedb1", + ) + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/autonomousDatabase_get.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_list_by_resource_group.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_list_by_resource_group.py new file mode 100644 index 000000000000..cc867acacd85 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_list_by_resource_group.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python autonomous_database_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.autonomous_databases.list_by_resource_group( + resource_group_name="rg000", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/autonomousDatabase_listByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_list_by_subscription.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_list_by_subscription.py new file mode 100644 index 000000000000..eed32db949d4 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_list_by_subscription.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python autonomous_database_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.autonomous_databases.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/autonomousDatabase_listBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_national_character_set_get.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_national_character_set_get.py new file mode 100644 index 000000000000..4b13fdd9988e --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_national_character_set_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python autonomous_database_national_character_set_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.autonomous_database_national_character_sets.get( + location="eastus", + adbsncharsetname="NATIONAL", + ) + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/autonomousDatabaseNationalCharacterSet_get.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_national_character_set_list_by_location.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_national_character_set_list_by_location.py new file mode 100644 index 000000000000..ff91b5909e0a --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_national_character_set_list_by_location.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python autonomous_database_national_character_set_list_by_location.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.autonomous_database_national_character_sets.list_by_location( + location="eastus", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/autonomousDatabaseNationalCharacterSet_listByLocation.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_switchover.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_switchover.py new file mode 100644 index 000000000000..6cc839404b6c --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_switchover.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python autonomous_database_switchover.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.autonomous_databases.begin_switchover( + resource_group_name="rg000", + autonomousdatabasename="databasedb1", + body={"peerDbId": "peerDbId"}, + ).result() + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/autonomousDatabase_switchover.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_version_get.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_version_get.py new file mode 100644 index 000000000000..4461fc6af1c1 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_version_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python autonomous_database_version_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.autonomous_database_versions.get( + location="eastus", + autonomousdbversionsname="18.4.0.0", + ) + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/autonomousDatabaseVersion_get.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_version_list_by_location.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_version_list_by_location.py new file mode 100644 index 000000000000..9971b79d62d8 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/autonomous_database_version_list_by_location.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python autonomous_database_version_list_by_location.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.autonomous_database_versions.list_by_location( + location="eastus", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/autonomousDatabaseVersion_listByLocation.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_nodes_action.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_nodes_action.py new file mode 100644 index 000000000000..a92a3407760c --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_nodes_action.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python db_nodes_action.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.db_nodes.begin_action( + resource_group_name="rg000", + cloudvmclustername="cluster1", + dbnodeocid="ocid1....aaaaaa", + body={"action": "Start"}, + ).result() + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/dbNodes_action.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_nodes_get.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_nodes_get.py new file mode 100644 index 000000000000..6b2dd0a8dbd7 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_nodes_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python db_nodes_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.db_nodes.get( + resource_group_name="rg000", + cloudvmclustername="cluster1", + dbnodeocid="ocid1....aaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/dbNodes_get.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_nodes_list_by_parent.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_nodes_list_by_parent.py new file mode 100644 index 000000000000..31f2ee21e150 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_nodes_list_by_parent.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python db_nodes_list_by_parent.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.db_nodes.list_by_cloud_vm_cluster( + resource_group_name="rg000", + cloudvmclustername="cluster1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/dbNodes_listByParent.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_servers_get.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_servers_get.py new file mode 100644 index 000000000000..b3a716a4e91c --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_servers_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python db_servers_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.db_servers.get( + resource_group_name="rg000", + cloudexadatainfrastructurename="infra1", + dbserverocid="ocid1....aaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/dbServers_get.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_servers_list_by_parent.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_servers_list_by_parent.py new file mode 100644 index 000000000000..b252ec084e3e --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_servers_list_by_parent.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python db_servers_list_by_parent.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.db_servers.list_by_cloud_exadata_infrastructure( + resource_group_name="rg000", + cloudexadatainfrastructurename="infra1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/dbServers_listByParent.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_system_shapes_get.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_system_shapes_get.py new file mode 100644 index 000000000000..56ebfe0a607d --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_system_shapes_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python db_system_shapes_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.db_system_shapes.get( + location="eastus", + dbsystemshapename="EXADATA.X9M", + ) + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/dbSystemShapes_get.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_system_shapes_list_by_location.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_system_shapes_list_by_location.py new file mode 100644 index 000000000000..1a9926963b57 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/db_system_shapes_list_by_location.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python db_system_shapes_list_by_location.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.db_system_shapes.list_by_location( + location="eastus", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/dbSystemShapes_listByLocation.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/dns_private_views_get.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/dns_private_views_get.py new file mode 100644 index 000000000000..8a448abdd1ed --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/dns_private_views_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python dns_private_views_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.dns_private_views.get( + location="eastus", + dnsprivateviewocid="ocid1....aaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/dnsPrivateViews_get.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/dns_private_views_list_by_location.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/dns_private_views_list_by_location.py new file mode 100644 index 000000000000..cc099396fd63 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/dns_private_views_list_by_location.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python dns_private_views_list_by_location.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.dns_private_views.list_by_location( + location="eastus", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/dnsPrivateViews_listByLocation.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/dns_private_zones_get.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/dns_private_zones_get.py new file mode 100644 index 000000000000..189eac88fea7 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/dns_private_zones_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python dns_private_zones_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.dns_private_zones.get( + location="eastus", + dnsprivatezonename="example-dns-private-zone", + ) + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/dnsPrivateZones_get.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/dns_private_zones_list_by_location.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/dns_private_zones_list_by_location.py new file mode 100644 index 000000000000..150ebfb8e7b5 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/dns_private_zones_list_by_location.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python dns_private_zones_list_by_location.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.dns_private_zones.list_by_location( + location="eastus", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/dnsPrivateZones_listByLocation.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_add_storage_capacity.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_add_storage_capacity.py new file mode 100644 index 000000000000..81aab5b7bfe8 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_add_storage_capacity.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python exa_infra_add_storage_capacity.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.cloud_exadata_infrastructures.begin_add_storage_capacity( + resource_group_name="rg000", + cloudexadatainfrastructurename="infra1", + ).result() + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/exaInfra_addStorageCapacity.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_create.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_create.py new file mode 100644 index 000000000000..7b081a69947b --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_create.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python exa_infra_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.cloud_exadata_infrastructures.begin_create_or_update( + resource_group_name="rg000", + cloudexadatainfrastructurename="infra1", + resource={ + "location": "eastus", + "properties": {"computeCount": 100, "displayName": "infra 1", "shape": "EXADATA.X9M", "storageCount": 10}, + "tags": {"tagK1": "tagV1"}, + "zones": ["1"], + }, + ).result() + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/exaInfra_create.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_delete.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_delete.py new file mode 100644 index 000000000000..969651e12b0c --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python exa_infra_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.cloud_exadata_infrastructures.begin_delete( + resource_group_name="rg000", + cloudexadatainfrastructurename="infra1", + ).result() + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/exaInfra_delete.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_get.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_get.py new file mode 100644 index 000000000000..d263e4507441 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python exa_infra_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.cloud_exadata_infrastructures.get( + resource_group_name="rg000", + cloudexadatainfrastructurename="infra1", + ) + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/exaInfra_get.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_list_by_resource_group.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_list_by_resource_group.py new file mode 100644 index 000000000000..3e20308621f6 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_list_by_resource_group.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python exa_infra_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.cloud_exadata_infrastructures.list_by_resource_group( + resource_group_name="rg000", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/exaInfra_listByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_list_by_subscription.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_list_by_subscription.py new file mode 100644 index 000000000000..76f5f3a665b1 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/exa_infra_list_by_subscription.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python exa_infra_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.cloud_exadata_infrastructures.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/exaInfra_listBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/gi_versions_get.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/gi_versions_get.py new file mode 100644 index 000000000000..18b043be8c48 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/gi_versions_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python gi_versions_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.gi_versions.get( + location="eastus", + giversionname="19.0.0.0", + ) + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/giVersions_get.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/gi_versions_list_by_location.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/gi_versions_list_by_location.py new file mode 100644 index 000000000000..fe8963fafeb4 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/gi_versions_list_by_location.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python gi_versions_list_by_location.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.gi_versions.list_by_location( + location="eastus", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/giVersions_listByLocation.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/operations_list.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/operations_list.py new file mode 100644 index 000000000000..e184150b477e --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/operations_list.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python operations_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/operations_list.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_create.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_create.py new file mode 100644 index 000000000000..8e7d031c2414 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_create.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python oracle_subscriptions_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.oracle_subscriptions.begin_create_or_update( + resource={ + "plan": { + "name": "plan1", + "product": "product1", + "promotionCode": "none", + "publisher": "publisher1", + "version": "alpha", + }, + "properties": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/oracleSubscriptions_create.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_delete.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_delete.py new file mode 100644 index 000000000000..9c0995f1b48c --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_delete.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python oracle_subscriptions_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.oracle_subscriptions.begin_delete().result() + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/oracleSubscriptions_delete.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_get.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_get.py new file mode 100644 index 000000000000..9b07cf9a0310 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_get.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python oracle_subscriptions_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.oracle_subscriptions.get() + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/oracleSubscriptions_get.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_list_activation_links.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_list_activation_links.py new file mode 100644 index 000000000000..37fa6afe9931 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_list_activation_links.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python oracle_subscriptions_list_activation_links.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.oracle_subscriptions.begin_list_activation_links().result() + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/oracleSubscriptions_listActivationLinks.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_list_by_subscription.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_list_by_subscription.py new file mode 100644 index 000000000000..2fe5030a156e --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_list_by_subscription.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python oracle_subscriptions_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.oracle_subscriptions.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/oracleSubscriptions_listBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_list_cloud_account_details.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_list_cloud_account_details.py new file mode 100644 index 000000000000..9ec2b87ab217 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_list_cloud_account_details.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python oracle_subscriptions_list_cloud_account_details.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.oracle_subscriptions.begin_list_cloud_account_details().result() + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/oracleSubscriptions_listCloudAccountDetails.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_list_saas_subscription_details.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_list_saas_subscription_details.py new file mode 100644 index 000000000000..3997c40caa07 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/oracle_subscriptions_list_saas_subscription_details.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python oracle_subscriptions_list_saas_subscription_details.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.oracle_subscriptions.begin_list_saas_subscription_details().result() + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/oracleSubscriptions_listSaasSubscriptionDetails.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/virtual_network_addresses_create.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/virtual_network_addresses_create.py new file mode 100644 index 000000000000..05abadd2442a --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/virtual_network_addresses_create.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python virtual_network_addresses_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.virtual_network_addresses.begin_create_or_update( + resource_group_name="rg000", + cloudvmclustername="cluster1", + virtualnetworkaddressname="hostname1", + resource={"properties": {"ipAddress": "192.168.0.1", "vmOcid": "ocid1..aaaa"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/virtualNetworkAddresses_create.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/virtual_network_addresses_delete.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/virtual_network_addresses_delete.py new file mode 100644 index 000000000000..c3d5d7ec08fa --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/virtual_network_addresses_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python virtual_network_addresses_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.virtual_network_addresses.begin_delete( + resource_group_name="rg000", + cloudvmclustername="cluster1", + virtualnetworkaddressname="hostname1", + ).result() + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/virtualNetworkAddresses_delete.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/virtual_network_addresses_get.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/virtual_network_addresses_get.py new file mode 100644 index 000000000000..2af6f41fa41e --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/virtual_network_addresses_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python virtual_network_addresses_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.virtual_network_addresses.get( + resource_group_name="rg000", + cloudvmclustername="cluster1", + virtualnetworkaddressname="hostname1", + ) + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/virtualNetworkAddresses_get.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/virtual_network_addresses_list_by_parent.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/virtual_network_addresses_list_by_parent.py new file mode 100644 index 000000000000..2bdf2c40805a --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/virtual_network_addresses_list_by_parent.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python virtual_network_addresses_list_by_parent.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.virtual_network_addresses.list_by_cloud_vm_cluster( + resource_group_name="rg000", + cloudvmclustername="cluster1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/virtualNetworkAddresses_listByParent.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_add_vms.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_add_vms.py new file mode 100644 index 000000000000..579c0fd9d09e --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_add_vms.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python vm_clusters_add_vms.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.cloud_vm_clusters.begin_add_vms( + resource_group_name="rg000", + cloudvmclustername="cluster1", + body={"dbServers": ["ocid1..aaaa", "ocid1..aaaaaa"]}, + ).result() + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/vmClusters_addVms.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_create.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_create.py new file mode 100644 index 000000000000..26f9271a9bb9 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_create.py @@ -0,0 +1,82 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python vm_clusters_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.cloud_vm_clusters.begin_create_or_update( + resource_group_name="rg000", + cloudvmclustername="cluster1", + resource={ + "location": "eastus", + "properties": { + "backupSubnetCidr": "172.17.5.0/24", + "cloudExadataInfrastructureId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1", + "clusterName": "cluster1", + "cpuCoreCount": 2, + "dataCollectionOptions": { + "isDiagnosticsEventsEnabled": False, + "isHealthMonitoringEnabled": False, + "isIncidentLogsEnabled": False, + }, + "dataStoragePercentage": 100, + "dataStorageSizeInTbs": 1000, + "dbNodeStorageSizeInGbs": 1000, + "dbServers": ["ocid1..aaaa"], + "displayName": "cluster 1", + "domain": "domain1", + "giVersion": "19.0.0.0", + "hostname": "hostname1", + "isLocalBackupEnabled": False, + "isSparseDiskgroupEnabled": False, + "licenseModel": "LicenseIncluded", + "memorySizeInGbs": 1000, + "nsgCidrs": [ + {"destinationPortRange": {"max": 1522, "min": 1520}, "source": "10.0.0.0/16"}, + {"source": "10.10.0.0/24"}, + ], + "ocpuCount": 3, + "scanListenerPortTcp": 1050, + "scanListenerPortTcpSsl": 1025, + "sshPublicKeys": ["ssh-key 1"], + "subnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1", + "timeZone": "UTC", + "vnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1", + }, + "tags": {"tagK1": "tagV1"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/vmClusters_create.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_delete.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_delete.py new file mode 100644 index 000000000000..ae35d55116ab --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python vm_clusters_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.cloud_vm_clusters.begin_delete( + resource_group_name="rg000", + cloudvmclustername="cluster1", + ).result() + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/vmClusters_delete.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_get.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_get.py new file mode 100644 index 000000000000..487c78fe407d --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python vm_clusters_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.cloud_vm_clusters.get( + resource_group_name="rg000", + cloudvmclustername="cluster1", + ) + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/vmClusters_get.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_list_by_resource_group.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_list_by_resource_group.py new file mode 100644 index 000000000000..8710ff32c47e --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_list_by_resource_group.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python vm_clusters_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.cloud_vm_clusters.list_by_resource_group( + resource_group_name="rg000", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/vmClusters_listByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_list_by_subscription.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_list_by_subscription.py new file mode 100644 index 000000000000..83e881b1f59e --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_list_by_subscription.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python vm_clusters_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.cloud_vm_clusters.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/vmClusters_listBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_list_private_ip_addresses.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_list_private_ip_addresses.py new file mode 100644 index 000000000000..2c0f2d90eaaf --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_list_private_ip_addresses.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python vm_clusters_list_private_ip_addresses.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.cloud_vm_clusters.list_private_ip_addresses( + resource_group_name="rg000", + cloudvmclustername="cluster1", + body={"subnetId": "ocid1..aaaaaa", "vnicId": "ocid1..aaaaa"}, + ) + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/vmClusters_listPrivateIpAddresses.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_remove_vms.py b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_remove_vms.py new file mode 100644 index 000000000000..eae56d4a87b9 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/generated_samples/vm_clusters_remove_vms.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-oracledatabase +# USAGE + python vm_clusters_remove_vms.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = OracleDatabaseMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.cloud_vm_clusters.begin_remove_vms( + resource_group_name="rg000", + cloudvmclustername="cluster1", + body={"dbServers": ["ocid1..aaaa"]}, + ).result() + print(response) + + +# x-ms-original-file: specification/oracle/resource-manager/Oracle.Database/preview/2023-09-01-preview/examples/vmClusters_removeVms.json +if __name__ == "__main__": + main() diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/sdk_packaging.toml b/sdk/Oracle/azure-mgmt-oracledatabase/sdk_packaging.toml new file mode 100644 index 000000000000..45452964c834 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/sdk_packaging.toml @@ -0,0 +1,12 @@ +[packaging] +package_name = "azure-mgmt-oracledatabase" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "Oracledatabase Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +exclude_folders = "" +title = "OracleDatabaseMgmtClient" diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/setup.py b/sdk/Oracle/azure-mgmt-oracledatabase/setup.py new file mode 100644 index 000000000000..0c1019715c5f --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/setup.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-oracledatabase" +PACKAGE_PPRINT_NAME = "Oracledatabase Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace("-", "/") +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace("-", ".") + +# Version extraction inspired from 'requests' +with open( + os.path.join(package_folder_path, "version.py") + if os.path.exists(os.path.join(package_folder_path, "version.py")) + else os.path.join(package_folder_path, "_version.py"), + "r", +) as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError("Cannot find version information") + +with open("README.md", encoding="utf-8") as f: + readme = f.read() +with open("CHANGELOG.md", encoding="utf-8") as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME), + long_description=readme + "\n\n" + changelog, + long_description_content_type="text/markdown", + license="MIT License", + author="Microsoft Corporation", + author_email="azpysdkhelp@microsoft.com", + url="https://github.com/Azure/azure-sdk-for-python", + keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product + classifiers=[ + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "License :: OSI Approved :: MIT License", + ], + zip_safe=False, + packages=find_packages( + exclude=[ + "tests", + # Exclude packages that will be covered by PEP420 or nspkg + "azure", + "azure.mgmt", + ] + ), + include_package_data=True, + package_data={ + "pytyped": ["py.typed"], + }, + install_requires=[ + "isodate>=0.6.1", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", + ], + python_requires=">=3.8", +) diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/tests/conftest.py b/sdk/Oracle/azure-mgmt-oracledatabase/tests/conftest.py new file mode 100644 index 000000000000..587e126e50b0 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/tests/conftest.py @@ -0,0 +1,50 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- +import os +import platform +import pytest +import sys + +from dotenv import load_dotenv + +from devtools_testutils import test_proxy, add_general_regex_sanitizer +from devtools_testutils import add_header_regex_sanitizer, add_body_key_sanitizer + +load_dotenv() + +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=client_secret, value="00000000-0000-0000-0000-000000000000") + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") \ No newline at end of file diff --git a/sdk/Oracle/azure-mgmt-oracledatabase/tests/test_cli_mgmt_oracledatabase.py b/sdk/Oracle/azure-mgmt-oracledatabase/tests/test_cli_mgmt_oracledatabase.py new file mode 100644 index 000000000000..82db59335c53 --- /dev/null +++ b/sdk/Oracle/azure-mgmt-oracledatabase/tests/test_cli_mgmt_oracledatabase.py @@ -0,0 +1,43 @@ +# coding: utf-8 + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import unittest +from azure.mgmt.oracledatabase import OracleDatabaseMgmtClient +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = 'eastus' + +class TestMgmtOracleDatabase(AzureMgmtRecordedTestCase): + + def setup_method(self, method): + self.client = self.create_mgmt_client(OracleDatabaseMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_cloud_vm_clusters_by_resource_group(self, resource_group): + assert list(self.client.cloud_vm_clusters.list_by_resource_group(resource_group.name)) == [] + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_cloud_exadata_infrastructures_by_resource_group(self, resource_group): + assert list(self.client.cloud_exadata_infrastructures.list_by_resource_group(resource_group.name)) == [] + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_autonomous_databases_by_resource_group(self, resource_group): + assert list(self.client.autonomous_databases.list_by_resource_group(resource_group.name)) == [] + + @unittest.skip("Lack of permission") + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_db_system_shapes_by_resource_group(self, resource_group): + assert list(self.client.db_system_shapes.list_by_location(location=AZURE_LOCATION)) == [] + + @recorded_by_proxy + def test_list_operations(self): + assert list(self.client.operations.list()) diff --git a/sdk/Oracle/ci.yml b/sdk/Oracle/ci.yml new file mode 100644 index 000000000000..d025d017c3a9 --- /dev/null +++ b/sdk/Oracle/ci.yml @@ -0,0 +1,34 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/Oracle/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/Oracle/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: Oracle + TestProxy: true + Artifacts: + - name: azure-mgmt-oracledatabase + safeName: azuremgmtoracledatabase